# HS6 elastic custom Analyzer

**URL:** <https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586>\
**Category:** Hibernate Search\
**Created:** [September 17, 2020, 12:09pm UTC](https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586 "2020-09-17T12:09:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swarnkar](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@Swarnkar](https://discourse.hibernate.org/u/Swarnkar)\
**Post date:** [September 17, 2020, 12:09pm UTC](https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586/1 "2020-09-17T12:09:59Z")

</div>

Hi,  
Got this exception  
Response: 400 ‘Bad Request’ with body  
{  
“error”: {  
“root\_cause”: [  
{  
“type”: “mapper\_parsing\_exception”,  
“reason”: “analyzer [nameAnalyzer] not found for field [payerFirstName]”  
}  
],

though I have configured it in application

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/2/2c030bf60bdfe84cb07f5ea1e59d253fb955cbaa.png)

and here is analyzer class where I have define Analyzer

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/b/bd6cf609697215fe40d5cf94ab4446c14b73817f.png)

I am pretty much sure It worked once for me after flushing data and indices from db and elastic server its not working later

---

<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:** [September 17, 2020, 12:14pm UTC](https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586/2 "2020-09-17T12:14:26Z")

</div>

This typically happens if your Elasticsearch “schema” is not in sync with your Hibernate Search mapping.

Hibernate Search, by default, will create the index with the appropriate Elasticsearch “schema” on startup. It will also validate the “schema” on startup if the index already exists.

That is, unless you changed the configuration option `hibernate.search.schema_management.strategy`. Or you dropped and recreated the index manually (e.g. restored a snapshot).

Did you?

See [this section of the documentation](https://docs.jboss.org/hibernate/search/6.0/reference/en-US/html_single/#mapper-orm-schema-management) for more information about schema management.

---

<div class="post-metadata">

**Author:** ![Swarnkar](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@Swarnkar](https://discourse.hibernate.org/u/Swarnkar)\
**Post date:** [September 17, 2020, 12:15pm UTC](https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586/3 "2020-09-17T12:15:13Z")

</div>

Also I wanna this analyzer in HS6  
from HS5

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/hibernate/original/2X/9/932c210ca0a6fbb6016f81fbb6f5a9bb912c4559.png)

---

<div class="post-metadata">

**Author:** ![Swarnkar](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@Swarnkar](https://discourse.hibernate.org/u/Swarnkar)\
**Post date:** [September 17, 2020, 12:16pm UTC](https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586/4 "2020-09-17T12:16:36Z")

</div>

> [@yrodiere](#):
>
> Or you dropped and recreated the index manually (e.g. restored a snapshot).

I dropped it and later when my application start it will create all indexes again (only in non prod env)

---

<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:** [September 17, 2020, 12:18pm UTC](https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586/5 "2020-09-17T12:18:59Z")

</div>

Looking closer at your configuration, it seems you set the analysis configurer at the index level. It will only apply to a specific index.

If you want to use the same configuration for all indexes, set the property `hibernate.search.backend.analysis.configurer`.

---

<div class="post-metadata">

**Author:** ![Swarnkar](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@Swarnkar](https://discourse.hibernate.org/u/Swarnkar)\
**Post date:** [September 17, 2020, 12:20pm UTC](https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586/6 "2020-09-17T12:20:44Z")

</div>

> [@yrodiere](#):
>
> If you want to use the same configuration for all indexes, set the property

Thanks for reminding however I have very rare filed in object which require this strategy for analysis

---

<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:** [September 17, 2020, 12:23pm UTC](https://discourse.hibernate.org/t/hs6-elastic-custom-analyzer/4586/7 "2020-09-17T12:23:20Z")

</div>

Well unless your index is called `nameAnalyzer`, you used the wrong configuration property. It should be `hibernate.search.backend.indexes.<whatever your index name is>.analysis.configurer`. By default the index name is the entity name, so `MyEntity` or something like that, unless you overrode the index name with `@Indexed(name = ...)`.
