Open niemyjski opened 2 months ago
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) { ... }
}
That would be extremely useful!
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:
Expected behavior
Being able to lookup properties by name
Reference: https://github.com/FoundatioFx/Foundatio.Parsers/pull/84