HS6 elastic custom Analyzer

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

and here is analyzer class where I have define Analyzer

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

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 for more information about schema management.

1 Like

Also I wanna this analyzer in HS6
from HS5

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

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.

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

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 = ...).

1 Like