根据this article:
It is possible to change the field data format (and the field data settings in general) on a live index by using the update mapping API.
但是当我尝试:
curl -XPUT 'http://es1:123/my_index/my_type/_mapping' -d '
{
"my_type": {
"properties": {
"my_prop": {
"index": "not_analyzed",
"fielddata": {
"format": "doc_values"
},
"type": "string",
"fields": {
"hash": {
"type": "murmur3"
}
}
}
}
}
}
我得到:
MergeMappingException[Merge failed with failures {[mapper [my_prop] has different doc_values values]}]
任何的想法?
最佳答案
您需要为索引重新创建映射,并重新索引其中的所有文档。
您没有为该字段启用doc_values
:"doc_values": true
。但是您希望您的fielddata格式为doc_values
。这是不可能的。
为了能够将字段数据格式从更改为 doc_values
,反之亦然,您需要启用doc_values:"doc_values": true
。但是请注意,即使未启用doc_values,您也可以自由更改任何内存格式,这意味着从fst
到paged_bytes
,反之亦然。
关于elasticsearch - ElasticSearch-在现有索引上设置doc_values,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30754704/