多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# _id field 原文链接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/mapping-id-field.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/mapping-id-field.html) 译文链接 : [http://www.apache.wiki/display/Elasticsearch/_id+field](http://www.apache.wiki/display/Elasticsearch/_id+field) 贡献者 : [朱彦安](/display/~zhuyanan),[ApacheCN](/display/~apachecn),[Apache中文网](/display/~apachechina) 每个索引的文档都与一个 **_type **(请参见“**[Mapping Types](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/mapping.html#mapping-type)**”)和一个 **_id** 相关联。  该 **_id**字段不被索引,因为它的值可以从 **_uid **字段自动导出。 该 **_id**字段的值可以在某些查询( **term ,  terms ,  match ,  query_string ,  simple_query_string **)中访问,但不能在 **aggregations**(聚合),**scripts**(脚本)或 **sorting**(排序)中使用,而应使用 **_uid **字段代替 :  ``` # Example documents PUT my_index/my_type/1 { "text": "Document with ID 1" } PUT my_index/my_type/2&refresh=true { "text": "Document with ID 2" } GET my_index/_search { "query": { "terms": { "_id": [ "1", "2" ] # 1 } } } ``` | 1 | 在 **_id** 字段上查询(参见 [**ids** 查询](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/query-dsl-ids-query.html)) |