1. _id field

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.3/mapping-id-field.html

译文链接 : http://www.apache.wiki/display/Elasticsearch/_id+field

贡献者 : 朱彦安ApacheCNApache中文网

每个索引的文档都与一个 _type (请参见“Mapping Types”)和一个 _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 查询) |

Copyright © Kilvn 2021. all right reserved,powered by Gitbook最后更新时间: 2021-06-08 20:22:42

results matching ""

    No results matching ""