Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.15.6 - Bring Back IProperty.Name #8336

Open
niemyjski opened this issue Sep 5, 2024 · 2 comments
Open

8.15.6 - Bring Back IProperty.Name #8336

niemyjski opened this issue Sep 5, 2024 · 2 comments
Labels
8.x Relates to 8.x client version Category: Enhancement

Comments

@niemyjski
Copy link
Contributor

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:

Seems really important for debugging and lookup purposes to have the field name attached to a property. Maybe this could be stored in local metadata?. We use this heavily in Foundatio.Parsers for:

  1. Getting server and local code mappings to resolve field names based on partial name matches.
  2. Help with resolving FieldAliasProperty (seems really odd that FieldAliasProperty is missing the name).

Expected behavior

Being able to lookup properties by name

Reference: FoundatioFx/Foundatio.Parsers#84

@flobernd
Copy link
Member

flobernd commented Sep 6, 2024

Hi @niemyjski,

this is a difficult one. In ES, property objects do not hold their names. They are always used as part of a dictionary (Properties type in the new client):

{
  "prop": {
    "my_property": {
      "type": "boolean",
      "...": "..."
    }
  }
}

Keeping the property name as local metadata in the IProperty instance could easily cause inconsistencies if the same IProperty instance is added to multiple Properties dictionaries while using different names for the keys.

Would it help, if I add an additional method to the Properties dictionary type that allows to perform a reverse lookup? Something like:

class Properties
{
    public string? TryGetName(IProperty property) { ... }
}

@niemyjski
Copy link
Contributor Author

That would be extremely useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to 8.x client version Category: Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants