# Count Via REST Endpoint Query

**URL:** <https://discuss.elastic.co/t/count-via-rest-endpoint-query/98600>\
**Category:** Elasticsearch\
**Created:** [August 28, 2017, 7:24pm UTC](https://discuss.elastic.co/t/count-via-rest-endpoint-query/98600 "2017-08-28T19:24:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Velusamy\_Velu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/velusamy_velu/32/72364_2.png) [@Velusamy\_Velu](https://discuss.elastic.co/u/Velusamy_Velu)\
**Post date:** [August 28, 2017, 7:24pm UTC](https://discuss.elastic.co/t/count-via-rest-endpoint-query/98600/1 "2017-08-28T19:24:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mike.Barretta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike.barretta/32/16688_2.png) [@Mike.Barretta](https://discuss.elastic.co/u/Mike.Barretta)\
**Post date:** [August 28, 2017, 10:57pm UTC](https://discuss.elastic.co/t/count-via-rest-endpoint-query/98600/2 "2017-08-28T22:57:08Z")

</div>

@Velusamy_Velu the [Count API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html) is what you're looking for, I think.

Using query string:

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

```

Using query DSL:

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

```

---

<div class="post-metadata">

**Author:** ![Velusamy\_Velu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/velusamy_velu/32/72364_2.png) [@Velusamy\_Velu](https://discuss.elastic.co/u/Velusamy_Velu)\
**Post date:** [August 29, 2017, 2:11pm UTC](https://discuss.elastic.co/t/count-via-rest-endpoint-query/98600/3 "2017-08-29T14:11:39Z")

</div>

Mike:

I appreciate your feedback. It helped.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 26, 2017, 2:11pm UTC](https://discuss.elastic.co/t/count-via-rest-endpoint-query/98600/4 "2017-09-26T14:11:59Z")

</div>

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