![](/img/trans.png)
[英]Unable to delete documents from ElasticSearch Index using cURL commands
[英]Is there any way to query elasticsearch using curl for multiple documents to extract field values from _source?
我正在寻找卷曲查询来查询索引中的多个唯一文档ID。 就像我们知道的那样,文档的实际数据存储在“ _source”下,但是到目前为止,我已经能够为源中的必填字段查询单个document_id,而不能查询包含过滤器的多个文档。 我认为'mget'在这里会有所帮助
例如-
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"
样本索引-
实际上有mget API:
http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
使用您的示例,您可以执行以下操作:
curl 'localhost:9200/my_index/_mget' -d '{
"docs" : [
{
"_type" : "document",
"_id" : "1"
},
{
"_type" : "document",
"_id" : "2"
}
]
}'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.