We have an Issue with the current Elasticsearch version
POST 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;
}