In my application, we build the search query in JSON format.e.g
{
"query": {
"bool": {
"must": [
{
"term": {
"officeCode.keyword": {
"value": "410"
}
}
},
{
"terms": {
"status.keyword": [
"CLOSED",
"CREDIT"
]
}
}
]
}
}
}
We use Elasticsearch Java 8.X API to execute the query using "co.elastic.clients.elasticsearch.ElasticsearchClient;"
String encodedJson = Base64.getEncoder().encodeToString(jsonQuery.getBytes());
SearchResponse<Map> searchResponse = elasticsearchClient.search(s -> s
.index(indexName)
.query(b -> b.queryString(b1 -> b1.query(encodedJson ))), Map.class);
I noticed that it completely ignores the query and returns the default max size. It does not throw an error, either. I also try to use the native JSON without encoding, but then it throws a "sharding error".