一 用命令操作
在ElasticSearch中默认fielddata默认是false的,因为开启Text的fielddata后对内存的占用很高
curl -i -H "Content-Type:application/json" -XPUT 127.0.0.1:9200/your_index/_mapping/your_type/?pretty -d'{"your_type":{"properties":{"your_field_name":{"type":"text","fielddata":true}}}}'
例如
curl -i -H "Content-Type:application/json" -XPUT 127.0.0.1:9200/contacts/_mapping/_doc/?pretty -d'{"_doc":{"properties":{"creater":{"type":"text","fielddata":true}}}}'
index:contacts
type: _doc
field_name:creater
二 es 插件操作
复合查询
contacts/_doc/_search GET
contacts/_mapping/_doc/?pretty POST
{"_doc":{"properties":{"creater":{"type":"text","fielddata":true}}}}
本文介绍了如何在ElasticSearch中开启Text字段的fielddata,包括通过命令操作和使用es插件进行设置,强调了开启后可能对内存的影响。
1993

被折叠的 条评论
为什么被折叠?



