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.
_type field
edit_type
field
editDeprecated in 6.0.0.
Each document indexed is associated with a _type
(see
Mapping Type) and an _id
. The _type
field is
indexed in order to make searching by type name fast.
The value of the _type
field is accessible in queries, aggregations,
scripts, and when sorting:
# Example documents PUT my_index/doc/1?refresh=true { "text": "Document with type 'doc'" } GET my_index/_search { "query": { "term": { "_type": "doc" } }, "aggs": { "types": { "terms": { "field": "_type", "size": 10 } } }, "sort": [ { "_type": { "order": "desc" } } ], "script_fields": { "type": { "script": { "lang": "painless", "source": "doc['_type']" } } } }