Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: CAMEL-7681

...

Maven users will need to add the following dependency to their pom.xml for this component:

Code Block
xml
xml

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-elasticsearch</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

Code Block

elasticsearch://clusterName[?options]

...

operation

message body

description

INDEX

Map, String, byte[] or XContentBuilder content to index

adds content to an index and returns the content's indexId in the body

GET_BY_ID

index id of content to retrieve

retrives the specified index and returns a GetResult object in the body

DELETE

index id of content to delete

deletes the specified indexId and returns a DeleteResult object in the body

BULK_INDEX

List or Collection of any type that is already accepted (XContentBuilder, Map, byte[], String)Since Camel 2.14, adds content to an index and return a List of the id of the successfully indexed documents in the body

Index Example

Below is a simple INDEX example

Code Block
java
java

from("direct:index")
.to("elasticsearch://local?operation=INDEX&indexName=twitter&indexType=tweet");
Code Block
xml
xml

<route>
    <from uri="direct:index" />
    <to uri="elasticsearch://local?operation=INDEX&indexName=twitter&indexType=tweet"/>
</route>

A client would simply need to pass a body message containing a Map to the route. The result body contains the indexId created.

Code Block
java
java

Map<String, String> map = new HashMap<String, String>();
map.put("content", "test");
String indexId = template.requestBody("direct:index", map, String.class);

...

ElasticSearch Main Site

ElasticSearch Java API

Include Page
Endpoint See Also
Endpoint See Also