WARNING: Version 6.0 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
_field_names field
edit_field_names
field
editThe _field_names
field indexes the names of every field in a document that
contains any value other than null
. This field is used by the
exists
query to find documents that
either have or don’t have any non-null
value for a particular field.
The value of the _field_names
field is accessible in queries:
# Example documents PUT my_index/my_type/1 { "title": "This is a document" } PUT my_index/my_type/2?refresh=true { "title": "This is another document", "body": "This document has a body" } GET my_index/_search { "query": { "terms": { "_field_names": [ "title" ] } } }
Querying on the |
Disabling _field_names
editBecause _field_names
introduce some index-time overhead, you might want to
disable this field if you want to optimize for indexing speed and do not need
exists
queries.
PUT tweets { "mappings": { "tweet": { "_field_names": { "enabled": false } } } }