CAMEL-11868: Added docs and deprecated the two older elasticsearch components.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f929b940 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f929b940 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f929b940 Branch: refs/heads/master Commit: f929b940da164b4c4bd11638c8fe693c57f59c3a Parents: e9a3459 Author: Claus Ibsen <[email protected]> Authored: Mon Oct 16 20:50:31 2017 +0200 Committer: Claus Ibsen <[email protected]> Committed: Mon Oct 16 20:50:31 2017 +0200 ---------------------------------------------------------------------- components/camel-elasticsearch/pom.xml | 2 +- .../src/main/docs/elasticsearch-component.adoc | 4 +- .../docs/elasticsearch5-rest-component.adoc | 162 +++++++++++++++++++ .../elasticsearch5/ElasticsearchConstants.java | 2 - .../elasticsearch5/ElasticsearchEndpoint.java | 4 +- components/camel-elasticsearch5/pom.xml | 2 +- .../src/main/docs/elasticsearch5-component.adoc | 4 +- components/readme.adoc | 8 +- docs/user-manual/en/SUMMARY.md | 2 +- 9 files changed, 175 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/components/camel-elasticsearch/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-elasticsearch/pom.xml b/components/camel-elasticsearch/pom.xml index 81b3724..288ee87 100644 --- a/components/camel-elasticsearch/pom.xml +++ b/components/camel-elasticsearch/pom.xml @@ -29,7 +29,7 @@ <artifactId>camel-elasticsearch</artifactId> <packaging>jar</packaging> - <name>Camel :: ElasticSearch</name> + <name>Camel :: ElasticSearch (deprecated)</name> <description>Camel Elasticsearch support</description> <properties> http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc b/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc index b160c9e..2f1b187 100644 --- a/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc +++ b/components/camel-elasticsearch/src/main/docs/elasticsearch-component.adoc @@ -1,4 +1,4 @@ -== Elasticsearch Component +== Elasticsearch Component (deprecated) *Available as of Camel version 2.11* @@ -173,4 +173,4 @@ Java API] * link:configuring-camel.html[Configuring Camel] * link:component.html[Component] * link:endpoint.html[Endpoint] -* link:getting-started.html[Getting Started] +* link:getting-started.html[Getting Started] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/components/camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc b/components/camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc new file mode 100644 index 0000000..f17abaa --- /dev/null +++ b/components/camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc @@ -0,0 +1,162 @@ +== Elastichsearch5 Rest Component + +*Available as of Camel version 2.21* + +The ElasticSearch component allows you to interface with an +https://www.elastic.co/products/elasticsearch[ElasticSearch] 5.x API using the REST Client library. + +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-elasticsearch5</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---- + +=== URI format + +[source] +---- +elasticsearch5-rest://clusterName[?options] +---- + + +=== Endpoint Options + +// component options: START +The Elastichsearch5 Rest component supports 12 options which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *client* (advanced) | To use an existing configured Elasticsearch client instead of creating a client per endpoint. This allow to customize the client with specific settings. | | RestClient +| *hostAddresses* (advanced) | Comma separated list with ip:port formatted remote transport addresses to use. The ip and port options must be left blank for hostAddresses to be considered instead. | | String +| *socketTimeout* (advanced) | The timeout in ms to wait before the socket will timeout. | 30000 | int +| *connectionTimeout* (advanced) | The time in ms to wait before connection will timeout. | 30000 | int +| *user* (advance) | Basic authenticate user | | String +| *password* (producer) | Password for authenticate | | String +| *enableSSL* (advanced) | Enable SSL | false | Boolean +| *maxRetryTimeout* (advanced) | The time in ms before retry | 30000 | int +| *enableSniffer* (advanced) | Enable automatically discover nodes from a running Elasticsearch cluster | false | Boolean +| *snifferInterval* (advanced) | The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions | 300000 | int +| *sniffAfterFailureDelay* (advanced) | The delay of a sniff execution scheduled after a failure (in milliseconds) | 60000 | int +| *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean +|=== +// component options: END + + +// endpoint options: START +The Elastichsearch5 Rest endpoint is configured using URI syntax: + +---- +elasticsearch5-rest:clusterName +---- + +with the following path and query parameters: + +==== Path Parameters (1 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *clusterName* | *Required* Name of the cluster | | String +|=== + +==== Query Parameters (10 parameters): + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *connectionTimeout* (producer) | The time in ms to wait before connection will timeout. | 30000 | int +| *disconnect* (producer) | Disconnect after it finish calling the producer | false | boolean +| *hostAddresses* (producer) | *Required* Comma separated list with ip:port formatted remote transport addresses to use. The ip and port options must be left blank for hostAddresses to be considered instead. | | String +| *indexName* (producer) | The name of the index to act against | | String +| *indexType* (producer) | The type of the index to act against | | String +| *maxRetryTimeout* (producer) | The time in ms before retry | 30000 | int +| *operation* (producer) | What operation to perform | | ElasticsearchOperation +| *socketTimeout* (producer) | The timeout in ms to wait before the socket will timeout. | 30000 | int +| *waitForActiveShards* (producer) | Index creation waits for the write consistency number of shards to be available | 1 | int +| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean +|=== +// endpoint options: END + + +=== 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. +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 name and type of content to delete |Deletes the specified indexName and indexType and returns a DeleteResponse object in the +body + +|DELETE_INDEX |index name of content to delete |Deletes the specified indexName and returns a DeleteIndexResponse object in the +body + +|BULK_INDEX | a *List* or *Collection* of any type that is already accepted +(XContentBuilder, Map, byte[], String) |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) |Adds content to an index and returns the BulkResponse +object in the body + +|SEARCH |Map, String or SearchRequest Object |Search the content with the map of query string + +|MULTIGET |List of MultigetRequest.Item object |Retrieves the specified indexes, types etc. in +MultigetRequest and returns a MultigetResponse object in the body + +|MULTISEARCH |List of SearchRequest object |Search for parameters specified in MultiSearchRequest and +returns a MultiSearchResponse object in the body + +|EXISTS |Index name as header |Checks the index exists or not and returns a Boolean flag in the body + +|UPDATE |Map, String, byte[] or XContentBuilder content to update |Updates content to an index and returns the content's +indexId in the body. +|=== + +=== Index Example + +Below is a simple INDEX example + +[source,java] +---- +from("direct:index") + .to("elasticsearch5-rest://elasticsearch?operation=INDEX&indexName=twitter&indexType=tweet"); +---- + +[source,xml] +---- +<route> + <from uri="direct:index" /> + <to uri="elasticsearch5-rest://elasticsearch?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); +---- http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConstants.java ---------------------------------------------------------------------- diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConstants.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConstants.java index 9f2d493..6e9de16 100644 --- a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConstants.java +++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConstants.java @@ -14,10 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.camel.component.elasticsearch5; - public interface ElasticsearchConstants { String PARAM_OPERATION = "operation"; http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchEndpoint.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchEndpoint.java index 37bafd6..931f9e6 100644 --- a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchEndpoint.java +++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchEndpoint.java @@ -27,12 +27,12 @@ import org.elasticsearch.client.RestClient; /** * The elasticsearch component is used for interfacing with ElasticSearch server using 5.x REST API. */ -@UriEndpoint(firstVersion = "2.21.0", scheme = "elasticsearch5-rest", title = "Elastichsearch Rest or Elasticsearch 5 Rest", +@UriEndpoint(firstVersion = "2.21.0", scheme = "elasticsearch5-rest", title = "Elastichsearch5 Rest", syntax = "elasticsearch5-rest:clusterName", producerOnly = true, label = "monitoring,search") public class ElasticsearchEndpoint extends DefaultEndpoint { @UriParam - protected final ElasticsearchConfiguration configuration; + private final ElasticsearchConfiguration configuration; private RestClient client; http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/components/camel-elasticsearch5/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-elasticsearch5/pom.xml b/components/camel-elasticsearch5/pom.xml index ed81dac..955d827 100644 --- a/components/camel-elasticsearch5/pom.xml +++ b/components/camel-elasticsearch5/pom.xml @@ -29,7 +29,7 @@ <artifactId>camel-elasticsearch5</artifactId> <packaging>jar</packaging> - <name>Camel :: ElasticSearch5</name> + <name>Camel :: ElasticSearch5 (deprecated)</name> <description>Camel ElasticSearch 5.x support</description> <properties> http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/components/camel-elasticsearch5/src/main/docs/elasticsearch5-component.adoc ---------------------------------------------------------------------- diff --git a/components/camel-elasticsearch5/src/main/docs/elasticsearch5-component.adoc b/components/camel-elasticsearch5/src/main/docs/elasticsearch5-component.adoc index 5ad25df..8280c41 100644 --- a/components/camel-elasticsearch5/src/main/docs/elasticsearch5-component.adoc +++ b/components/camel-elasticsearch5/src/main/docs/elasticsearch5-component.adoc @@ -1,4 +1,4 @@ -== Elasticsearch5 Component +== Elasticsearch5 Component (deprecated) *Available as of Camel version 2.19* @@ -173,4 +173,4 @@ https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-api.h * link:configuring-camel.html[Configuring Camel] * link:component.html[Component] * link:endpoint.html[Endpoint] -* link:getting-started.html[Getting Started] +* link:getting-started.html[Getting Started] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/components/readme.adoc ---------------------------------------------------------------------- diff --git a/components/readme.adoc b/components/readme.adoc index 9145772..b5dc9c7 100644 --- a/components/readme.adoc +++ b/components/readme.adoc @@ -2,7 +2,7 @@ Components ^^^^^^^^^^ // components: START -Number of Components: 285 in 196 JAR artifacts (17 deprecated) +Number of Components: 285 in 196 JAR artifacts (19 deprecated) [width="100%",cols="4,1,5",options="header"] |=== @@ -227,14 +227,14 @@ Number of Components: 285 in 196 JAR artifacts (17 deprecated) | link:camel-ejb/src/main/docs/ejb-component.adoc[EJB] (camel-ejb) + `ejb:beanName` | 2.4 | The ejb component is for invoking EJB Java beans from Camel. -| link:camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc[Elastichsearch Rest or Elasticsearch 5 Rest] (camel-elasticsearch5-rest) + +| link:camel-elasticsearch5-rest/src/main/docs/elasticsearch5-rest-component.adoc[Elastichsearch5 Rest] (camel-elasticsearch5-rest) + `elasticsearch5-rest:clusterName` | 2.21 | The elasticsearch component is used for interfacing with ElasticSearch server using 5.x REST API. | link:camel-elasticsearch/src/main/docs/elasticsearch-component.adoc[Elasticsearch] (camel-elasticsearch) + -`elasticsearch:clusterName` | 2.11 | The elasticsearch component is used for interfacing with ElasticSearch server. +`elasticsearch:clusterName` | 2.11 | *deprecated* The elasticsearch component is used for interfacing with ElasticSearch server. | link:camel-elasticsearch5/src/main/docs/elasticsearch5-component.adoc[Elasticsearch5] (camel-elasticsearch5) + -`elasticsearch5:clusterName` | 2.19 | The elasticsearch component is used for interfacing with ElasticSearch server using 5.x API. +`elasticsearch5:clusterName` | 2.19 | *deprecated* The elasticsearch component is used for interfacing with ElasticSearch server using 5.x API. | link:camel-elsql/src/main/docs/elsql-component.adoc[ElSQL] (camel-elsql) + `elsql:elsqlName:resourceUri` | 2.16 | The elsql component is an extension to the existing SQL Component that uses ElSql to define the SQL queries. http://git-wip-us.apache.org/repos/asf/camel/blob/f929b940/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index 60b32b1..7ff258f 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -188,7 +188,7 @@ * [EHCache](cache-component.adoc) * [Ehcache](ehcache-component.adoc) * [EJB](ejb-component.adoc) - * [Elastichsearch Rest or Elasticsearch 5 Rest](elasticsearch5-rest-component.adoc) + * [Elastichsearch5 Rest](elasticsearch5-rest-component.adoc) * [Elasticsearch](elasticsearch-component.adoc) * [Elasticsearch5](elasticsearch5-component.adoc) * [ElSQL](elsql-component.adoc)
