I have two applications which use the same Elasticsearch instance as a search engine. Both applications share the same code base and have only minor differences.
Applications run against different databases, and hence, the different ES indices should be used.
I try to parameterize index name using SpEL like this:
@Indexed(index="${es.index.users}")
public UserEntity {}
However, it doesn't work.
The second option I've tried was setting a different prefix for different applications via hibernate.search.default.indexBase=<app_name>
. However, it works only for the Lucene engine but not for ES.
Is there a way to pass the index name into @Indexed
annotation on the runtime?
If not, is there another way to pass the index which should be used?