Modifying enabled property through config server is not working (HS 6 Beta 11)

I expect that synchronization work no longer after hibernate.search.enabled modified true to false through config-server.

When i refresh hibernate.search.enabled using actuator refresh api, printed log like below

o.h.s.e.b.o.spi.BatchingExecutor         : HSEARCH000231: Stopping executor 'Elasticsearch indexing orchestrator for index ...
...

but synchronization still working

I only added @RefreshScope annotation EntityManagerFactory build method.
Should i other object using hibernate.search.enabled refresh except EntityManagerFactory ?

Generally speaking, Hibernate Search configuration properties are only taken into account at boot time. I don’t know what your actuator API does exactly, but unless it restarts Hibernate ORM (and Search) completely, changing the value of hibernate.search.enabled won’t have any effect.

In short, yes, rebuilding the EntityManagerFactory with a different value for property hibernate.search.enabled will disable automatic indexing. But you need to rebuild it.

At the moment, there isn’t any way to disable automatic indexing without restarting Hibernate Search, though we will work on that eventually (HSEARCH-1383).

As to how to use @RefreshScope… I can imagine that restarting the JPA support requires specific handling, but to be honest I really do not know. This is a Spring-specific feature. You may have more luck asking around in Spring-specific forums, or on Stackoverflow with a spring tag?

1 Like