在 Mapping 里面,将 dynamic 参数设置成 strict 可以拒绝索引包含未知字段的文档。 此条 Tips 由 medcl 贡献。

elasticsearch5.5.1 update mapping

Elasticsearch | 作者 Xiaoming | 发布于2017年10月23日 | 阅读数:8091

今天发现在5.5.1版本下修改字段mapping添加fielddata:true参数 一直报错提示不支持,5.4版本都没有问题,不知问题何在.求科普;
 
 
拿id字段来说 原来mapping定义如下:
 "id":{
"type":"long",
"index":"not_analyzed",

}
按id排序时提示,需要设置fielddata=true,所以准备更新字段mapping如下:
 curl -XPOST "http://127.0.0.1/test/test/_mapping?pretty" -d '{
"test": {
"properties": {
"id":{
"type":"long",
"index":"not_analyzed",
"fielddata":true
}
}
}
}'

 
结果:
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "Mapping definition for [id] has unsupported parameters: [fielddata : true]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Mapping definition for [id] has unsupported parameters: [fielddata : true]"
},
"status" : 400
}


 
已邀请:

Cheetah

赞同来自:

不分词字段即keyword现在是不用设置fileddata的,因为都是默认的doc_values,但是不分词字段因为doc不支持,那么才有放在fielddata里加快排序等操作
 

kennywu76 - Wood

赞同来自:

fielddata:true只能为text类型的字段添加,给的范例里是long类型,没有这个选项。

要回复问题请先登录注册