Skip to content

Encapsulate client specific aggregation return types #1920

@sothawo

Description

@sothawo

Currently Spring Data Elasticsearch returns aggregations in the SearchHits object as the original Aggregationsclass from the Elasticsearch libraries.

With the upcoming client changes we cannot use this class directly in the Spring Data Elasticsearch API anymore, as different clients will return different aggregation classes.

One solution would be to provide our own aggregation classes and map the ones from the clients onto these. But in Elasticsearch there are more than 80 different classes in this context and these are also evolving permanently. Trying to keep a mapping up to date will be a maintenance nightmare.

So we will introduce an interface AggregationContainer<T> where T is the concrete aggregations class from the used client library in the Spring Data Elasticsearch API. The code for the different clients will then provide concrete implementations of this interface and will return it to the caller. It's then the callers responsibility to use the classes from the chosen client implementation.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions