elasticsearch – querying multiple indexes is possible?

This is quite easy within Elasticsearch itself! Anytime you would specify an index, you can separate additional indices by comma.

curl -XGET 'http://localhost:9200/index1,index2/_search?q=yourQueryHere'

You can also search all indices with _all.

curl -XGET 'http://localhost:9200/_all/_search?q=yourQueryHere'

Here’s some helpful documentation from elasticsearch’s website. This site has TONS of info, but it is a bit difficult to find sometimes, IMO.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html

Leave a Comment