我有一些要存储为字符串的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