我试图在我的项目中增加弹性搜索。我使用hibernate作为ORM来访问数据。我想将我的一些实体索引到elasticsearch集群中。
为此,除了hibernate类之外,我还想使用我现有的hibernate实体类并添加spring-data-elasticsearch注释。
我对这个选择并不完全有信心,我想知道其中是否存在一些设计错误(注释之间可能发生冲突?)。
例如,我必须添加2个Id注释:"@javax.persistence.Id用于hibernate,"@org.springframework.data.annotation.Id“用于弹性搜索。
提前感谢您的投入。
发布于 2015-09-27 23:15:10
我成功地配置和测试了将同一个类用于db存储和elasticsearch索引的想法。我意识到ES索引器包含类中的每个字段,而不仅仅是“弹性搜索注释”。
更多的是,春季数据弹性搜索是没有用的。我认为这是因为ES索引器使用了JPA注释,而且我们类的每个字段都有自己的hibernate.
最后,我将为db存储做一个类,为我的ES指数化做另一个类(包含更少的信息)。
发布于 2016-05-27 14:20:22
您还可以考虑本机Hibernate与Elasticsearch:- http://in.relation.to/2016/05/24/ElasticsearchintegrationReachesBeta1/的集成。
发布于 2015-11-07 05:33:05
您可以同时使用Spring和SPring数据弹性搜索。使用此配置:
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ElasticsearchCrudRepository.class))
@EnableElasticsearchRepositories(includeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = ElasticsearchCrudRepository.class))
public class DataConfiguration {
...
}https://stackoverflow.com/questions/32798377
复制相似问题