elastic4s
elastic4s copied to clipboard
Support for custom aggregations
We have a custom plugin defining our own aggregation. Currently we are using a modified version of elastic4s 5.6.x where we implemented the support for our custom aggregation like any other elastic standard aggregation.
In the process of migrating to Elasticsearch 8, we are trying to remain on a standard version of elastic4s, but we did not find a way to support custom aggregations. The aggregation builder function is a static pattern match that will fail in case an aggregation is not known. That prevents support of custom aggregations.
We were thinking on adding this support. An idea we had was to introduce a parameter in the AggregationBuilderFn.apply of type PartialFunction[AbstractAggregation, XContentBuilder] or similar and this parameter would bubble up to SearchHandler that would become a class taking the partial function as (implicit?) parameter, and a default instance would take the default current behaviour that throws a NotImplementedError.
What do you think about something like this? We could do a PR and iterate over it.
You would need to break the type signature, but if the parameter was implicit, and a default implicit was provided, I think it would be ok. So yeah lets PR it and see.
Ok let's do it, thanks.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.