2014-05-20 17:34:00 +02:00
[[mapping-field-names-field]]
2015-07-20 01:24:29 +02:00
=== `_field_names` field
2018-06-04 09:17:11 +01: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 20:07:57 +01: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-20 01:24:29 +02:00
2018-06-04 09:17:11 +01: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 16:49:15 +02:00
2019-04-30 10:19:09 -04:00
[[disable-field-names]]
2017-10-06 16:49:15 +02:00
==== Disabling `_field_names`
2019-09-11 14:55:30 +02: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 09:17:11 +01: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 19:01:34 +03:00
`_field_names` by adding the following to the mappings:
2017-10-06 16:49:15 +02:00
2019-09-06 11:31:13 -04:00
[source,console]
2017-10-06 16:49:15 +02:00
--------------------------------------------------
2019-01-22 15:13:52 +01:00
PUT tweets
2017-10-06 16:49:15 +02:00
{
"mappings": {
2019-01-22 15:13:52 +01:00
"_field_names": {
"enabled": false
2017-10-06 16:49:15 +02:00
}
}
}
--------------------------------------------------
2019-09-11 14:55:30 +02:00
// TEST[warning:Index [tweets] uses the deprecated `enabled` setting for `_field_names`. Disabling _field_names is not necessary because it no longer carries a large index overhead. Support for this setting will be removed in a future major version. Please remove it from your mappings and templates.]