I am looking for curl queries to query multiple unique document ID's in the index. Like we know that the actual data for document is stored under "_source" but so far I am able to query the source for a single document_id for the required fields but not for multiple documents including a filter. I was of the opinion that 'mget' would be helpful here like
For eg -
curl -XGET "http://localhost:9200/my_index/document/id/_source?_source_include=_id_batch" -d "{"query":{"bool":{"must":[{"term":{"_doc_date":"20150122"}}],"from": 0,"fields":[],"size":5,"sort":[]}" > "C:\Users\user.id\Downloads\output.json"
Sample Index -
There is actually mget API:
http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
Using your example, you could do something like:
curl 'localhost:9200/my_index/_mget' -d '{
"docs" : [
{
"_type" : "document",
"_id" : "1"
},
{
"_type" : "document",
"_id" : "2"
}
]
}'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.