Override Elasticsearch _type in Hibernate Search

ぃ、小莉子 提交于 2019-12-13 03:38:26

问题


I was wondering if it is possible to set the _type field on the Elasticsearch document using an annotation on the 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 allows me to target a specific index. However, the document type is always the Class name. If the project is ever organized in a different way the type would not match the class.


回答1:


There's no way to do what you want at the moment.

If you change the organization of your project (e.g. moving packages around or changing a class name), you will have to reindex your data.

Using the class name is a good way to be sure we won't have conflicts in the names.

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



来源:https://stackoverflow.com/questions/47107499/override-elasticsearch-type-in-hibernate-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!