简体   繁体   English

将springBoot与elasticsearch 2.x结合使用

[英]Combine springBoot with elasticsearch 2.x

I try to use spring boot 1.3.3 to realise project that communicate with elasticsearch. 我尝试使用spring boot 1.3.3来实现与elasticsearch进行通信的项目。 After many searches in the net, I found that spring-boot-starter-data-elasticsearch is not good in my case because it's using Elasticsearch 1.5 and i have to use Elasticsearch 2.2 There is still a hope to use spring boot ? 在网上进行了多次搜索之后,我发现spring-boot-starter-data-elasticsearch在我的情况下并不好,因为它使用Elasticsearch 1.5并且我必须使用Elasticsearch 2.2仍然有希望使用spring boot?

Of course you can use Spring Boot with Elasticsearch 2.x. 当然,您可以将Spring Boot与Elasticsearch 2.x一起使用。 I am using it. 我正在使用它。 Here is an extract of my gradle.build. 这是我的gradle.build的摘录。

apply plugin: 'spring-boot'

buildscript {
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
    }
}

dependencies {
    // Elasticsearch
    compile ("org.elasticsearch:elasticsearch:2.1.1")

    // Spring Boot
    compile("org.springframework.boot:spring-boot-starter-actuator")
    compile("org.springframework.boot:spring-boot-starter-web")
    ...
}
...

Just do not use spring-boot-starter-data-elasticsearch if it does not suit your needs. 如果它不适合您的需要,请不要使用spring-boot-starter-data-elasticsearch。

You can come back and update your dependencies if you need to, once the spring-boot-starter is updated with the latest version. 如果需要,可以在使用最新版本更新spring-boot-starter后返回并更新依赖项。 There is currently a 2.0.0.RC1 version of spring-data-elasticsearch for version 2.2.0 of Elasticsearch, so it is reasonable to assume that the spring-boot-starter will be updated soon as well. 对于Elasticsearch 2.2.0版本,目前有一个2.0.0.RC1版本的spring-data-elasticsearch,因此可以合理地假设spring-boot-starter也会很快更新。

Hope this helps. 希望这可以帮助。

Only spring-data-elasticsearch subproject is tied to Elasticsearch. 只有spring-data-elasticsearch子项目与Elasticsearch相关联。 And btw, IMHO this integration really sucks, because they tried to fit very flexible Elasticsearch API to quite limited interfaces. 顺便说一句,恕我直言,这种集成真的很糟糕,因为他们试图将非常灵活的Elasticsearch API适用于非常有限的接口。 If you want to use Spring Boot for microservices infrastructure and other stuff, just use it with appropriate version of elasticsearch client, don't bother with spring-boot-starter-data-elasticsearch. 如果你想将Spring Boot用于微服务基础设施和其他东西,只需将它与适当版本的elasticsearch客户端一起使用,不要打扰spring-boot-starter-data-elasticsearch。

We use https://github.com/searchbox-io/Jest succesfully with Spring Boot. 我们使用https://github.com/searchbox-io/Jest成功使用Spring Boot。 Formerly we tried to use spring-data-elasticsearch but it didn't work nice for us together with sping-data-mongodb. 以前我们尝试使用spring-data-elasticsearch但是它与sping-data-mongodb一起使用起来并不好用。 Then we moved to JEST and never looked back. 然后我们搬到了JEST,再也没有回头。

Simply add 只需添加

compile('io.searchbox:jest:2.0.2')

to gradle config file. gradle配置文件。 JEST has a huge set of tests where you can find all possible use cases. JEST有大量的测试,您可以在其中找到所有可能的用例。

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

相关问题 将 Springboot 1.x 中的 netflix feign 迁移到 Springboot 2.x 中的 openfeign - Migration netflix feign in Springboot 1.x to openfeign in Springboot 2.x SpringBoot + Hibernate + EHCache 2.X AbstractMethodError异常 - SpringBoot + Hibernate + EHCache 2.X AbstractMethodError exception Cloud Sleuth从SpringBoot 1.5更改为2.x - Cloud Sleuth change from SpringBoot 1.5 to 2.x SpringBoot 2.x 战争部署在 websphere 8.5.5.11 上失败并出现 jar 问题 - SpringBoot 2.x war deployment failing on websphere 8.5.5.11 with jar issues Springboot 2.x 需要 c3p0 吗? - Do i need c3p0 for Springboot 2.x? 计划将spring-data-elasticsearch升级到最新版本2.x? - Plans to upgrade spring-data-elasticsearch to latest version 2.x? 将 Elasticsearch 2.4 迁移到更高版本以及 Spring Framework 4.2.5 到 Springboot 2.x。 什么是最好的方法? - Migrate Elasticsearch 2.4 to higher version along with Spring Framework 4.2.5 to Springboot 2.x. What will be best approach? OpenJPA 2.x上的实体增强 - Entity enhancement on OpenJPA 2.x 从Elasticseatch 2.x升级到5.x - Upgrading from Elasticseatch 2.x to 5.x SpringApplicationBuilder 结合小型 SpringBoot 应用程序(模块化单体) - SpringApplicationBuilder to combine small SpringBoot applications (modular Monolith)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM