elastic / elasticsearch-net

This strongly-typed, client library enables working with Elasticsearch. It is the official client maintained and supported by Elastic.
https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index.html
Apache License 2.0
15 stars 1.15k forks source link

8.15.6 - Bring back Aggregation LocalMetadata #8334

Open niemyjski opened 2 months ago

niemyjski commented 2 months ago

Elastic.Clients.Elasticsearch version: 8.15.6

Elasticsearch version: 8.15.1

.NET runtime version: 8.x

Operating system version: Any

Description of the problem including expected versus actual behavior:

We initially had long discussion about adding support for LocalMetadata and did a PR for this feature here https://github.com/elastic/elasticsearch-net/pull/2320 . LocalMetadata allowed libraries like Foundatio.Parsers / users to pass along extra data locally on the aggregation for things like runtime type, timezone information and more. This allowed us to parse a lucene like (dsl) string and convert it to your agg model, consume the returned aggregation data and convert it to our own dsl / models which supports multiple tech stacks like sql server.

Expected behavior

Bring back LocalMetadata so we can store data on the aggregation for round tripping.

Reference: https://github.com/FoundatioFx/Foundatio.Parsers/pull/84

flobernd commented 2 months ago

Hi @niemyjski,

This sounds like a very specialized use-case that might not be required for 99% of the users. Isn't that something that could easily be implemented by the user with a ConditionalWeakTable?

niemyjski commented 2 months ago

Yes, great suggestion and I was kind of thinking along those lines of having a lookup table. I'm going to try this approach.