本文主要是介绍Elasticsearch为“非查询字段”不建索引index store,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
原文地址:http://blog.csdn.net/zhanlanmg/article/details/50847732
官方文档:index
简章翻译
文末附原文:
索引index
这个参数可以控制字段应该怎样建索引,怎样查询。它有以下三个可用值:
· no: 不把此字段添加到索引中,也就是不建索引,此字段不可查询
· not_analyzed:将字段的原始值放入索引中,作为一个独立的term,它是除string字段以外的所有字段的默认值。
· analyzed:string字段的默认值,会先进行分析后,再把分析的term结果存入索引中。
那么如果不需要的值,直接在mapping中设置为no就可以了。其它信息参考:store 和 _source field
简要说明:store就是把这个字段单独存储,默认是不存储的,默认存储的是 _source ,只有设置了才会存储,比如,有一个mapping有三个字段,title,subject,content,其中title,subject比较小,而content非常非常大,如果,你的查询结果只需要title,subject而不需要content时,把title,subject单独存储,可以节省很多时间
原文
index
The index option controls how field values are indexed and, thus, how they are searchable. It accepts three values:
no
Do not add this field value to the index. With this setting, the field will not be queryable.
not_analyzed
Add the field value to the index unchanged, as a single term. This is the default for all fields that support this option except for string fields. not_analyzed fields are usually used with term-level queries for structured search.
analyzed
This option applies only to string fields, for which it is the default. The string field value is first analyzed to convert the string into terms (e.g. a list of individual words), which are then indexed. At search time, the query string is passed through (usually) the same analyzer to generate terms in the same format as those in the index. It is this process that enables full text search.
For example, you can create a not_analyzed string field with the following:
这篇关于Elasticsearch为“非查询字段”不建索引index store的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!