Following a successful mass indexing process, when starting the application, I have a validation failure on the only one index :
Caused by: org.hibernate.search.util.common.SearchException: HSEARCH000520: Hibernate Search encountered failures during bootstrap. Failures:
Hibernate ORM mapping:
type 'com.allegoria.notariat.business.ActeParticipation':
failures:
- Validation of the existing index in the Elasticsearch cluster failed. See below for details.
field 'references':
attribute 'search_analyzer':
failures:
- Invalid value. Expected 'standard_min3_search_analyzer', actual is 'null'
field 'spf':
attribute 'search_analyzer':
failures:
- Invalid value. Expected 'standard_min3_search_analyzer', actual is 'null'
at org.hibernate.search.engine.reporting.spi.RootFailureCollector.checkNoFailure(RootFailureCollector.java:50)
at org.hibernate.search.engine.common.impl.SearchIntegrationPartialBuildStateImpl$SearchIntegrationFinalizerImpl.finalizeIntegration(SearchIntegrationPartialBuildStateImpl.java:187)
at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateOrmIntegrationPartialBuildState.doBootSecondPhase(HibernateOrmIntegrationPartialBuildState.java:75)
at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateOrmIntegrationBooterImpl.bootNow(HibernateOrmIntegrationBooterImpl.java:176)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:41)
at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:394)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:471)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:728)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:746)
at org.springframework.orm.hibernate5.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:615)
And the corresponding mapping of ActeParticipation :
public void configureReferences(TypeMappingStep typeMapping, PojoModelPathValueNode... derivedFrom) {
PropertyMappingStep propertyMappingStep = typeMapping.property(PROPERTY_PARAPHEUR_REFERENCES);
fullTextFieldSTANDARD(propertyMappingStep, SearchableParapheurIndexed.REFERENCES);
keywordField(propertyMappingStep, SearchableParapheurIndexed.REFERENCES_SORT, Aggregable.NO);
propertyMappingStep
.indexingDependency()
.reindexOnUpdate(ReindexOnUpdate.NO);
}
public static void fullTextFieldSTANDARD(PropertyMappingStep propertyMappingStep, String fieldName) {
propertyMappingStep
.fullTextField(fieldName)
.analyzer(STANDARD_MIN_3)
.searchAnalyzer(STANDARD_MIN_3)
.searchable(Searchable.YES)
.projectable(Projectable.YES);
}
According to the documentation :
searchAnalyzer
An optional different analyzer, overriding the one defined with the analyzer attribute, to use only
when analyzing searched terms.
If not defined, the analyzer assigned to analyzer will be used.
So I removed the mapping :
.searchAnalyzer(STANDARD_MIN_3) //turn into comment
And it starts, the validation was successful. I think, there is a little incoherence between the massindexer and the process of the validation.
The massindexer didn’t push the searchAnalyser because it is the same (contrary to other fields) :
GET /acteparticipation-read/_mapping
"references": {
"type": "text",
"analyzer": "standard_min3_search_analyzer"
},
"referencesSort": {
"type": "keyword"
},
"searchExtendedLabel": {
"type": "text",
"analyzer": "parapheur_shingle",
"search_analyzer": "exact_match_search_analyzer"
},