Elasticsearch return all documents of a given type

14,342

To get all documents from index analytics from type test just run:

curl -XGET localhost:9200/analytics/test/_search

or

curl -XGET localhost:9200/analytics/test/_search -d '{
    "query": {"match_all" : {}}
}'

If you have count of users more than default size value, you need provide from/size values like described here.

Share:
14,342
cutteeth
Author by

cutteeth

email : [email protected] LinkedIn: https://in.linkedin.com/in/gladsonvm

Updated on June 08, 2022

Comments

  • cutteeth
    cutteeth almost 2 years

    I have been searching for a solution to this question for a few days. Use case is to simply see the documents of a particular type only. Usually after googling for a long time I end up with some search queries with wildcards. I have gone through many SO Posts like this, this and elastic documentation also. I tried below urls but without any luck.

    curl -XGET 'localhost:9200/analytics/test/_search' -d '
    {
    
       "query" : {
       "match_all" : {}
        }
    }'
    
    curl -XGET 'localhost:9200/analytics/test/_search' -d '
    {
        "query": {
            "type":{
                "value": "test"
                }
        }
    }'
    

    Is there something like a wild card search on a document type to return all documents of that specific doc_type?