0
votes

I'm working on a project using Apache Camel and Elasticsearch and I was wondering which version of Elasticsearch does Camel support?

My pom.xml looks like this:

<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>

But when I want to route a file to elasticsearch, I've got the following error:

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

I found that this exception is due to a node or a TransportClient using an old version. So I try to add the elasticsearch dependency :

    <dependency>
      <groupId>org.elasticsearch</groupId>
      <artifactId>elasticsearch</artifactId>
      <version>5.1.2</version>
    </dependency>

But it gives me a new error:

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

So I'm wondering.. Which version of ES can I use with Apache Camel?

The code for trying to send data to 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");
1
Solved the problem by using an ES server 2.4.3! - Cylon

1 Answers

1
votes

I don't think you need to add any other pom except the camel-elasticsearch. It seems more likely that you have a TransportClient running on an older version. You need to find it and upgrade the 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