Follows up on HSEARCH-3115 Open and HSEARCH-3306: when using the Elasticsearch backend, allow to configure an index-specific analysis definition provider. Something like this, maybe:
@Indexed
@ElasticsearchIndex(typeName = …, analysisDefinitionProvider = @AnalysisDefinitionProviderReference(type = MyProvider.class))
public class MyType {
…
}
This is especially important because analyzer definitions are pushed to Elasticsearch on a per-index basis. If analyzer definitions are registered globally in Hibernate Search (as we do currently), we end up with two solutions, both dodgy:
- Either we push all definitions to every ES index, and risk unnecessary updates of the indexes, because some definitions are actually never used for some indexes.
- Or we push to each index only the analyzer definitions that are referenced from a field definition, and risk "forgetting" some definitions that are only used at query time.
Making (at least some) analyzer definitions index-scoped solves the problem: we can decide to push all the global definitions to every index, and the index-scoped definitions only to the index they are assigned to. This gives the user complete control over which definitions should be pushed to the each ES index. |