Override elasticsearch search type in Hibernate Search

I was wondering if it is possible to set the _type field in an Elasticsearch document using annotation in an entity class. I am currently using hibernate-search-orm and hibernate-elasticsearch version 5.8.2.Final .

Adding the @Indexed(name="my-index-name") annotation @Indexed(name="my-index-name") allows you to target a specific index. However, the document type is always the name of the class. If the project is ever organized differently, the type will not correspond to the class.

0
source share
1 answer

There is currently no way to do what you want.

If you change the organization of your project (for example, moving packages or changing the class name), you will have to reindex your data.

Using a class name is a good way to ensure that we do not have conflicts in names.

I will add this to the things we need to discuss for Search 6, and see if we want to act on this.

0
source

Source: https://habr.com/ru/post/1273171/


All Articles