2014-05-20 11:34:00 -04:00
[[mapping-field-names-field]]
2015-07-19 19:24:29 -04:00
=== `_field_names` field
2018-06-04 04:17:11 -04:00
The `_field_names` field used to index the names of every field in a document that
contains any value other than `null`. This field was used by the
2015-12-11 14:07:57 -05:00
<<query-dsl-exists-query,`exists`>> query to find documents that
either have or don't have any non-+null+ value for a particular field.
2015-07-19 19:24:29 -04:00
2018-06-04 04:17:11 -04:00
Now the `_field_names` field only indexes the names of fields that have
`doc_values` and `norms` disabled. For fields which have either `doc_values`
or `norm` enabled the <<query-dsl-exists-query,`exists`>> query will still
be available but will not use the `_field_names` field.
2017-10-06 10:49:15 -04:00
2019-04-30 10:19:09 -04:00
[[disable-field-names]]
2017-10-06 10:49:15 -04:00
==== Disabling `_field_names`
2019-09-11 08:55:30 -04:00
NOTE: Disabling `_field_names` has been deprecated and will be removed in a future major version.
Disabling `_field_names` is usually not necessary because it no longer
2018-06-04 04:17:11 -04:00
carries the index overhead it once did. If you have a lot of fields
which have `doc_values` and `norms` disabled and you do not need to
execute `exists` queries using those fields you might want to disable
2019-09-06 12:01:34 -04:00
`_field_names` by adding the following to the mappings:
2017-10-06 10:49:15 -04:00
2019-09-06 11:31:13 -04:00
[source,console]
2017-10-06 10:49:15 -04:00
--------------------------------------------------
2019-01-22 09:13:52 -05:00
PUT tweets
2017-10-06 10:49:15 -04:00
{
"mappings": {
2019-01-22 09:13:52 -05:00
"_field_names": {
"enabled": false
2017-10-06 10:49:15 -04:00
}
}
}
--------------------------------------------------
2020-08-11 04:02:28 -04:00
// TEST[warning:Disabling _field_names is not necessary because it no longer carries a large index overhead. Support for the `enabled` setting will be removed in a future major version. Please remove it from your mappings and templates.]