简体   繁体   English

在Hibernate搜索中覆盖Elasticsearch _type

[英]Override Elasticsearch _type in Hibernate Search

I was wondering if it is possible to set the _type field on the Elasticsearch document using an annotation on the entity class. 我想知道是否可以使用实体类上的注释在Elasticsearch文档上设置_type字段。 I am currently using hibernate-search-orm and hibernate-elasticsearch version 5.8.2.Final . 我目前正在使用hibernate-search-ormhibernate-elasticsearch 5.8.2.Final版本5.8.2.Final

Adding the @Indexed(name="my-index-name") annotation allows me to target a specific index. 添加@Indexed(name="my-index-name")批注使我可以定位特定的索引。 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. 如果项目是以其他方式组织的,则类型将与类不匹配。

There's no way to do what you want at the moment. 目前无法执行您想要的操作。

If you change the organization of your project (eg 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. 我将其添加到我们需要针对Search 6进行讨论的内容中,看看我们是否要对此采取行动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM