Elasticsearch query on a specific index Elasticsearch query on a specific index elasticsearch elasticsearch

Elasticsearch query on a specific index


Heres curl example what works, and allows you to search multiple indexes:

curl 'http://localhost:9200/myindex1,myindex2/_search?q=*'

For single specific index:

curl 'http://localhost:9200/myindex1/_search?q=*'

To find find index names:

curl 'localhost:9200/_cat/indices'

And if you want to search all indexes:

curl 'localhost:9200/_search?pretty'


You can also add the index/type to the GET/PUT/DELETE ... query:

GET index/type/_search{   "query": {        "bool": {            "must": [                {                    "term": {                        ...                    }                }            ]        }    }}


GET index_name/_search{    "query": {        "match_all" : { }    }}

or specify the index type

GET index_name/index_type/_search{    "query": {        "match_all" : { }    }}