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

**URL:** <https://discourse.hibernate.org/t/modifying-enabled-property-through-config-server-is-not-working-hs-6-beta-11/4697>\
**Category:** Hibernate Search\
**Created:** [October 27, 2020, 4:30am UTC](https://discourse.hibernate.org/t/modifying-enabled-property-through-config-server-is-not-working-hs-6-beta-11/4697 "2020-10-27T04:30:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mason](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@mason](https://discourse.hibernate.org/u/mason)\
**Post date:** [October 27, 2020, 4:30am UTC](https://discourse.hibernate.org/t/modifying-enabled-property-through-config-server-is-not-working-hs-6-beta-11/4697/1 "2020-10-27T04:30:20Z")

</div>

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

```auto
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**?

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [October 27, 2020, 7:35am UTC](https://discourse.hibernate.org/t/modifying-enabled-property-through-config-server-is-not-working-hs-6-beta-11/4697/2 "2020-10-27T07:35:42Z")

</div>

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](https://hibernate.atlassian.net/browse/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?
