I have a complex Elasticsearch String query which I don't want to create using Java classes.
Is there a way I can achieve it so as to use it something like:
Query query = getQueryFromString(queryString);
co.elastic.clients.elasticsearch.core.SearchResponse searchResponse = null;
try {
co.elastic.clients.elasticsearch.core.SearchRequest request = new co.elastic.clients.elasticsearch.core.SearchRequest.Builder()
.index(indexName)
.size(pageSize)
.query(query
).build();
searchResponse = esClient.withTransportOptions(getRequestOptions()).search(request, Object.class);
} catch (Exception ex) {
log.error("Some exception occurred while requesting response from elasticsearch", ex);
}
I went through the documentation but couldn't really find a way to achieve so. Any help would be really appreciated.
I tried with Wrapper Query.
Convert query to Base64 and run the code bellow.
Query {"match_all": {}} is ewogICAgIm1hdGNoX2FsbCI6IHt9CiAgfQ==.