You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
_field_names fieldedit
The _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 and missing
queries to find documents that either have or don’t have any non-null value
for a particular field.
The value of the _field_name field is accessible in queries, aggregations, and
scripts:
# Example documents
PUT my_index/my_type/1
{
"title": "This is a document"
}
PUT my_index/my_type/1
{
"title": "This is another document",
"body": "This document has a body"
}
GET my_index/_search
{
"query": {
"terms": {
"_field_names": [ "title" ]
}
},
"aggs": {
"Field names": {
"terms": {
"field": "_field_names",
"size": 10
}
}
},
"script_fields": {
"Field names": {
"script": "doc['_field_names']"
}
}
}