Count Via REST Endpoint Query


(Velusamy Velu) #1

I would like to get the number of documents that meet a query criteria via REST endpoint. Something similar to this:

http://<server>:9200/<index>/<type>/_search?q={...}

Please let me know the syntax. Thanks in advance.


(Mike Barretta) #2

@Velusamy_Velu the Count API is what you're looking for, I think.

Using query string:

GET /twitter/tweet/_count?q=user:kimchy

Using query DSL:

GET /twitter/tweet/_count
{
    "query" : {
        "term" : { "user" : "kimchy" }
    }
}

(Velusamy Velu) #3

Mike:

I appreciate your feedback. It helped.

Thank you.


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.