【问题标题】:Sum aggregation using jest client使用 jest 客户端求和聚合
【发布时间】:2017-03-06 06:31:58
【问题描述】:

我是 spring boot 和 elasticsearch 的新手。使用此参考 https://github.com/VanRoy/spring-data-jest 与 aws elasticsearch 建立连接。连接工作正常,现在我可以执行操作了。我想创建自定义存储库(基本上,想使用聚合)并使用 ElasticsearchTemplate,它给出了以下错误日志

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

行动:

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

我将如何解决这个问题。您的帮助将非常感激。

提前致谢

【问题讨论】:

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

标签: spring-boot elasticsearch elasticsearch-jest


【解决方案1】:

在您的主应用程序类文件中定义一个 bean,如下所示

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-11
    • 1970-01-01
    • 1970-01-01
    • 2021-12-20
    • 2021-01-29
    • 2020-03-24
    • 2021-05-20
    • 1970-01-01
    相关资源
    最近更新 更多