i know there is support for bulk index operation. but is it possible to do the same for search queries? i want to send many different unrelated queries (to do precision/recall testing) and it would probably be faster using bulk query
Asked
Active
Viewed 9,880 times
1 Answers
20
Yes, you can use the multi search API and the /_msearch
endpoint to send as many queries as you wish in one shot.
curl -XPOST localhost:9200/_msearch -d '
{"index" : "test1"}
{"query" : {"match_all" : {}}, "from" : 0, "size" : 10}
{"index" : "test2"}
{"query" : {"match_all" : {}}}
'
You'll get a responses
array with the response of each query in the same order as in the request.
Note:
- make sure to separate each line by a newline character
- make sure to add the extra newline after the last query.

Val
- 207,596
- 13
- 358
- 360
-
Is the same available for count? Edit: _msearch + size: 0 does the trick – stan May 15 '20 at 13:39