# Dynamic mapping setting for indices does not seem to be working

**URL:** <https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027>\
**Category:** Hibernate Search\
**Created:** [February 8, 2021, 3:59pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027 "2021-02-08T15:59:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ansuman\_Pattanayak](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ansuman_pattanayak/32/701_2.png) [@Ansuman\_Pattanayak](https://discourse.hibernate.org/u/Ansuman_Pattanayak)\
**Post date:** [February 8, 2021, 3:59pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/1 "2021-02-08T15:59:24Z")

</div>

Using these properties at the moment with 6.0.0.Final version, all properties are getting picked and used except the dynamic\_mapping one in the end. Verified by using drop-and-create strategy, and checking mapping in Elasticsearch.

```auto
spring.jpa.properties.hibernate.search.enabled=true
spring.jpa.properties.hibernate.search.backend.uris=http://127.0.0.1:9500
spring.jpa.properties.hibernate.search.schema_management.strategy=create
spring.jpa.properties.hibernate.search.backend.schema_management.minimal_required_status=green
spring.jpa.properties.hibernate.search.backend.analysis.configurer=io.avidsecure.search.CustomAnalyzer
spring.jpa.properties.hibernate.search.backend.layout.strategy=io.avidsecure.search.CustomIndexLayoutStrategy
spring.jpa.properties.hibernate.search.automatic_indexing.synchronization.strategy=io.avidsecure.search.CustomSynchronizationStrategy
spring.jpa.properties.hibernate.search.backend.dynamic_mapping=true

```

---

<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:** [February 8, 2021, 4:02pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/2 "2021-02-08T16:02:40Z")

</div>

> [@Ansuman\_Pattanayak](#):
>
> `spring.jpa.properties.hibernate.search.schema_management.strategy=create`

This schema management strategy will not touch any existing indexes, and leave them as they are.

Do your indexes already exist? If so, what happens if you switch the schema management strategy to `create-or-validate`?

---

<div class="post-metadata">

**Author:** ![Ansuman\_Pattanayak](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ansuman_pattanayak/32/701_2.png) [@Ansuman\_Pattanayak](https://discourse.hibernate.org/u/Ansuman_Pattanayak)\
**Post date:** [February 8, 2021, 4:03pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/3 "2021-02-08T16:03:53Z")

</div>

I updated the question with how I verified the setting, I actually used drop-and-create.

---

<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:** [February 8, 2021, 4:04pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/4 "2021-02-08T16:04:49Z")

</div>

Ah… actually you’re right, there’s a bug.

As a workaround for now, try using `spring.jpa.properties.hibernate.search.backend.indexing.dynamic_mapping=true`.

---

<div class="post-metadata">

**Author:** ![Ansuman\_Pattanayak](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ansuman_pattanayak/32/701_2.png) [@Ansuman\_Pattanayak](https://discourse.hibernate.org/u/Ansuman_Pattanayak)\
**Post date:** [February 8, 2021, 4:05pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/5 "2021-02-08T16:05:30Z")

</div>

Let me quickly try and check that.

---

<div class="post-metadata">

**Author:** ![Ansuman\_Pattanayak](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ansuman_pattanayak/32/701_2.png) [@Ansuman\_Pattanayak](https://discourse.hibernate.org/u/Ansuman_Pattanayak)\
**Post date:** [February 8, 2021, 4:08pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/6 "2021-02-08T16:08:07Z")

</div>

Yep, this one seems to be working 🙂 I think we should update the online documentation as well, till it is sorted?

---

<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:** [February 8, 2021, 4:11pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/7 "2021-02-08T16:11:22Z")

</div>

Actually the documentation is right, the implementation and tests are wrong. We’ll fix them in 6.0.2.Final: [[HSEARCH-4152] "hibernate.search.backend.dynamic\_mapping" is ignored - Hibernate JIRA](https://hibernate.atlassian.net/browse/HSEARCH-4152)

---

<div class="post-metadata">

**Author:** ![Ansuman\_Pattanayak](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ansuman_pattanayak/32/701_2.png) [@Ansuman\_Pattanayak](https://discourse.hibernate.org/u/Ansuman_Pattanayak)\
**Post date:** [February 8, 2021, 4:13pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/8 "2021-02-08T16:13:56Z")

</div>

Yes, I meant the document for it is not corresponding to the latest released version. But I also see what you mean. If 6.0.2.Final is around the corner, then I guess we keep the document as is.

---

<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:** [February 8, 2021, 4:15pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/9 "2021-02-08T16:15:03Z")

</div>

Changing the documentation requires a release, so if we release we might as well fix the bug rather than changing the documentation 🙂

---

<div class="post-metadata">

**Author:** ![Ansuman\_Pattanayak](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/ansuman_pattanayak/32/701_2.png) [@Ansuman\_Pattanayak](https://discourse.hibernate.org/u/Ansuman_Pattanayak)\
**Post date:** [February 8, 2021, 4:15pm UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/10 "2021-02-08T16:15:51Z")

</div>

Haha… Right 👍 Thanks for the help.

---

<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:** [February 11, 2021, 7:39am UTC](https://discourse.hibernate.org/t/dynamic-mapping-setting-for-indices-does-not-seem-to-be-working/5027/11 "2021-02-11T07:39:52Z")

</div>

For anyone else having this problem: this will be fixed in `6.0.2.Final` through [HSEARCH-4152](https://hibernate.atlassian.net/browse/HSEARCH-4152).

In the meantime, just use this configuration, to be sure it works both in `6.0.0.Final`/`6.0.1.Final` (buggy) and `6.0.2.Final` (fixed):

```auto
spring.jpa.properties.hibernate.search.backend.dynamic_mapping=true
spring.jpa.properties.hibernate.search.backend.indexing.dynamic_mapping=true

```

**EDIT** : [6.0.2.Final is out](https://in.relation.to/2021/02/24/hibernate-search-6-0-2-Final/).
