Repository: camel Updated Branches: refs/heads/master 73f3ee4b8 -> 2b67ee9c3
Added camel-elasticsearch docs to gitbook Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2b67ee9c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2b67ee9c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2b67ee9c Branch: refs/heads/master Commit: 2b67ee9c38e7d1a081f16f02c2a312becb0875e3 Parents: 73f3ee4 Author: Andrea Cosentino <[email protected]> Authored: Sat Mar 5 11:18:35 2016 +0100 Committer: Andrea Cosentino <[email protected]> Committed: Sat Mar 5 11:18:35 2016 +0100 ---------------------------------------------------------------------- .../src/main/docs/elasticsearch.adoc | 176 +++++++++++++++++++ docs/user-manual/en/SUMMARY.md | 1 + 2 files changed, 177 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/2b67ee9c/components/camel-elasticsearch/src/main/docs/elasticsearch.adoc ---------------------------------------------------------------------- diff --git a/components/camel-elasticsearch/src/main/docs/elasticsearch.adoc b/components/camel-elasticsearch/src/main/docs/elasticsearch.adoc new file mode 100644 index 0000000..4ee8ebf --- /dev/null +++ b/components/camel-elasticsearch/src/main/docs/elasticsearch.adoc @@ -0,0 +1,176 @@ +[[ElasticSearch-ElasticSearchComponent]] +ElasticSearch Component +~~~~~~~~~~~~~~~~~~~~~~~ + +*Available as of Camel 2.11* + +The ElasticSearch component allows you to interface with an +http://elasticsearch.org[ElasticSearch] server. + +Maven users will need to add the following dependency to their `pom.xml` +for this component: + +[source,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> +------------------------------------------------------------ + +[[ElasticSearch-URIformat]] +URI format +^^^^^^^^^^ + +[source,java] +------------------------------------- +elasticsearch://clusterName[?options] +------------------------------------- + +[Tip] +==== + + +if you want to run against a local (in JVM/classloader) ElasticSearch +server, just set the clusterName value in the URI to "local". See the +http://www.elasticsearch.org/guide/reference/java-api/client.html[client +guide] for more details. + +==== + +[[ElasticSearch-EndpointOptions]] +Endpoint Options +^^^^^^^^^^^^^^^^ + +The following options may be configured on the ElasticSearch endpoint. +All are required to be set as either an endpoint URI parameter or as a +header (headers override endpoint properties) + +[width="100%",cols="20%,80%",options="header",] +|======================================================================= +|name |description + +|operation |required, indicates the operation to perform + +|indexName |the name of the index to act against + +|indexType |the type of the index to act against + +|ip |the TransportClient remote host ip to use *Camel 2.12* + +|port |the TransportClient remote port to use (defaults to 9300) *Camel 2.12* + +|transportAddresses |comma separated list with _ip:port_ formatted remote transport addresses +to use *Camel 2.16*. Options _ip_ and _port_ must be left blank for _transportAddresses_ to +be considered instead. + +|consistencyLevel |the write consistency level to use with INDEX and BULK operations (can +be any of ONE, QUORUM, ALL or DEFAULT) *Camel 2.16* + +|replicationType |the replication type to use with INDEX and BULK operations (can be any +of SYNC, ASYNC or DEFAULT) *Camel 2.16* .*From version 2.17 replicationType option has been removed, since from +elasticsearch 2.0.0 the async replication has been removed.* + +|parent |optionally used with INDEX operations for Elasticsearch +https://www.elastic.co/guide/en/elasticsearch/guide/current/parent-child.html[Parent-Child +relationships] to specify the ID of the parent record *Camel 2.16.1 / +2.17.0* + +|clientTransportSniff |*From Camel 2.17* Define if the client is allowed to sniff the rest of +the cluster +|======================================================================= + +[[ElasticSearch-MessageOperations]] +Message Operations +^^^^^^^^^^^^^^^^^^ + +The following ElasticSearch operations are currently supported. Simply +set an endpoint URI option or exchange header with a key of "operation" +and a value set to one of the following. Some operations also require +other parameters or the message body to be set. + +[width="100%",cols="10%,10%,80%",options="header",] +|======================================================================= +|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. +*Camel 2.15,* you can set the indexId by setting the message header with +the key "indexId". + +|GET_BY_ID |index id of content to retrieve |retrieves 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 | a *List* or *Collection* of any type that is already accepted +(XContentBuilder, Map, byte[], String) |*Camel 2.14,*adds content to an index and return a List of the id of the +successfully indexed documents in the body + +|BULK |a *List* or *Collection* of any type that is already accepted +(XContentBuilder, Map, byte[], String) |*Camel 2.15:* Adds content to an index and returns the BulkResponse +object in the body + +|SEARCH |Map or SearchRequest Object |*Camel 2.15:* search the content with the map of query string + +|MULTIGET |List of MultigetRequest.Item object |*Camel 2.17:* retrieves the specified indexes, types etc. in +MultigetRequest and returns a MultigetResponse object in the body + +|MULTISEARCH |List of SearchRequest object |*Camel 2.17:* search for parameters specified in MultiSearchRequest and +returns a MultiSearchResponse object in the body + +|EXISTS |Index name as header |*Camel 2.17:* Returns a Boolean object in the body + +|UPDATE |Map, String, byte[] or XContentBuilder content to update |*Camel 2.17:* Updates content to an index and returns the content's +indexId in the body. +|======================================================================= + +[[ElasticSearch-IndexExample]] +Index Example +^^^^^^^^^^^^^ + +Below is a simple INDEX example + +[source,java] +------------------------------------------------------------------------------- +from("direct:index") +.to("elasticsearch://local?operation=INDEX&indexName=twitter&indexType=tweet"); +------------------------------------------------------------------------------- + +[source,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. + +[source,java] +------------------------------------------------------------------------- +Map<String, String> map = new HashMap<String, String>(); +map.put("content", "test"); +String indexId = template.requestBody("direct:index", map, String.class); +------------------------------------------------------------------------- + +[[ElasticSearch-Formoreinformation,seetheseresources]] +For more information, see these resources +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +http://elasticsearch.org[ElasticSearch Main Site] + +http://www.elasticsearch.org/guide/reference/java-api/[ElasticSearch +Java API] + +[[ElasticSearch-SeeAlso]] +See Also +^^^^^^^^ + +* link:configuring-camel.html[Configuring Camel] +* link:component.html[Component] +* link:endpoint.html[Endpoint] +* link:getting-started.html[Getting Started] + http://git-wip-us.apache.org/repos/asf/camel/blob/2b67ee9c/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index 6a5fa5c..c475f1c 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -122,6 +122,7 @@ * [Dozer](dozer.adoc) * [Dropbox](dropbox.adoc) * [Eclipse](eclipse.adoc) + * [ElasticSearch](elasticsearch.adoc) * [Ironmq](ironmq.adoc) * [JMS](jms.adoc) * [Metrics](metrics.adoc)
