【发布时间】:2016-05-27 10:21:28
【问题描述】:
我有一些要存储为字符串的birth_dates。我不打算对数据进行任何查询或分析,我只是想存储它。
我得到的输入数据有很多不同的随机格式,有些甚至包括像(approximate) 这样的字符串。 Elastic 已确定这应该是具有日期格式的日期字段,这意味着当 Elastic 收到像 1981 (approx) 这样的日期时,它会吓坏并说输入格式无效。
我想将日期类型更改为字符串,而不是更改输入日期。
我查看了文档并尝试使用 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自动确定的日期字段,强制字符串为字段类型?
注意
我正在使用 google chrome sense 插件发送请求
弹性搜索版本是 2.3
【问题讨论】:
标签: elasticsearch elasticsearch-mapping