Count

    The count API gives you quick access to the number of documents that match a query. You can also use it to check the document count of an index, data stream, or cluster.

    To see the number of documents that match a query:

    1. {
    2. "query": {
    3. "response": "200"
    4. }
    5. },
    6. "size": 0,
    7. "track_total_hits": true
    8. }

    To see the number of documents in an index:

    To check for the number of documents in a data stream, replace the index name with the data stream name.

    1. GET _count

    Alternatively, you could use the and cat count APIs to see the number of documents per index or data stream.

    All count parameters are optional.

    1. "count" : 14074,
    2. "_shards" : {
    3. "total" : 1,
    4. "successful" : 1,
    5. "skipped" : 0,
    6. "failed" : 0
    7. }