...
The ElasticSearch component allows you to interface with an ElasticSearch server. Maven users will need to add the following dependency to their pom.xml
for this component:
Code Block | ||||
---|---|---|---|---|
| ||||
<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] |
...
Name | Description | ||
---|---|---|---|
| Required. The operation to perform. | ||
| The name of the index. | ||
| The type of the index. | ||
| From Camel 2.12. | ||
| From Camel 2.12. | ||
| From Camel 2.16. Options | ||
| From Camel 2.16. Can be one of:
| ||
| From Camel 2.16. Can be one of:
| ||
| From Camel 2.16.1 / 2.17.0 Optionally used with | ||
| From Camel 2.17 Define if the client is allowed to sniff the rest of the cluster. | ||
| From Camel 2.17.2 Define the the Default: |
...
Operation | Message body | Description |
---|---|---|
|
| Adds content to an index and returns the content's From Camel 2.15: you can set the |
| Index id of content to retrieve. | Retrieves the specified index and returns a |
| Index id of content to delete. | Deletes the specified |
| A | From Camel 2.14, adds : Adds content to an index and return a List a |
| A | From Camel 2.15: Adds content to an index and returns the |
|
| From Camel 2.15: search Search the content with the map of the |
|
| From Camel 2.17: retrieves Retrieves the specified indexes , types etc. type's specified in |
|
| From Camel 2.17: search Search for parameters specified in |
| Index name as a header. | From Camel 2.17: Returns a a |
|
| From Camel 2.17: Updates content to an index and returns the content's |
...
Below is a simple INDEX
example:
Code Block | ||||
---|---|---|---|---|
| ||||
from("direct:index") .to("elasticsearch://local?operation=INDEX&indexName=twitter&indexType=tweet"); |
...
A client would simply need to pass a body message containing a a Map
to the route. The result body contains the indexId
created.:
Code Block | ||||
---|---|---|---|---|
| ||||
Map<String, String> map = new HashMap<String, String>(); map.put("content", "test"); String indexId = template.requestBody("direct:index", map, String.class); |
...