您的位置:首页 > 移动开发

ES mapping可以修改include_in_all,也可以修改index_options,norm,但是无法修改_all属性!

2017-05-15 15:48 459 查看
ES mapping可以修改include_in_all,也可以修改index_options,norm,但是无法修改_all属性!

curl -XPOST "http://localhost:9200/productindex"

curl -XGET "http://localhost:9200/productindex/_mapping?pretty"

curl -XPOST "http://localhost:9200/productindex/product/_mapping?pretty" -d '
{
"product": {
"properties": {
"title": {
"type": "string",
"include_in_all": true,
"index_options": "offsets",
"store": "yes"
},
"description": {
"type": "string",
"index": "not_analyzed"
},
"price": {
"type": "double"
},
"onSale": {
"type": "boolean"
},
"type": {
"type": "integer"
},
"createDate": {
"type": "date"
}
}
}
}
'

curl -XGET "http://localhost:9200/productindex/_mapping?pretty"

curl -XPOST "http://localhost:9200/productindex/product/_mapping?pretty" -d '{
"product": {
"properties": {
"amount":{
"type":"integer"
}
}
}
}'

curl -XPOST "http://localhost:9200/productindex/product/_mapping?pretty" -d '{
"product": {
"properties": {
"title":{
"type":"string" ,
"norms" : {
"enabled" : false
},
"include_in_all": false,
"index_options": "docs",
"store": "yes"
}
}
}
}'

可以看到,是可以直接修改include_in_all和index_options、norms属性的!

注意是没有办法修改_all属性的!
curl -XPOST "http://localhost:9200/productindex/product/_mapping?pretty" -d '{
"product": {
"_source": {
"enabled": false
},
"_all": {
"enabled": false
}
}
}'

会提示:
MergeMappingException: Merge failed with failures {[mapper [_all] enabled is false now encountering true]}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐