原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/mapping-type-field.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/mapping-type-field.html
本地英文版地址: ../en/mapping-type-field.html
重要: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 当前版本文档。
_type
fieldedit
Deprecated in 6.0.0.
Each document indexed is associated with a _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']" } } } }