# Count by query with es-5.0.0-RC1 parsing exception

**URL:** <https://discuss.elastic.co/t/count-by-query-with-es-5-0-0-rc1-parsing-exception/63175>\
**Category:** Elasticsearch\
**Created:** [October 17, 2016, 9:53am UTC](https://discuss.elastic.co/t/count-by-query-with-es-5-0-0-rc1-parsing-exception/63175 "2016-10-17T09:53:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spinner0815](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@spinner0815](https://discuss.elastic.co/u/spinner0815)\
**Post date:** [October 17, 2016, 9:53am UTC](https://discuss.elastic.co/t/count-by-query-with-es-5-0-0-rc1-parsing-exception/63175/1 "2016-10-17T09:53:27Z")

</div>

We have an Issue with the current Elasticsearch version  
POST [https://estest.dev1.ehm.rocks:443/testrest/test\_type/\_count:](https://estest.dev1.ehm.rocks:443/testrest/test_type/_count:) HTTP/1.1 400 Bad Request  
{"error":{"root\_cause":[{"type":"parsing\_exception","reason":"request does not support [ext]","line":7,"col":3}],"type":"parsing\_exception","reason":"request does not support [ext]","line":7,"col":3},"status":400}`

We use the elasticsearch Restclient and the SearchSourceBuilder

```
SearchSourceBuilder ssb = new SearchSourceBuilder();
ssb.query(QueryBuilders.matchAllQuery());
CountResponse countByQuery = testClient.countByQuery(ssb);

```

The ssb seems to have the ext key and elasticsearch cannot handle it

```
{
  "query" : {
    "match_all" : {
      "boost" : 1.0
    }
  },
  "ext" : { }
}

```

Our Restclient:

```
public CountResponse countByQuery(SearchSourceBuilder ssb) throws IOException
    {
        CountResponse result = null;
        Response response = restClient.performRequest("POST",
                "/" + index + "/" + indexType + "/_count", new Hashtable<>(), stringentity(ssb.toString().getBytes(UTF_8)),
                getHeaders());
        result = JsonMapping.stringToObject(responseContentToString(response), CountResponse.class);

        return result;
    }
```

---

<div class="post-metadata">

**Author:** ![hrishi\_es](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@hrishi\_es](https://discuss.elastic.co/u/hrishi_es)\
**Post date:** [April 6, 2017, 8:14pm UTC](https://discuss.elastic.co/t/count-by-query-with-es-5-0-0-rc1-parsing-exception/63175/2 "2017-04-06T20:14:01Z")

</div>

I am facing the same issue. Did you figure out what was the problem ?

---

<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:** [July 5, 2017, 10:01pm UTC](https://discuss.elastic.co/t/count-by-query-with-es-5-0-0-rc1-parsing-exception/63175/3 "2017-07-05T22:01:23Z")

</div>


