I need to use NativeSearchQueryBuilder to create a SearchQuery that does an aggregation, but NativeSearchQueryBuilder only support QueryBuilder as a query and I have developed all my filters as criteria query.
SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withQuery(myCriteria)
.addAggregation(aggregation)
.build();
I need something to convert myCriteria to QueryBuilder so I can do my aggregation. Or some other way of doing aggregation with criteria.
The aggregation I need is just a sum over a field for all documents that respect the match specified by Criteria
I use spring-data-opensearch.
I tried to convert criteria query into a json string and then convert it into a QueryBuilder but without success.
Domenico Fasano is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.