gpt4 book ai didi

elasticsearch - Apache Camel与Elasticsearch的集成

转载 作者:行者123 更新时间:2023-12-03 01:48:00 25 4
gpt4 key购买 nike

我正在使用Apache Camel和Elasticsearch进行项目,我想知道Camel支持哪个版本的Elasticsearch?

我的pom.xml看起来像这样:

<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.18.2</version>
</dependency>

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-elasticsearch</artifactId>
<version>2.18.2</version>
</dependency>

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-xmljson</artifactId>
<version>2.18.2</version>
</dependency>

<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>

但是,当我想将文件路由到elasticsearch时,出现以下错误:

java.lang.IllegalStateException: Received message from unsupported version: [2.0.0] minimal compatible version is: [5.0.0]



我发现此异常是由于使用旧版本的节点或TransportClient引起的。所以我尝试添加elasticsearch依赖项:
    <dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.1.2</version>
</dependency>

但这给了我一个新的错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/action/WriteConsistencyLevel



所以我想知道..我可以在Apache Camel中使用哪个版本的ES?

尝试将数据发送到elasticsearch的代码:
XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();

from("file://C:/Projects/?fileName=data.xml&charset=utf-8")
.marshal(xmlJsonFormat)
.to("elasticsearch://clusterES?transportAddresses=127.0.0.1:9300&operation=BULK_INDEX&indexName=xml&indexType=account");

最佳答案

除了 Camel Elasticsearch ,我认为您不需要添加任何其他pom。您似乎更有可能在较旧版本上运行了TransportClient。您需要找到它并升级TransportClient。

https://www.elastic.co/guide/en/elasticsearch/guide/current/_transport_client_versus_node_client.html

https://discuss.elastic.co/t/received-message-from-unsupported-version-2-0-0-minimal-compatible-version-is-5-0-0/64708

关于elasticsearch - Apache Camel与Elasticsearch的集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42388961/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com