Closed domenicofasano99 closed 1 month ago
The public API is built with the Criteria
and the CriteriaQuery
. The purpose is to hide the process of Elasticsearch creation for these from the user and to provide an easy interface for queries.
Making the CriteriaQueryProcessor
public would expose it to the API, that would it basically make almost impossible to do refactorings, improvements and changes in this essential internal code without breaking changes and would hinder further development here. ~Above that, it would expose Elasticsearch classes into the API of Spring Data Elasticsearch outside of the org.springframework.data.elasticsearch.client.elc
package, which we won't do.~ Edit The query processor is in that package.
As for the use with aggregations: That's no issue. Aggregations can only be used with a NativeQuery
, and the NativeQueryBuilder
has a method that takes an Spring Data Elasticsearch Query
implementation and can take a CriteriaQuery
, so no need for any intermediate JSON representation of a query.
I have seen many applications needing access to the CriteriaQueryProcessor to be able to convert an object Criteria in a Query one and then convert it into a JSON String, so that it can be used in creating queries with aggregations. The only problem is that this class (CriteriaQueryProcessor) is not public, is there any reason not to expose it or could it be exposed so that users can use it directly?