I have a document with a number of fields that I never query on so I would like to turn indexing on those fields off to save resources. I believe I need to disable the _all
field, but how do I specify which fields are indexed then?
标签:
elasticsearch
相关问题
- not found value index error on elastic4s
- Issues when replicating from couchbase bucket to e
- Is there a way to sort an elasticsearch _score by
- failed to send join request to master
- Multi match boolean boost
相关文章
- es 单字段多分词器时,textField.keyword无法高亮
- ElasticSearch: How to search for a value in any fi
- What are the disadvantages of ElasticSearch Doc Va
- NoNodeAvailableException[None of the configured no
- Types cannot be provided in put mapping requests,
- Elasticsearch cluster 'master_not_discovered_e
- Does AWS RDS encryption with KMS affect performanc
- Locality-sensitive hashing - Elasticsearch
By default all the fields are indexed within the _all special field as well, which provides the so called catchall feature out of the box. However, you can specify for each field in your mapping whether you want to add it to the _all field or not, through the
include_in_all
option:The above example disables the default behaviour for the name field, which won't be part of the _all field.
Otherwise, if you don't need the _all field at all for a specific type you can disable it like this, again in your mapping:
When you disable it your fields will still be indexed separately, but you won't have the catchall feature that _all provides. You will need then to query your specific fields instead of relying on the _all special field, that's it. In fact, when you query and don't specify a field, elasticsearch queries the _all field under the hood, unless you override the default field to query.
Set dynamic index and _all index to false. Specify the required fields in mapping. https://www.elastic.co/guide/en/elasticsearch/guide/current/dynamic-mapping.html
You can utilize
enabled
field to disable particular field or entire mapping. ElasticSearch DocDisable Field mapping (i.e.
session_data
field)Disable entire mapping
Each string field has
index
param in the mapping config, which defaults toanalyzed
. That means that besides the _all field each field is indexed solely.And for the _all field it is said in reference that:
So, to completely disable indexing for a field you have to specify (if the _all field is enabled):
For the fields that should be queried on whether include them in the _all field (with
"index": "no"
to save resources) if you query through the _all field, or if you query on those fields solely use theindex
param with any positive value (analyzed
ornot_analyzed
) and disable the _all field to save resources.Following is an important doc page to understand the index settings in elastic search http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/mapping-intro.html
For your problem, ideally you should set the "index" flag to no in the field properties.