opensearch-project / opensearch-net

OpenSearch .NET Client
Apache License 2.0
102 stars 49 forks source link

[FEATURE] Being able to globally override behaviour(s) of automatic mappings #691

Open nalka0 opened 3 months ago

nalka0 commented 3 months ago

Is your feature request related to a problem?

For example if I want my properties with type string to be mapped as keyword, I need to manually apply the [Keyword] attribute to all of these properties.

What solution would you like?

Keeping the above example, instead of having to apply the [Keyword] attribute to all properties of type GUID. I'd like to be able to override the automatic mapping behaviour to make it map string properties as 'keyword'.

What alternatives have you considered?

Well as I said above, one could apply the [Keyword] attribute to all of these properties but it doesn't seem sustainable maintenance-wise

Do you have any additional context?

From my understanding, the automatic mapping currently happens in PropertyWalker.InferProperty(PropertyInfo)

Xtansia commented 3 months ago

@nalka0 Do you have any ideas for what you'd like the user experience of this to be? Is this something you might be interested in contributing yourself?

nalka0 commented 2 months ago

I'd say at some point (don't know when exactly though) the user could provide a dictionary or something similar that says map this CLR type to this Opensearch type ? If I ever feel familiar enough with the package to do so I guess I could try sending a pull request for this yes