Most efficient way to do multiple query counts

Suppose I have a large index of documents and a list of 500 different independent (query string) queries. I need to get the number of documents that match each of those queries and I need to get the counts as quickly and efficiently as possible. Is there an easy way to do this?

  • I could run the count API 500 times, but this is relatively slow.
  • I could use the multisearch API and just get back the doc counts of each of the MS search results, but this seems to put a heavy load on my machine.

Is there an easier way to accomplish what I need short of getting more/bigger machines?

See this thread: https://github.com/elastic/elasticsearch/issues/17926

I don't think there is a more efficient way beside changing the schema. To lower the load you can split the searches into smaller batches (ex: 50 or 100).