The index attribute controls how the string will be indexed. It can contain one of three values:
1. analyzed
First analyze the string and then index it. In other words, index this field as full text.
2. not_analyzed
Index this field, so it is searchable, but index the value exactly as specified. Do not analyze it.
3. no
Don't index this field at all. This field will not be searchable.
2 个回复
bill
赞同来自:
定义mapping时,某一列的index属性可以为以下值:analyzed, not_analyzed, no。
默认是analyzed,也就是查询这列时会使用分词。
可以按下面的定义设置not_analyzed。
{
"fieldname": {
"type": "string",
"index": "not_analyzed"
}
}
The index attribute controls how the string will be indexed. It can contain one of three values:
1. analyzed
First analyze the string and then index it. In other words, index this field as full text.
2. not_analyzed
Index this field, so it is searchable, but index the value exactly as specified. Do not analyze it.
3. no
Don't index this field at all. This field will not be searchable.
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自:
5.X之后分为text和keyword两种类型。
1、对于text类型,在mapping阶段需要先类似楼上指定Mapping,确立字段类型、分词器选择等;
2、检索的时候,通过match、match_phrase等检索就可以实现全文检索。
建议:先本地DSL验证。验证ok后用java选择对应API就可以了。