我有一些birth_dates,我想将其存储为字符串。我不打算对数据进行任何查询或分析,我只是想存储它。
我得到的输入数据有很多不同的随机格式,有些甚至包括(approximate)
这样的字符串。弹性已确定这应该是一个日期字段的日期格式,这意味着当弹性收到日期,如1981 (approx)
,它会抓狂,并说输入是无效的格式。
我不想更改输入日期,而是将日期类型更改为string。
我已经看过文档,并且一直试图用PUT
映射API更新映射,但是弹性一直在返回解析错误。
根据这里的文件:
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html
我试过:
PUT /sanctions_lists/eu_financial_sanctions/_mapping
{
"mappings":{
"eu_financial_sanctions":{
"properties": {
"birth_date": {
"type": "string", "index":"not_analyzed"
}
}
}
}
}
但返回:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [mappings : {eu_financial_sanctions={properties={birth_date={type=string, index=not_analyzed}}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [mappings : {eu_financial_sanctions={properties={birth_date={type=string, index=not_analyzed}}}}]"
},
"status": 400
}
问题摘要
是否可以重写elasticsearch的自动确定日期字段,强制字符串作为字段类型?
注意事项
我正在使用插件发送请求
弹性搜索版本为2.3
发布于 2016-05-27 01:47:19
只需从url中移除类型引用和映射,您就可以在请求正文中找到它们。更多的例子。
PUT /sanctions_lists
{
"mappings":{
"eu_financial_sanctions":{
"properties": {
"birth_date": {
"type": "string", "index":"not_analyzed"
}
}
}
}
}
https://stackoverflow.com/questions/37472252
复制相似问题