spring-projects / spring-data-elasticsearch

Provide support to increase developer productivity in Java when using Elasticsearch. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-elasticsearch/
Apache License 2.0
2.9k stars 1.33k forks source link

Dynamic excluding fields from source #2933

Open p-migda opened 3 months ago

p-migda commented 3 months ago

I want to manage to excluding fields by property from properties.yml. Can you add SpEL in to excludeFromSource ?

e.g.

@Field(excludeFromSource = "#{@environment.getProperty('es.excludeFromSource')}")

sothawo commented 3 months ago

In this way it's definitely not possible, as this would change the type of the Field.excludeFromSource from Boolean to String.

It might be a good thing to have some kind of customization hook that allows modifying a mapping before it is written to the index. Have to think about it.