spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.55k stars 40.54k forks source link

Provide configuration property for the refresh policy of ReactiveElasticsearchTemplate #30379

Open wilkinsona opened 2 years ago

wilkinsona commented 2 years ago

See #30096 and #30378 for background. To make it easier for users to configure the refresh policy and indices options of the auto-configured ReactiveElasticsearchTemplate, it would be good to provide configuration properties for those two settings.

There's no existing @ConfigurationProperties class to which these new properties could be added so we'll need to consider where we want the properties to go. The only Data Elasticsearch property that we have at the moment is spring.data.elasticsearch.repositories.enabled. The new properties should probably go beneath spring.data.elasticsearch.template.reactive or spring.data.elasticsearch.reactive.template.

wilkinsona commented 2 years ago

The new ReativeElasticsearchTemplate does not have configurable indices options so this issue's now scoped to only the refresh policy.

maroov commented 1 year ago

Hi, Is there any news regarding this? We recently migrated to Spring Boot 3 & Elastic 8 and so far have been unable to find a way to set the index options to "Lenient Expand Open" like we used to do with the old Template.

scottfrederick commented 1 year ago

@maroov Any news would be reflected in comments on this issue or changes in tags applied to it. Unfortunately this issue just hasn't risen to the top of our priority list.

hantsy commented 11 months ago

When the refresh policy is changed to null, it failed my tests in Data Elasticsearch example projects, the data saved in the before setup method is not found in the tests at all.

wilkinsona commented 11 months ago

When the refresh policy is changed to null

What is changing it to null? AFAIK, Spring Boot does not do that.

wilkinsona commented 11 months ago

@maroov I don't think this issue is going to provide what you want. There's no setter for the index options on org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchTemplate so, as far as we know, Spring Boot will not be able to configure it. Looking at https://github.com/spring-projects/spring-data-elasticsearch/issues/2639, I think the intention is that the options are configured when your application creates its queries. You may want to follow up with the Spring Data Elasticsearch team. This is out of Spring Boot's control.

keyzj commented 9 months ago

+1, for this issue