在Hibernate搜索中覆盖Elasticsearch _type [英] Override Elasticsearch _type in Hibernate Search

查看:83
本文介绍了在Hibernate搜索中覆盖Elasticsearch _type的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用实体类上的注释在Elasticsearch文档上设置_type字段.我当前正在使用hibernate-search-ormhibernate-elasticsearch版本5.8.2.Final.

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.

添加@Indexed(name="my-index-name")批注使我可以定位特定的索引.但是,文档类型始终是类"名称.如果项目以其他方式组织,则类型将与课程类型不符.

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.

推荐答案

目前无法执行您想要的操作.

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.

我将其添加到我们必须针对Search 6进行讨论的内容中,看看我们是否要对此采取行动.

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

这篇关于在Hibernate搜索中覆盖Elasticsearch _type的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆