Efficient way to retrieve all _ids in ElasticSearch

后端 未结 11 1917
轮回少年
轮回少年 2021-01-31 01:31

What is the fastest way to get all _ids of a certain index from ElasticSearch? Is it possible by using a simple query? One of my index has around 20,000 documents.

11条回答
  •  甜味超标
    2021-01-31 02:09

    For elasticsearch 5.x, you can use the "_source" field.

    GET /_search
    {
        "_source": false,
        "query" : {
            "term" : { "user" : "kimchy" }
        }
    }
    

    "fields" has been deprecated. (Error: "The field [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored")

提交回复
热议问题