英文:
Is it possible to get document count with msearch API?
问题
I'm using the /_msearch
API to execute multiple queries with a single request.
But it does not allow me to specify the URL, so it looks like I can't get the document with /_count
API.
Is there any way to get document count with msearch API?
英文:
I'm using the /_msearch
API to execute multiple queries with a single request.
But it does not allow me to specify the URL, so it looks like I can't get the document with /_count
API.
Is there any way to get document count with msearch API?
答案1
得分: 2
You can add another match_all
query to your _msearch
call, like this:
POST _msearch
{ "index": "index1" }
{ "query1" }
{ "index": "index2" }
{ "query2" }
{ "index": "index3" }
{ "track_total_hits": true, "size": 0, "query": {"match_all":{}} }
英文:
You can add another match_all
query to your _msearch
call, like this:
POST _msearch
{ "index": "index1" }
{ "query1" }
{ "index": "index2" }
{ "query2" }
{ "index": "index3" }
{ "track_total_hits": true, "size": 0, "query": {"match_all":{}} }
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论