使用客户端客户端进行总和聚合

问题描述:

我是Spring引导和弹性搜索的新成员。使用此参考https://github.com/VanRoy/spring-data-jest使用aws elasticsearch进行连接。现在连接工作正常,我可以执行操作。我想创建自定义存储库(基本上想要使用聚合)并使用ElasticsearchTemplate,它给出以下错误日志:使用客户端客户端进行总和聚合

com.example.abcRepositoryImpl中的字段elasticsearchTemplate需要一个类型为'org.springframework.data.elasticsearch'的bean。 core.ElasticsearchTemplate'找不到。 - Bean方法“elasticsearchTemplate”不加载,因为自动配置“ElasticsearchDataAutoConfiguration”被排除

操作:

考虑重新审视上述条件或限定类型“org.springframework.data.elasticsearch.core的豆。 ElasticsearchTemplate'在您的配置。

我将如何解决问题。你的帮助将非常可观。

在此先感谢

+0

我得到了解决。我们可以使用JestClient接口并执行操作。例如:@Autowired \t JestClient客户端; – Kumar

在你的主应用程序类文件中定义一个bean像下面

@Bean 
public JestElasticsearchTemplate elasticsearchTemplate(JestClient client) { 
    return new JestElasticsearchTemplate(client); 
}