One can imagine defining analyzers that will only be used when querying, for instance when the analyzer used when indexing creates ngrams. In this case, analyzers are not referenced in Hibernate Search's internal entity metamodel. Unfortunately, Hibernate Search only adds to the index settings those analyzers that are referenced in the related entity metamodel. Which means those analyzers will not be available when querying, when using org.hibernate.search.query.dsl.impl.ConnectedQueryContextBuilder.HSearchEntityContext.overridesForField(String, String) for instance. We should make sure that either:
- all Elasticsearch analyzer definitions are pushed to all Elasticsearch indexes. Downsides: this will trigger unnecessary updates when using the MERGE strategy (see https://github.com/hibernate/hibernate-search/pull/1271), and we may have issues when users have both Elasticsearch and embedded Lucene indexes.
- OR users are able to explicitly mark analyzer definitions as available in a given Elasticsearch index.
|