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
17 stars 1.15k forks source link

8.15.6 - IPropertyWithClrOrigin replacements? #8337

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 had code in Foundatio.Parsers that merged code mappings with server side mappings and we found a case where coded properties could be null but have a clr name and we used it for that. Is there a good way to replace this?

    // coded properties sometimes have null Name properties
            if (fieldMapping.Name == null && fieldMapping is IPropertyWithClrOrigin clrOrigin && clrOrigin.ClrOrigin != null)
                fieldMapping.Name = new PropertyName(clrOrigin.ClrOrigin);

https://github.com/FoundatioFx/Foundatio.Parsers/blob/main/src/Foundatio.Parsers.ElasticQueries/ElasticMappingResolver.cs#L124-L126

Expected behavior

Being able to resolve coded properties using the clr name.

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