You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/10/16 18:50:40 UTC

[1/7] camel git commit: CAMEL-11868: New ElasticSearch5 REST component

Repository: camel
Updated Branches:
  refs/heads/master 24ae29463 -> f929b940d


http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java
new file mode 100644
index 0000000..9fdb329
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java
@@ -0,0 +1,288 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.elasticsearch.action.DocWriteResponse;
+import org.elasticsearch.action.delete.DeleteRequest;
+import org.elasticsearch.action.delete.DeleteResponse;
+import org.elasticsearch.action.get.GetRequest;
+import org.elasticsearch.action.get.GetResponse;
+import org.elasticsearch.action.index.IndexRequest;
+import org.elasticsearch.search.SearchHits;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.notNullValue;
+
+public class ElasticsearchGetSearchDeleteExistsUpdateTest extends ElasticsearchBaseTest {
+
+    @Test
+    public void testGet() throws Exception {
+        //first, Index a value
+        Map<String, String> map = createIndexedData();
+        sendBody("direct:index", map);
+        String indexId = template.requestBody("direct:index", map, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        //now, verify GET succeeded
+        GetResponse response = template.requestBody("direct:get", indexId, GetResponse.class);
+        assertNotNull("response should not be null", response);
+        assertNotNull("response source should not be null", response.getSource());
+    }
+
+    @Test
+    public void testDelete() throws Exception {
+        //first, Index a value
+        Map<String, String> map = createIndexedData();
+        sendBody("direct:index", map);
+        String indexId = template.requestBody("direct:index", map, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        //now, verify GET succeeded
+        GetResponse response = template.requestBody("direct:get", indexId, GetResponse.class);
+        assertNotNull("response should not be null", response);
+        assertNotNull("response source should not be null", response.getSource());
+
+        //now, perform Delete
+        DeleteResponse.Result deleteResponse = template.requestBody("direct:delete", indexId, DeleteResponse.Result.class);
+        assertNotNull("response should not be null", deleteResponse);
+
+        //now, verify GET fails to find the indexed value
+        response = template.requestBody("direct:get", indexId, GetResponse.class);
+        assertNotNull("response should not be null", response);
+        assertNull("response source should be null", response.getSource());
+    }
+
+    @Test
+    public void testSearchWithMapQuery() throws Exception {
+        //first, Index a value
+        Map<String, String> map = createIndexedData();
+        String indexId = template.requestBody("direct:index", map, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        //now, verify GET succeeded
+        GetResponse getResponse = template.requestBody("direct:get", indexId, GetResponse.class);
+        assertNotNull("response should not be null", getResponse);
+        assertNotNull("response source should not be null", getResponse.getSource());
+        //now, verify GET succeeded
+        Map<String, Object> actualQuery = new HashMap<>();
+        actualQuery.put("testsearchwithmapquery-key", "testsearchwithmapquery-value");
+        Map<String, Object> match = new HashMap<>();
+        match.put("match", actualQuery);
+        Map<String, Object> query = new HashMap<>();
+        query.put("query", match);
+        SearchHits response = template.requestBody("direct:search", query,SearchHits.class);
+        assertNotNull("response should not be null", response);
+        assertEquals("response hits should be == 1",1, response.totalHits);
+    }
+        
+    @Test
+    public void testSearchWithStringQuery() throws Exception {
+        //first, Index a value
+        Map<String, String> map = createIndexedData();
+        String indexId = template.requestBody("direct:index", map, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        //now, verify GET succeeded
+        GetResponse getResponse = template.requestBody("direct:get", indexId, GetResponse.class);
+        assertNotNull("response should not be null", getResponse);
+        assertNotNull("response source should not be null", getResponse.getSource());
+
+        //now, verify Search succeeded
+        String query = "{\"query\":{\"match\":{\"testsearchwithstringquery-key\":\"testsearchwithstringquery-value\"}}}";
+        SearchHits response = template.requestBody("direct:search", query, SearchHits.class);
+        assertNotNull("response should not be null", response);
+        assertEquals("response hits should be == 1", 1, response.totalHits);
+    }
+    
+    @Test
+    public void testUpdate() throws Exception {
+        Map<String, String> map = createIndexedData();
+        String indexId = template.requestBody("direct:index", map, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        Map<String, String> newMap = new HashMap<>();
+        newMap.put(createPrefix() + "key2", createPrefix() + "value2");
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_INDEX_ID, indexId);
+        indexId = template.requestBodyAndHeaders("direct:update", newMap, headers, String.class);
+        assertNotNull("indexId should be set", indexId);
+    }
+
+    @Test
+    public void testGetWithHeaders() throws Exception {
+        //first, Index a value
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "tweet");
+
+        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);
+
+        //now, verify GET
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.GetById);
+        GetResponse response = template.requestBodyAndHeaders("direct:start", indexId, headers, GetResponse.class);
+        assertNotNull("response should not be null", response);
+        assertNotNull("response source should not be null", response.getSource());
+    }
+    
+    @Test
+    public void testExistsWithHeaders() throws Exception {
+        //first, Index a value
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "tweet");
+
+        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);
+
+        //now, verify GET
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Exists);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        Boolean exists = template.requestBodyAndHeaders("direct:exists", "", headers, Boolean.class);
+        assertNotNull("response should not be null", exists);
+        assertTrue("Index should exists", exists);
+    }
+    
+    @Test
+    public void testNotExistsWithHeaders() throws Exception {
+        //first, Index a value
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "tweet");
+
+        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);
+
+        //now, verify GET
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Exists);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter-tweet");
+        Boolean exists = template.requestBodyAndHeaders("direct:exists", "", headers, Boolean.class);
+        assertNotNull("response should not be null", exists);
+        assertFalse("Index should not exists", exists);
+    }
+    
+
+    @Test
+    public void testDeleteWithHeaders() throws Exception {
+        //first, Index a value
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "tweet");
+
+        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);
+
+        //now, verify GET
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.GetById);
+        GetResponse response = template.requestBodyAndHeaders("direct:start", indexId, headers, GetResponse.class);
+        assertNotNull("response should not be null", response);
+        assertNotNull("response source should not be null", response.getSource());
+
+        //now, perform Delete
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Delete);
+        DocWriteResponse.Result deleteResponse = template.requestBodyAndHeaders("direct:start", indexId, headers,DocWriteResponse.Result.class);
+        assertEquals("response should not be null",DocWriteResponse.Result.DELETED, deleteResponse);
+
+        //now, verify GET fails to find the indexed value
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.GetById);
+        response = template.requestBodyAndHeaders("direct:start", indexId, headers, GetResponse.class);
+        assertNotNull("response should not be null", response);
+        assertNull("response source should be null", response.getSource());
+    }
+
+    @Test
+    public void testUpdateWithIDInHeader() throws Exception {
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "tweet");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_ID, "123");
+
+        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);
+        assertNotNull("indexId should be set", indexId);
+        assertEquals("indexId should be equals to the provided id", "123", indexId);
+
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Update);
+
+        indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);
+        assertNotNull("indexId should be set", indexId);
+        assertEquals("indexId should be equals to the provided id", "123", indexId);
+    }
+
+    @Test
+    public void getRequestBody() throws Exception {
+        String prefix = createPrefix();
+
+        // given
+        GetRequest request = new GetRequest(prefix + "foo").type(prefix + "bar");
+
+        // when
+        String documentId = template.requestBody("direct:index",
+                new IndexRequest(prefix + "foo", prefix + "bar", prefix + "testId")
+                        .source("{\"" + prefix + "content\": \"" + prefix + "hello\"}"), String.class);
+        GetResponse response = template.requestBody("direct:get",
+                request.id(documentId), GetResponse.class);
+
+        // then
+        assertThat(response, notNullValue());
+        assertThat(prefix + "hello", equalTo(response.getSourceAsMap().get(prefix + "content")));
+    }
+
+    @Test
+    public void deleteRequestBody() throws Exception {
+        String prefix = createPrefix();
+
+        // given
+        DeleteRequest request = new DeleteRequest(prefix + "foo").type(prefix + "bar");
+
+        // when
+        String documentId = template.requestBody("direct:index",
+                new IndexRequest("" + prefix + "foo", "" + prefix + "bar", "" + prefix + "testId")
+                        .source("{\"" + prefix + "content\": \"" + prefix + "hello\"}"), String.class);
+        DeleteResponse.Result response = template.requestBody("direct:delete", request.id(documentId), DeleteResponse.Result.class);
+
+        // then
+        assertThat(response, notNullValue());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:start").to("elasticsearch5-rest://elasticsearch?operation=Index&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:index").to("elasticsearch5-rest://elasticsearch?operation=Index&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:get").to("elasticsearch5-rest://elasticsearch?operation=GetById&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:multiget").to("elasticsearch5-rest://elasticsearch?operation=MultiGet&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:delete").to("elasticsearch5-rest://elasticsearch?operation=Delete&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:search").to("elasticsearch5-rest://elasticsearch?operation=Search&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:update").to("elasticsearch5-rest://elasticsearch?operation=Update&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:exists").to("elasticsearch5-rest://elasticsearch?operation=Exists&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java
new file mode 100644
index 0000000..ea17836
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class ElasticsearchIndexTest extends ElasticsearchBaseTest {
+
+    @Test
+    public void testIndex() throws Exception {
+        Map<String, String> map = createIndexedData();
+        String indexId = template.requestBody("direct:index", map, String.class);
+        assertNotNull("indexId should be set", indexId);
+    }
+
+    @Test
+    public void testIndexDelete() throws Exception {
+        Map<String, String> map = createIndexedData();
+        String indexId = template.requestBody("direct:index", map, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        int status = template.requestBody("direct:deleteIndex", "", Integer.class);
+        assertEquals("status should be 200",200, status);
+    }
+
+
+    @Test
+    public void testIndexWithReplication() throws Exception {
+        Map<String, String> map = createIndexedData();
+        String indexId = template.requestBody("direct:indexWithReplication", map, String.class);
+        assertNotNull("indexId should be set", indexId);
+    }
+
+    @Test
+    public void testIndexWithHeaders() throws Exception {
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "tweet");
+
+        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);
+        assertNotNull("indexId should be set", indexId);
+    }
+
+    @Test
+    public void testIndexWithIDInHeader() throws Exception {
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "tweet");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_ID, "123");
+
+        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);
+        assertNotNull("indexId should be set", indexId);
+        assertEquals("indexId should be equals to the provided id", "123", indexId);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:start").to("elasticsearch5-rest://elasticsearch?hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:index").to("elasticsearch5-rest://elasticsearch?operation=Index&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:deleteIndex").to("elasticsearch5-rest://elasticsearch?operation=DeleteIndex&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+                from("direct:indexWithReplication").to("elasticsearch5-rest://elasticsearch?operation=Index&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties b/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..328db35
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties
@@ -0,0 +1,7 @@
+
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.out.ref = out

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index dee3b5f..1be411f 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -118,6 +118,7 @@
     <module>camel-ejb</module>
     <module>camel-elasticsearch</module>
     <module>camel-elasticsearch5</module>
+    <module>camel-elasticsearch5-rest</module>
     <module>camel-elsql</module>
     <module>camel-etcd</module>
     <module>camel-eventadmin</module>

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index e16267b..3609d1c 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -199,8 +199,9 @@
     <elasticsearch-bundle-version>2.4.4_1</elasticsearch-bundle-version>
     <elasticsearch-guava-version>18.0</elasticsearch-guava-version>
     <elasticsearch-version>2.4.4</elasticsearch-version>
-    <elasticsearch5-version>5.5.2</elasticsearch5-version>
+    <elasticsearch5-version>5.6.1</elasticsearch5-version>
     <elasticsearch5-bundle-version>5.5.2_1</elasticsearch5-bundle-version>
+    <elasticsearch-sniffer-version>5.6.2</elasticsearch-sniffer-version>
     <elasticsearch-cluster-runner-version>2.4.0.0</elasticsearch-cluster-runner-version>
     <elasticsearch5-cluster-runner-version>5.5.2.0</elasticsearch5-cluster-runner-version>
     <elsql-version>1.2</elsql-version>

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/platforms/spring-boot/components-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/pom.xml b/platforms/spring-boot/components-starter/pom.xml
index 69b1d01..1bea2af 100644
--- a/platforms/spring-boot/components-starter/pom.xml
+++ b/platforms/spring-boot/components-starter/pom.xml
@@ -129,6 +129,7 @@
     <module>camel-eclipse-starter</module>
     <module>camel-ehcache-starter</module>
     <module>camel-elasticsearch-starter</module>
+    <module>camel-elasticsearch5-rest-starter</module>
     <module>camel-elasticsearch5-starter</module>
     <module>camel-elsql-starter</module>
     <module>camel-etcd-starter</module>


[6/7] camel git commit: Upgrade Kotlin

Posted by da...@apache.org.
Upgrade Kotlin


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e9a34591
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e9a34591
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e9a34591

Branch: refs/heads/master
Commit: e9a34591b70c3bed14578dec67f3eee0c4b0b643
Parents: 9b60081
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Oct 16 20:41:28 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Oct 16 20:41:28 2017 +0200

----------------------------------------------------------------------
 examples/camel-example-kotlin/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e9a34591/examples/camel-example-kotlin/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-kotlin/pom.xml b/examples/camel-example-kotlin/pom.xml
index 212e585..76e5fc1 100644
--- a/examples/camel-example-kotlin/pom.xml
+++ b/examples/camel-example-kotlin/pom.xml
@@ -35,7 +35,7 @@
 
   <properties>
     <category>Other Languages</category>
-    <kotlin.version>1.1.50</kotlin.version>
+    <kotlin.version>1.1.51</kotlin.version>
   </properties>
 
   <dependencies>


[7/7] camel git commit: CAMEL-11868: Added docs and deprecated the two older elasticsearch components.

Posted by da...@apache.org.
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 <da...@apache.org>
Authored: Mon Oct 16 20:50:31 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
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)


[5/7] camel git commit: CAMEL-11868: Fixed CS

Posted by da...@apache.org.
CAMEL-11868: Fixed CS


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9b60081c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9b60081c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9b60081c

Branch: refs/heads/master
Commit: 9b60081c049cbc89413e6497023f514fb6e0303a
Parents: 3f2ef73
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Oct 16 20:41:13 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Oct 16 20:41:13 2017 +0200

----------------------------------------------------------------------
 .../component/elasticsearch5/ElasticsearchBaseTest.java      | 6 +++---
 .../component/elasticsearch5/ElasticsearchBulkTest.java      | 4 ++--
 .../elasticsearch5/ElasticsearchClusterBaseTest.java         | 2 +-
 .../elasticsearch5/ElasticsearchClusterIndexTest.java        | 4 +---
 .../ElasticsearchGetSearchDeleteExistsUpdateTest.java        | 8 ++++----
 .../component/elasticsearch5/ElasticsearchIndexTest.java     | 3 +--
 6 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9b60081c/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java
index f0496e5..a9cf79c 100644
--- a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java
@@ -40,7 +40,7 @@ public class ElasticsearchBaseTest extends CamelTestSupport {
     public static RestClient client;
 
     protected static final int ES_BASE_TRANSPORT_PORT = AvailablePortFinder.getNextAvailable();
-    protected static final int ES_BASE_HTTP_PORT = AvailablePortFinder.getNextAvailable(ES_BASE_TRANSPORT_PORT+1);
+    protected static final int ES_BASE_HTTP_PORT = AvailablePortFinder.getNextAvailable(ES_BASE_TRANSPORT_PORT + 1);
 
     @SuppressWarnings("resource")
     @BeforeClass
@@ -61,7 +61,7 @@ public class ElasticsearchBaseTest extends CamelTestSupport {
 
         // wait for green status
         runner.ensureGreen();
-        client = RestClient.builder(new HttpHost(InetAddress.getByName("localhost"),ES_BASE_HTTP_PORT)).build();
+        client = RestClient.builder(new HttpHost(InetAddress.getByName("localhost"), ES_BASE_HTTP_PORT)).build();
     }
 
     @AfterClass
@@ -84,7 +84,7 @@ public class ElasticsearchBaseTest extends CamelTestSupport {
     protected CamelContext createCamelContext() throws Exception {
         CamelContext context = super.createCamelContext();
         final ElasticsearchComponent elasticsearchComponent = new ElasticsearchComponent();
-        elasticsearchComponent.setHostAddresses("localhost:"+ES_BASE_HTTP_PORT);
+        elasticsearchComponent.setHostAddresses("localhost:" + ES_BASE_HTTP_PORT);
         context.addComponent("elasticsearch5-rest", elasticsearchComponent);
         return context;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/9b60081c/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java
index 979c71c..bfc9cc5 100644
--- a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java
@@ -54,8 +54,8 @@ public class ElasticsearchBulkTest extends ElasticsearchBaseTest {
         // given
         List<Map<String, String>> request = new ArrayList<>();
         final HashMap<String, String> valueMap = new HashMap<>();
-        valueMap.put("id",prefix+"baz");
-        valueMap.put("content",prefix + "hello");
+        valueMap.put("id", prefix + "baz");
+        valueMap.put("content", prefix + "hello");
         request.add(valueMap);
         // when
         @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/camel/blob/9b60081c/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java
index 6ecd3f9..e0225f9 100644
--- a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java
@@ -63,7 +63,7 @@ public class ElasticsearchClusterBaseTest extends CamelTestSupport {
 
         // wait for green status
         runner.ensureGreen();
-        restclient = RestClient.builder(new HttpHost(InetAddress.getByName("localhost"),ES_FIRST_NODE_TRANSPORT_PORT)).build();
+        restclient = RestClient.builder(new HttpHost(InetAddress.getByName("localhost"), ES_FIRST_NODE_TRANSPORT_PORT)).build();
         client = new RestHighLevelClient(restclient);
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/9b60081c/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java
index b0430d0..6c70f46 100644
--- a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java
@@ -70,11 +70,9 @@ public class ElasticsearchClusterIndexTest extends ElasticsearchClusterBaseTest
 
         final BasicResponseHandler responseHandler = new BasicResponseHandler();
         String body = responseHandler.handleEntity(restclient.performRequest("GET", "/_cluster/health?pretty").getEntity());
-        assertStringContains(body,"\"number_of_data_nodes\" : 3");
-
+        assertStringContains(body, "\"number_of_data_nodes\" : 3");
     }
 
-
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {

http://git-wip-us.apache.org/repos/asf/camel/blob/9b60081c/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java
index 9fdb329..61d4d09 100644
--- a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchGetSearchDeleteExistsUpdateTest.java
@@ -89,9 +89,9 @@ public class ElasticsearchGetSearchDeleteExistsUpdateTest extends ElasticsearchB
         match.put("match", actualQuery);
         Map<String, Object> query = new HashMap<>();
         query.put("query", match);
-        SearchHits response = template.requestBody("direct:search", query,SearchHits.class);
+        SearchHits response = template.requestBody("direct:search", query, SearchHits.class);
         assertNotNull("response should not be null", response);
-        assertEquals("response hits should be == 1",1, response.totalHits);
+        assertEquals("response hits should be == 1", 1, response.totalHits);
     }
         
     @Test
@@ -203,8 +203,8 @@ public class ElasticsearchGetSearchDeleteExistsUpdateTest extends ElasticsearchB
 
         //now, perform Delete
         headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Delete);
-        DocWriteResponse.Result deleteResponse = template.requestBodyAndHeaders("direct:start", indexId, headers,DocWriteResponse.Result.class);
-        assertEquals("response should not be null",DocWriteResponse.Result.DELETED, deleteResponse);
+        DocWriteResponse.Result deleteResponse = template.requestBodyAndHeaders("direct:start", indexId, headers, DocWriteResponse.Result.class);
+        assertEquals("response should not be null", DocWriteResponse.Result.DELETED, deleteResponse);
 
         //now, verify GET fails to find the indexed value
         headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.GetById);

http://git-wip-us.apache.org/repos/asf/camel/blob/9b60081c/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java
index ea17836..469f8bf 100644
--- a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchIndexTest.java
@@ -38,10 +38,9 @@ public class ElasticsearchIndexTest extends ElasticsearchBaseTest {
         assertNotNull("indexId should be set", indexId);
 
         int status = template.requestBody("direct:deleteIndex", "", Integer.class);
-        assertEquals("status should be 200",200, status);
+        assertEquals("status should be 200", 200, status);
     }
 
-
     @Test
     public void testIndexWithReplication() throws Exception {
         Map<String, String> map = createIndexedData();


[2/7] camel git commit: CAMEL-11868: New ElasticSearch5 REST component

Posted by da...@apache.org.
CAMEL-11868: New ElasticSearch5 REST component


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/928f185f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/928f185f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/928f185f

Branch: refs/heads/master
Commit: 928f185f9c5fcb1eb48d8f626b7f569210bca5f7
Parents: 24ae294
Author: fharms <fl...@gmail.com>
Authored: Mon Oct 16 19:26:43 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Oct 16 20:00:24 2017 +0200

----------------------------------------------------------------------
 components/camel-elasticsearch5-rest/pom.xml    | 120 ++++++++
 .../elasticsearch5/ElasticsearchComponent.java  | 233 +++++++++++++++
 .../ElasticsearchConfiguration.java             | 245 +++++++++++++++
 .../elasticsearch5/ElasticsearchConstants.java  |  37 +++
 .../elasticsearch5/ElasticsearchEndpoint.java   |  60 ++++
 .../elasticsearch5/ElasticsearchOperation.java  |  55 ++++
 .../elasticsearch5/ElasticsearchProducer.java   | 298 +++++++++++++++++++
 .../BulkRequestAggregationStrategy.java         |  52 ++++
 .../ElasticsearchActionRequestConverter.java    | 206 +++++++++++++
 .../apache/camel/component/elasticsearch5-rest  |  18 ++
 .../elasticsearch5/ElasticsearchBaseTest.java   | 124 ++++++++
 .../elasticsearch5/ElasticsearchBulkTest.java   | 113 +++++++
 .../ElasticsearchClusterBaseTest.java           | 120 ++++++++
 .../ElasticsearchClusterIndexTest.java          |  90 ++++++
 ...icsearchGetSearchDeleteExistsUpdateTest.java | 288 ++++++++++++++++++
 .../elasticsearch5/ElasticsearchIndexTest.java  |  90 ++++++
 .../src/test/resources/log4j2.properties        |   7 +
 components/pom.xml                              |   1 +
 parent/pom.xml                                  |   3 +-
 .../spring-boot/components-starter/pom.xml      |   1 +
 20 files changed, 2160 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/pom.xml b/components/camel-elasticsearch5-rest/pom.xml
new file mode 100644
index 0000000..77c4516
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/pom.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components</artifactId>
+    <version>2.20.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-elasticsearch5-rest</artifactId>
+  <packaging>jar</packaging>
+  <name>Camel :: ElasticSearch5 :: REST</name>
+  <description>Camel ElasticSearch 5.x REST support</description>
+
+  <properties>
+    <elasticsearch.version>${elasticsearch5-version}</elasticsearch.version>
+    <camel.osgi.export.pkg>org.apache.camel.component.elasticsearch5.*;${camel.osgi.version}</camel.osgi.export.pkg>
+    <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=elasticsearch-rest</camel.osgi.export.service>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.elasticsearch.client</groupId>
+      <artifactId>elasticsearch-rest-high-level-client</artifactId>
+      <version>${elasticsearch5-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.elasticsearch.client</groupId>
+      <artifactId>elasticsearch-rest-client-sniffer</artifactId>
+      <version>${elasticsearch-sniffer-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson2-version}</version>
+    </dependency>
+
+    <!-- for testing -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.elasticsearch.client</groupId>
+      <artifactId>transport</artifactId>
+      <version>${elasticsearch5-version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codelibs</groupId>
+      <artifactId>elasticsearch-cluster-runner</artifactId>
+      <version>${elasticsearch5-cluster-runner-version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- logging -->
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-1.2-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemPropertyVariables>
+            <es.path.data>target/data</es.path.data>
+          </systemPropertyVariables>
+          <forkCount>1</forkCount>
+          <reuseForks>false</reuseForks>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchComponent.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchComponent.java
new file mode 100644
index 0000000..79eca0b
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchComponent.java
@@ -0,0 +1,233 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.spi.Metadata;
+import org.apache.http.HttpHost;
+import org.elasticsearch.client.RestClient;
+
+/**
+ * Represents the component that manages {@link ElasticsearchEndpoint}.
+ */
+public class ElasticsearchComponent extends DefaultComponent {
+
+    @Metadata(label = "advanced")
+    private RestClient client;
+    @Metadata(label = "advanced")
+    private String hostAddresses;
+    @Metadata(label = "advanced", defaultValue = "" + ElasticsearchConstants.DEFAULT_SOCKET_TIMEOUT)
+    private int socketTimeout = ElasticsearchConstants.DEFAULT_SOCKET_TIMEOUT;
+    @Metadata(label = "advanced", defaultValue = "" + ElasticsearchConstants.MAX_RETRY_TIMEOUT)
+    private int maxRetryTimeout = ElasticsearchConstants.MAX_RETRY_TIMEOUT;
+    @Metadata(label = "advanced", defaultValue = "" + ElasticsearchConstants.DEFAULT_CONNECTION_TIMEOUT)
+    private int connectionTimeout = ElasticsearchConstants.DEFAULT_CONNECTION_TIMEOUT;
+
+    @Metadata(label = "advance")
+    private String user;
+    @Metadata(secret = true)
+    private String password;
+    @Metadata(label = "advanced", defaultValue = "false")
+    private boolean enableSSL;
+    @Metadata(label = "advanced", defaultValue = "false")
+    private boolean enableSniffer;
+    @Metadata(label = "advanced", defaultValue = "" + ElasticsearchConstants.DEFAULT_SNIFFER_INTERVAL)
+    private int snifferInterval = ElasticsearchConstants.DEFAULT_SNIFFER_INTERVAL;
+    @Metadata(label = "advanced", defaultValue = "" +  ElasticsearchConstants.DEFAULT_AFTER_FAILURE_DELAY)
+    private int sniffAfterFailureDelay = ElasticsearchConstants.DEFAULT_AFTER_FAILURE_DELAY;
+
+    public ElasticsearchComponent() {
+        super();
+    }
+
+    public ElasticsearchComponent(CamelContext context) {
+        super(context);
+    }
+
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        ElasticsearchConfiguration config = new ElasticsearchConfiguration();
+        config.setHostAddresses(this.getHostAddresses());
+        config.setSocketTimeout(this.getSocketTimeout());
+        config.setMaxRetryTimeout(this.getMaxRetryTimeout());
+        config.setConnectionTimeout(this.getConnectionTimeout());
+        config.setUser(this.getUser());
+        config.setEnableSSL(this.getEnableSSL());
+        config.setPassword(this.getPassword());
+        config.setEnableSniffer(this.getEnableSniffer());
+        config.setSnifferInterval(this.getSnifferInterval());
+        config.setSniffAfterFailureDelay(this.getSniffAfterFailureDelay());
+        config.setClusterName(remaining);
+
+        setProperties(config, parameters);
+        config.setHostAddressesList(parseHostAddresses(config.getHostAddresses(), config));
+
+        Endpoint endpoint = new ElasticsearchEndpoint(uri, this, config, client);
+        return endpoint;
+    }
+    
+    private List<HttpHost> parseHostAddresses(String ipsString, ElasticsearchConfiguration config) throws UnknownHostException {
+        if (ipsString == null || ipsString.isEmpty()) {
+            return null;
+        }
+        List<String> addressesStr = Arrays.asList(ipsString.split(","));
+        List<HttpHost> addressesTrAd = new ArrayList<>(addressesStr.size());
+        for (String address : addressesStr) {
+            String[] split = address.split(":");
+            String hostname;
+            if (split.length > 0) {
+                hostname = split[0];
+            } else {
+                throw new IllegalArgumentException();
+            }
+            Integer port = split.length > 1 ? Integer.parseInt(split[1]) : ElasticsearchConstants.DEFAULT_PORT;
+            addressesTrAd.add(new HttpHost(hostname, port, config.getEnableSSL() ? "HTTPS" : "HTTP"));
+        }
+        return addressesTrAd;
+    }
+
+    public RestClient getClient() {
+        return client;
+    }
+
+    /**
+     * To use an existing configured Elasticsearch client, instead of creating a client per endpoint.
+     * This allow to customize the client with specific settings.
+     */
+    public void setClient(RestClient client) {
+        this.client = client;
+    }
+    /**
+     * 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.
+     */
+    public String getHostAddresses() {
+        return hostAddresses;
+    }
+
+    public void setHostAddresses(String hostAddresses) {
+        this.hostAddresses = hostAddresses;
+    }
+
+    /**
+     * The timeout in ms to wait before the socket will timeout.
+     */
+    public int getSocketTimeout() {
+        return socketTimeout;
+    }
+
+    public void setSocketTimeout(int socketTimeout) {
+        this.socketTimeout = socketTimeout;
+    }
+
+    /**
+     *  The time in ms to wait before connection will timeout.
+     */
+    public int getConnectionTimeout() {
+        return connectionTimeout;
+    }
+
+    public void setConnectionTimeout(int connectionTimeout) {
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    /**
+     *  Basic authenticate user
+     */
+    public String getUser() {
+        return user;
+    }
+
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    /**
+     *  Password for authenticate
+     */
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    /**
+     * Enable SSL
+     */
+    public Boolean getEnableSSL() {
+        return enableSSL;
+    }
+
+    public void setEnableSSL(Boolean enableSSL) {
+        this.enableSSL = enableSSL;
+    }
+
+    /**
+     * The time in ms before retry
+     */
+    public int getMaxRetryTimeout() {
+        return maxRetryTimeout;
+    }
+
+    public void setMaxRetryTimeout(int maxRetryTimeout) {
+        this.maxRetryTimeout = maxRetryTimeout;
+    }
+
+    /**
+     * Enable automatically discover nodes from a running Elasticsearch cluster
+     */
+    public Boolean getEnableSniffer() {
+        return enableSniffer;
+    }
+
+    public void setEnableSniffer(Boolean enableSniffer) {
+        this.enableSniffer = enableSniffer;
+    }
+
+    /**
+     * 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
+     */
+    public int getSnifferInterval() {
+        return snifferInterval;
+    }
+
+    public void setSnifferInterval(int snifferInterval) {
+        this.snifferInterval = snifferInterval;
+    }
+
+    /**
+     * The delay of a sniff execution scheduled after a failure (in milliseconds)
+     */
+    public int getSniffAfterFailureDelay() {
+        return sniffAfterFailureDelay;
+    }
+
+    public void setSniffAfterFailureDelay(int sniffAfterFailureDelay) {
+        this.sniffAfterFailureDelay = sniffAfterFailureDelay;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConfiguration.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConfiguration.java
new file mode 100644
index 0000000..e1f109b
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConfiguration.java
@@ -0,0 +1,245 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.util.List;
+
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
+import org.apache.http.HttpHost;
+
+@UriParams
+public class ElasticsearchConfiguration {
+
+    private List<HttpHost> hostAddressesList;
+
+    @UriPath @Metadata(required = "true")
+    private String clusterName;
+    @UriParam
+    private ElasticsearchOperation operation;
+    @UriParam
+    private String indexName;
+    @UriParam
+    private String indexType;
+    @UriParam(defaultValue = "" + ElasticsearchConstants.DEFAULT_FOR_WAIT_ACTIVE_SHARDS)
+    private int waitForActiveShards = ElasticsearchConstants.DEFAULT_FOR_WAIT_ACTIVE_SHARDS;
+    @UriParam @Metadata(required = "true")
+    private String hostAddresses;
+    @UriParam(defaultValue = "" + ElasticsearchConstants.DEFAULT_SOCKET_TIMEOUT)
+    private int socketTimeout = ElasticsearchConstants.DEFAULT_SOCKET_TIMEOUT;
+    @UriParam(defaultValue = "" + ElasticsearchConstants.MAX_RETRY_TIMEOUT)
+    private int maxRetryTimeout = ElasticsearchConstants.MAX_RETRY_TIMEOUT;
+    @UriParam(defaultValue = "" + ElasticsearchConstants.DEFAULT_CONNECTION_TIMEOUT)
+    private int connectionTimeout = ElasticsearchConstants.DEFAULT_CONNECTION_TIMEOUT;
+    @UriParam(defaultValue = "false")
+    private boolean disconnect;
+
+    private String user;
+    private String password;
+    private boolean enableSSL;
+    //Sniffer parameter.
+    private boolean enableSniffer;
+    private int snifferInterval = ElasticsearchConstants.DEFAULT_SNIFFER_INTERVAL;
+    private int sniffAfterFailureDelay = ElasticsearchConstants.DEFAULT_AFTER_FAILURE_DELAY;
+    /**
+     * Name of the cluster
+     */
+    public String getClusterName() {
+        return clusterName;
+    }
+
+    public void setClusterName(String clusterName) {
+        this.clusterName = clusterName;
+    }
+
+    /**
+     * What operation to perform
+     */
+    public ElasticsearchOperation getOperation() {
+        return operation;
+    }
+
+    public void setOperation(ElasticsearchOperation operation) {
+        this.operation = operation;
+    }
+
+    /**
+     * The name of the index to act against
+     */
+    public String getIndexName() {
+        return indexName;
+    }
+
+    public void setIndexName(String indexName) {
+        this.indexName = indexName;
+    }
+
+    /**
+     * The type of the index to act against
+     */
+    public String getIndexType() {
+        return indexType;
+    }
+
+    public void setIndexType(String indexType) {
+        this.indexType = indexType;
+    }
+
+    /**
+     * 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.
+     */
+    public String getHostAddresses() {
+        return hostAddresses;
+    }
+
+    public void setHostAddresses(String hostAddresses) {
+        this.hostAddresses = hostAddresses;
+    }
+
+    /**
+     * Index creation waits for the write consistency number of shards to be available
+     */
+    public int getWaitForActiveShards() {
+        return waitForActiveShards;
+    }
+
+    public void setWaitForActiveShards(int waitForActiveShards) {
+        this.waitForActiveShards = waitForActiveShards;
+    }
+
+    public List<HttpHost> getHostAddressesList() {
+        return hostAddressesList;
+    }
+
+    public void setHostAddressesList(List<HttpHost> hostAddressesList) {
+        this.hostAddressesList = hostAddressesList;
+    }
+
+    /**
+     * The timeout in ms to wait before the socket will timeout.
+     */
+    public int getSocketTimeout() {
+        return socketTimeout;
+    }
+
+    public void setSocketTimeout(int socketTimeout) {
+        this.socketTimeout = socketTimeout;
+    }
+
+    /**
+     *  The time in ms to wait before connection will timeout.
+     */
+    public int getConnectionTimeout() {
+        return connectionTimeout;
+    }
+
+    public void setConnectionTimeout(int connectionTimeout) {
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    /**
+     *  Basic authenticate user
+     */
+    public String getUser() {
+        return user;
+    }
+
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    /**
+     *  Password for authenticate
+     */
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    /**
+     * Enable SSL
+     */
+    public Boolean getEnableSSL() {
+        return enableSSL;
+    }
+
+    public void setEnableSSL(Boolean enableSSL) {
+        this.enableSSL = enableSSL;
+    }
+
+    /**
+     * The time in ms before retry
+     */
+    public int getMaxRetryTimeout() {
+        return maxRetryTimeout;
+    }
+
+    public void setMaxRetryTimeout(int maxRetryTimeout) {
+        this.maxRetryTimeout = maxRetryTimeout;
+    }
+
+    /**
+     * Disconnect after it finish calling the producer
+     */
+    public Boolean getDisconnect() {
+        return disconnect;
+    }
+
+    public void setDisconnect(Boolean disconnect) {
+        this.disconnect = disconnect;
+    }
+
+    /**
+     * Enable automatically discover nodes from a running Elasticsearch cluster
+     */
+    public Boolean getEnableSniffer() {
+        return enableSniffer;
+    }
+
+    public void setEnableSniffer(Boolean enableSniffer) {
+        this.enableSniffer = enableSniffer;
+    }
+
+    /**
+     * 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
+     */
+    public int getSnifferInterval() {
+        return snifferInterval;
+    }
+
+    public void setSnifferInterval(int snifferInterval) {
+        this.snifferInterval = snifferInterval;
+    }
+
+    /**
+     * The delay of a sniff execution scheduled after a failure (in milliseconds)
+     */
+    public int getSniffAfterFailureDelay() {
+        return sniffAfterFailureDelay;
+    }
+
+    public void setSniffAfterFailureDelay(int sniffAfterFailureDelay) {
+        this.sniffAfterFailureDelay = sniffAfterFailureDelay;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/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
new file mode 100644
index 0000000..9f2d493
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchConstants.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * 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";
+    String PARAM_INDEX_ID = "indexId";
+    String PARAM_INDEX_NAME = "indexName";
+    String PARAM_INDEX_TYPE = "indexType";
+    String PARAM_WAIT_FOR_ACTIVE_SHARDS = "waitForActiveShards";
+
+    int    DEFAULT_PORT = 9200;
+    int    DEFAULT_FOR_WAIT_ACTIVE_SHARDS = 1; // Meaning only wait for the primary shard
+    int    DEFAULT_SOCKET_TIMEOUT = 30000; // Meaning how long time to wait before the socket timeout
+    int    MAX_RETRY_TIMEOUT = 30000; // Meaning how long to wait before retry again
+    int    DEFAULT_CONNECTION_TIMEOUT = 30000; // Meaning how many seconds before it timeout when establish connection
+    int    DEFAULT_SNIFFER_INTERVAL = 60000 * 5; // Meaning how often it should search for elasticsearch nodes
+    int    DEFAULT_AFTER_FAILURE_DELAY = 60000; // Meaning when should the sniff execution scheduled after a failure
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/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
new file mode 100644
index 0000000..37bafd6
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchEndpoint.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+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",
+    syntax = "elasticsearch5-rest:clusterName", producerOnly = true, label = "monitoring,search")
+public class ElasticsearchEndpoint extends DefaultEndpoint {
+
+    @UriParam
+    protected final ElasticsearchConfiguration configuration;
+
+    private RestClient client;
+
+    public ElasticsearchEndpoint(String uri, ElasticsearchComponent component, ElasticsearchConfiguration config, RestClient client) throws Exception {
+        super(uri, component);
+        this.configuration = config;
+        this.client = client;
+    }
+
+    public Producer createProducer() throws Exception {
+        return new ElasticsearchProducer(this, configuration);
+    }
+
+    public Consumer createConsumer(Processor processor) throws Exception {
+        throw new UnsupportedOperationException("Cannot consume from an ElasticsearchEndpoint: " + getEndpointUri());
+    }
+    
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public RestClient getClient() {
+        return client;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchOperation.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchOperation.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchOperation.java
new file mode 100644
index 0000000..11b57f8
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchOperation.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+/**
+ * The ElasticSearch server operations list which are implemented
+ * 
+ * Index        - Index a document associated with a given index and type
+ * Update       - Updates a document based on a script
+ * Bulk         - Executes a bulk of index / delete operations
+ * BulkIndex   - Executes a bulk of index / delete operations
+ * GetById    - Gets the document that was indexed from an index with a type and id
+ * MultiGet     - Multiple get documents
+ * Delete       - Deletes a document from the index based on the index, type and id
+ * Search       - Search across one or more indices and one or more types with a query
+ * Exists       - Checks the index exists or not (using search with size=0 and terminate_after=1 parameters)
+ * 
+ */
+public enum ElasticsearchOperation {
+    Index("Index"),
+    Update("Update"),
+    Bulk("Bulk"),
+    BulkIndex("BulkIndex"),
+    GetById("GetById"),
+    MultiGet("MultiGet"),
+    Delete("Delete"),
+    DeleteIndex("DeleteIndex"),
+    Search("Search"),
+    Exists("Exists");
+
+    private final String text;
+
+    ElasticsearchOperation(final String text) {
+        this.text = text;
+    }
+
+    @Override
+    public String toString() {
+        return text;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchProducer.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchProducer.java
new file mode 100644
index 0000000..f87fb54
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/ElasticsearchProducer.java
@@ -0,0 +1,298 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.elasticsearch5.converter.ElasticsearchActionRequestConverter;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.util.IOHelper;
+import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.CredentialsProvider;
+import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.elasticsearch.ElasticsearchStatusException;
+import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
+import org.elasticsearch.action.bulk.BulkItemResponse;
+import org.elasticsearch.action.bulk.BulkRequest;
+import org.elasticsearch.action.delete.DeleteRequest;
+import org.elasticsearch.action.get.GetRequest;
+import org.elasticsearch.action.get.MultiGetRequest;
+import org.elasticsearch.action.index.IndexRequest;
+import org.elasticsearch.action.search.SearchRequest;
+import org.elasticsearch.action.update.UpdateRequest;
+import org.elasticsearch.client.RestClient;
+import org.elasticsearch.client.RestClientBuilder;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.client.sniff.Sniffer;
+import org.elasticsearch.client.sniff.SnifferBuilder;
+import org.elasticsearch.rest.RestStatus;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Represents an Elasticsearch producer.
+ */
+public class ElasticsearchProducer extends DefaultProducer {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ElasticsearchProducer.class);
+
+    protected final ElasticsearchConfiguration configuration;
+    private RestClient client;
+    private Sniffer sniffer;
+
+    public ElasticsearchProducer(ElasticsearchEndpoint endpoint, ElasticsearchConfiguration configuration) {
+        super(endpoint);
+        this.configuration = configuration;
+        this.client = endpoint.getClient();
+    }
+
+    private ElasticsearchOperation resolveOperation(Exchange exchange) {
+        // 1. Operation can be driven by either (in order of preference):
+        // a. If the body is an ActionRequest the operation is set by the type
+        // of request.
+        // b. If the body is not an ActionRequest, the operation is set by the
+        // header if it exists.
+        // c. If neither the operation can not be derived from the body or
+        // header, the configuration is used.
+        // In the event we can't discover the operation from a, b or c we throw
+        // an error.
+        Object request = exchange.getIn().getBody();
+        if (request instanceof IndexRequest) {
+            return ElasticsearchOperation.Index;
+        } else if (request instanceof GetRequest) {
+            return ElasticsearchOperation.GetById;
+        } else if (request instanceof MultiGetRequest) {
+            return ElasticsearchOperation.MultiGet;
+        } else if (request instanceof UpdateRequest) {
+            return ElasticsearchOperation.Update;
+        } else if (request instanceof BulkRequest) {
+            // do we want bulk or bulk_index?
+            if (configuration.getOperation() == ElasticsearchOperation.BulkIndex) {
+                return configuration.getOperation().BulkIndex;
+            } else {
+                return configuration.getOperation().Bulk;
+            }
+        } else if (request instanceof DeleteRequest) {
+            return ElasticsearchOperation.Delete;
+        } else if (request instanceof SearchRequest) {
+            return ElasticsearchOperation.Search;
+        } else if (request instanceof DeleteIndexRequest) {
+            return ElasticsearchOperation.DeleteIndex;
+        }
+
+        ElasticsearchOperation operationConfig = exchange.getIn().getHeader(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.class);
+        if (operationConfig == null) {
+            operationConfig = configuration.getOperation();
+        }
+        if (operationConfig == null) {
+            throw new IllegalArgumentException(ElasticsearchConstants.PARAM_OPERATION + " value '" + operationConfig + "' is not supported");
+        }
+        return operationConfig;
+    }
+
+    public void process(Exchange exchange) throws Exception {
+        if (configuration.getDisconnect() && client == null) {
+            startClient();
+        }
+        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(client);
+        // 2. Index and type will be set by:
+        // a. If the incoming body is already an action request
+        // b. If the body is not an action request we will use headers if they
+        // are set.
+        // c. If the body is not an action request and the headers aren't set we
+        // will use the configuration.
+        // No error is thrown by the component in the event none of the above
+        // conditions are met. The java es client
+        // will throw.
+
+        Message message = exchange.getIn();
+        final ElasticsearchOperation operation = resolveOperation(exchange);
+
+        // Set the index/type headers on the exchange if necessary. This is used
+        // for type conversion.
+        boolean configIndexName = false;
+        String indexName = message.getHeader(ElasticsearchConstants.PARAM_INDEX_NAME, String.class);
+        if (indexName == null) {
+            message.setHeader(ElasticsearchConstants.PARAM_INDEX_NAME, configuration.getIndexName());
+            configIndexName = true;
+        }
+
+        boolean configIndexType = false;
+        String indexType = message.getHeader(ElasticsearchConstants.PARAM_INDEX_TYPE, String.class);
+        if (indexType == null) {
+            message.setHeader(ElasticsearchConstants.PARAM_INDEX_TYPE, configuration.getIndexType());
+            configIndexType = true;
+        }
+
+        boolean configWaitForActiveShards = false;
+        Integer waitForActiveShards = message.getHeader(ElasticsearchConstants.PARAM_WAIT_FOR_ACTIVE_SHARDS, Integer.class);
+        if (waitForActiveShards == null) {
+            message.setHeader(ElasticsearchConstants.PARAM_WAIT_FOR_ACTIVE_SHARDS, configuration.getWaitForActiveShards());
+            configWaitForActiveShards = true;
+        }
+
+        if (operation == ElasticsearchOperation.Index) {
+            IndexRequest indexRequest = ElasticsearchActionRequestConverter.toIndexRequest(message.getBody(), exchange);
+            message.setBody(restHighLevelClient.index(indexRequest).getId());
+        } else if (operation == ElasticsearchOperation.Update) {
+            UpdateRequest updateRequest = ElasticsearchActionRequestConverter.toUpdateRequest(message.getBody(Map.class), exchange);
+            message.setBody(restHighLevelClient.update(updateRequest).getId());
+        } else if (operation == ElasticsearchOperation.GetById) {
+            GetRequest getRequest = ElasticsearchActionRequestConverter.toGetRequest(message.getBody(), exchange);
+            message.setBody(restHighLevelClient.get(getRequest));
+        } else if (operation == ElasticsearchOperation.Bulk) {
+            BulkRequest bulkRequest = message.getBody(BulkRequest.class);
+            message.setBody(restHighLevelClient.bulk(bulkRequest).getItems());
+        } else if (operation == ElasticsearchOperation.BulkIndex) {
+            BulkRequest bulkRequest = ElasticsearchActionRequestConverter.toBulkRequest(message.getBody(), exchange);
+            List<String> indexedIds = Arrays.stream(restHighLevelClient.bulk(bulkRequest).getItems())
+                .map(BulkItemResponse::getId)
+                .collect(Collectors.toList());
+            message.setBody(indexedIds);
+        } else if (operation == ElasticsearchOperation.Delete) {
+            DeleteRequest deleteRequest = ElasticsearchActionRequestConverter.toDeleteRequest(message.getBody(), exchange);
+            message.setBody(restHighLevelClient.delete(deleteRequest).getResult());
+        } else if (operation == ElasticsearchOperation.DeleteIndex) {
+            DeleteRequest deleteRequest = ElasticsearchActionRequestConverter.toDeleteRequest(message.getBody(), exchange);
+            message.setBody(client.performRequest("Delete", deleteRequest.index()).getStatusLine().getStatusCode());
+        } else if (operation == ElasticsearchOperation.Exists) {
+            // ExistsRequest API is deprecated, using SearchRequest instead with size=0 and terminate_after=1
+            SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
+            sourceBuilder.size(0);
+            sourceBuilder.terminateAfter(1);
+            SearchRequest searchRequest = new SearchRequest(exchange.getIn().getHeader(ElasticsearchConstants.PARAM_INDEX_NAME, String.class));
+            searchRequest.source(sourceBuilder);
+            try {
+                restHighLevelClient.search(searchRequest);
+                message.setBody(true);
+            } catch (ElasticsearchStatusException e) {
+                if (e.status().equals(RestStatus.NOT_FOUND)) {
+                    message.setBody(false);
+                } else {
+                    throw new IllegalStateException(e);
+                }
+
+            }
+        } else if (operation == ElasticsearchOperation.Search) {
+            SearchRequest searchRequest = ElasticsearchActionRequestConverter.toSearchRequest(message.getBody(), exchange);
+            message.setBody(restHighLevelClient.search(searchRequest).getHits());
+        } else {
+            throw new IllegalArgumentException(ElasticsearchConstants.PARAM_OPERATION + " value '" + operation + "' is not supported");
+        }
+
+        // If we set params via the configuration on this exchange, remove them
+        // now. This preserves legacy behavior for this component and enables a
+        // use case where one message can be sent to multiple elasticsearch
+        // endpoints where the user is relying on the endpoint configuration
+        // (index/type) rather than header values. If we do not clear this out
+        // sending the same message (index request, for example) to multiple
+        // elasticsearch endpoints would have the effect overriding any
+        // subsequent endpoint index/type with the first endpoint index/type.
+        if (configIndexName) {
+            message.removeHeader(ElasticsearchConstants.PARAM_INDEX_NAME);
+        }
+
+        if (configIndexType) {
+            message.removeHeader(ElasticsearchConstants.PARAM_INDEX_TYPE);
+        }
+
+        if (configWaitForActiveShards) {
+            message.removeHeader(ElasticsearchConstants.PARAM_WAIT_FOR_ACTIVE_SHARDS);
+        }
+        if (configuration.getDisconnect()) {
+            IOHelper.close(client);
+            client = null;
+            if (configuration.getEnableSniffer()) {
+                IOHelper.close(sniffer);
+                sniffer = null;
+            }
+        }
+
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    protected void doStart() throws Exception {
+        super.doStart();
+        if (!configuration.getDisconnect()) {
+            startClient();
+        }
+    }
+
+    private void startClient() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, UnknownHostException {
+        if (client == null) {
+            LOG.info("Connecting to the ElasticSearch cluster: " + configuration.getClusterName());
+            if (configuration.getHostAddressesList() != null
+                && !configuration.getHostAddressesList().isEmpty()) {
+                client = createClient();
+            } else {
+                LOG.warn("Incorrect ip address and port parameters settings for ElasticSearch cluster");
+            }
+        }
+    }
+
+    private RestClient createClient() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
+        final RestClientBuilder builder = RestClient.builder(configuration.getHostAddressesList().toArray(new HttpHost[0]));
+        builder.setMaxRetryTimeoutMillis(configuration.getMaxRetryTimeout());
+        builder.setRequestConfigCallback(requestConfigBuilder ->
+            requestConfigBuilder.setConnectTimeout(configuration.getConnectionTimeout()).setSocketTimeout(configuration.getSocketTimeout()));
+        if (configuration.getUser() != null && configuration.getPassword() != null) {
+            final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
+            credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(configuration.getUser(), configuration.getPassword()));
+            builder.setHttpClientConfigCallback(httpClientBuilder -> {
+                httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
+                return httpClientBuilder;
+            });
+        }
+        final RestClient restClient = builder.build();
+        if (configuration.getEnableSniffer()) {
+            SnifferBuilder snifferBuilder = Sniffer.builder(restClient);
+            snifferBuilder.setSniffIntervalMillis(configuration.getSnifferInterval());
+            snifferBuilder.setSniffAfterFailureDelayMillis(configuration.getSniffAfterFailureDelay());
+            sniffer = snifferBuilder.build();
+        }
+        return restClient;
+    }
+
+
+    @Override
+    protected void doStop() throws Exception {
+        if (client != null) {
+            LOG.info("Disconnecting from ElasticSearch cluster: {}", configuration.getClusterName());
+            client.close();
+            if (sniffer != null) {
+                sniffer.close();
+            }
+        }
+        super.doStop();
+    }
+
+    public RestClient getClient() {
+        return client;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/aggregation/BulkRequestAggregationStrategy.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/aggregation/BulkRequestAggregationStrategy.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/aggregation/BulkRequestAggregationStrategy.java
new file mode 100644
index 0000000..9f60eb4
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/aggregation/BulkRequestAggregationStrategy.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5.aggregation;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.InvalidPayloadRuntimeException;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.elasticsearch.action.ActionRequest;
+import org.elasticsearch.action.DocWriteRequest;
+import org.elasticsearch.action.bulk.BulkRequest;
+
+/**
+ * Aggregates two {@link ActionRequest}s into a single {@link BulkRequest}.
+ */
+public class BulkRequestAggregationStrategy implements AggregationStrategy {
+
+    @Override
+    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+        // Don't use getBody(Class<T>) here as we don't want to coerce the body type using a type converter.
+        Object objBody = newExchange.getIn().getBody();
+        if (!(objBody instanceof DocWriteRequest[])) {
+            throw new InvalidPayloadRuntimeException(newExchange, DocWriteRequest[].class);
+        }
+
+        DocWriteRequest[] newBody = (DocWriteRequest[]) objBody;
+        BulkRequest request;
+        if (oldExchange == null) {
+            request = new BulkRequest();
+            request.add(newBody);
+            newExchange.getIn().setBody(request);
+            return newExchange;
+        } else {
+            request = oldExchange.getIn().getBody(BulkRequest.class);
+            request.add(newBody);
+            return oldExchange;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/converter/ElasticsearchActionRequestConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/converter/ElasticsearchActionRequestConverter.java b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/converter/ElasticsearchActionRequestConverter.java
new file mode 100644
index 0000000..bec9583
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/java/org/apache/camel/component/elasticsearch5/converter/ElasticsearchActionRequestConverter.java
@@ -0,0 +1,206 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5.converter;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.camel.Converter;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.elasticsearch5.ElasticsearchConstants;
+import org.elasticsearch.action.bulk.BulkRequest;
+import org.elasticsearch.action.delete.DeleteRequest;
+import org.elasticsearch.action.get.GetRequest;
+import org.elasticsearch.action.index.IndexRequest;
+import org.elasticsearch.action.search.MultiSearchRequest;
+import org.elasticsearch.action.search.SearchRequest;
+import org.elasticsearch.action.update.UpdateRequest;
+import org.elasticsearch.common.xcontent.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentFactory;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class ElasticsearchActionRequestConverter {
+    private static final Logger LOG = LoggerFactory.getLogger(ElasticsearchActionRequestConverter.class);
+
+    private static final String ES_QUERY_DSL_PREFIX = "query";
+    private static final String PARENT = "parent";
+
+    private ElasticsearchActionRequestConverter() {
+    }
+
+    // Update requests
+    private static UpdateRequest createUpdateRequest(Object document, Exchange exchange) {
+        if (document instanceof UpdateRequest) {
+            return (UpdateRequest) document;
+        }
+        UpdateRequest updateRequest = new UpdateRequest();
+        if (document instanceof byte[]) {
+            updateRequest.doc((byte[]) document);
+        } else if (document instanceof Map) {
+            updateRequest.doc((Map<String, Object>) document);
+        } else if (document instanceof String) {
+            updateRequest.doc((String) document);
+        } else if (document instanceof XContentBuilder) {
+            updateRequest.doc((XContentBuilder) document);
+        } else {
+            return null;
+        }
+
+        return updateRequest
+            .waitForActiveShards(exchange.getIn().getHeader(
+                ElasticsearchConstants.PARAM_WAIT_FOR_ACTIVE_SHARDS, Integer.class))
+            .parent(exchange.getIn().getHeader(
+                PARENT, String.class))
+            .index(exchange.getIn().getHeader(
+                ElasticsearchConstants.PARAM_INDEX_NAME, String.class))
+            .type(exchange.getIn().getHeader(
+                ElasticsearchConstants.PARAM_INDEX_TYPE, String.class))
+            .id(exchange.getIn().getHeader(
+                ElasticsearchConstants.PARAM_INDEX_ID, String.class));
+    }
+
+    // Index requests
+    private static IndexRequest createIndexRequest(Object document, Exchange exchange) {
+        if (document instanceof IndexRequest) {
+            return (IndexRequest) document;
+        }
+        IndexRequest indexRequest = new IndexRequest();
+        if (document instanceof byte[]) {
+            indexRequest.source((byte[]) document, XContentFactory.xContentType((byte[]) document));
+        } else if (document instanceof Map) {
+            indexRequest.source((Map<String, Object>) document);
+        } else if (document instanceof String) {
+            indexRequest.source((String) document, XContentFactory.xContentType((String) document));
+        } else if (document instanceof XContentBuilder) {
+            indexRequest.source((XContentBuilder) document);
+        } else {
+            return null;
+        }
+
+        return indexRequest
+            .waitForActiveShards(exchange.getIn().getHeader(
+                ElasticsearchConstants.PARAM_WAIT_FOR_ACTIVE_SHARDS, Integer.class))
+            .parent(exchange.getIn().getHeader(
+                PARENT, String.class))
+            .index(exchange.getIn().getHeader(
+                ElasticsearchConstants.PARAM_INDEX_NAME, String.class))
+            .type(exchange.getIn().getHeader(
+                ElasticsearchConstants.PARAM_INDEX_TYPE, String.class));
+    }
+
+    public static IndexRequest toIndexRequest(Object document, Exchange exchange) {
+        return createIndexRequest(document, exchange)
+            .id(exchange.getIn().getHeader(ElasticsearchConstants.PARAM_INDEX_ID, String.class));
+    }
+
+    public static UpdateRequest toUpdateRequest(Object document, Exchange exchange) {
+        return createUpdateRequest(document, exchange)
+            .id(exchange.getIn().getHeader(ElasticsearchConstants.PARAM_INDEX_ID, String.class));
+    }
+
+    public static GetRequest toGetRequest(Object document, Exchange exchange) {
+        if (document instanceof GetRequest) {
+            return (GetRequest) document;
+        }
+        return new GetRequest(exchange.getIn().getHeader(
+            ElasticsearchConstants.PARAM_INDEX_NAME, String.class))
+            .type(exchange.getIn().getHeader(
+                ElasticsearchConstants.PARAM_INDEX_TYPE,
+                String.class)).id((String) document);
+    }
+
+    public static DeleteRequest toDeleteRequest(Object document, Exchange exchange) {
+        if (document instanceof DeleteRequest) {
+            return (DeleteRequest) document;
+        }
+        if (document instanceof String) {
+            return new DeleteRequest()
+                .index(exchange.getIn().getHeader(
+                    ElasticsearchConstants.PARAM_INDEX_NAME,
+                    String.class))
+                .type(exchange.getIn().getHeader(
+                    ElasticsearchConstants.PARAM_INDEX_TYPE,
+                    String.class)).id((String) document);
+        } else {
+            throw new IllegalArgumentException("Wrong body type. Only DeleteRequest or String is allowed as a type");
+        }
+    }
+
+    public static SearchRequest toSearchRequest(Object queryObject, Exchange exchange) throws IOException {
+        SearchRequest searchRequest = new SearchRequest(exchange.getIn()
+            .getHeader(ElasticsearchConstants.PARAM_INDEX_NAME, String.class))
+            .types(exchange.getIn().getHeader(ElasticsearchConstants.PARAM_INDEX_TYPE, String.class));
+
+        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
+        String queryText = null;
+
+        if (queryObject instanceof Map<?, ?>) {
+            Map<String, Object> mapQuery = (Map<String, Object>) queryObject;
+            // Remove 'query' prefix from the query object for backward compatibility
+            if (mapQuery.containsKey(ES_QUERY_DSL_PREFIX)) {
+                mapQuery = (Map<String, Object>) mapQuery.get(ES_QUERY_DSL_PREFIX);
+            }
+            try {
+                XContentBuilder contentBuilder = XContentFactory.contentBuilder(XContentType.JSON);
+                queryText = contentBuilder.map(mapQuery).string();
+            } catch (IOException e) {
+                LOG.error(e.getMessage());
+            }
+        } else if (queryObject instanceof String) {
+            queryText = (String) queryObject;
+            ObjectMapper mapper = new ObjectMapper();
+            JsonNode jsonTextObject = mapper.readValue(queryText, JsonNode.class);
+            JsonNode parentJsonNode = jsonTextObject.get(ES_QUERY_DSL_PREFIX);
+            if (parentJsonNode != null) {
+                queryText = parentJsonNode.toString();
+            }
+        } else {
+            // Cannot convert the queryObject into SearchRequest
+            return null;
+        }
+
+        searchSourceBuilder.query(QueryBuilders.wrapperQuery(queryText));
+        searchRequest.source(searchSourceBuilder);
+
+        return searchRequest;
+    }
+
+    public static BulkRequest toBulkRequest(Object documents, Exchange exchange) {
+        if (documents instanceof BulkRequest) {
+            return (BulkRequest) documents;
+        }
+        if (documents instanceof List) {
+            BulkRequest request = new BulkRequest();
+            for (Object document : (List<Object>) documents) {
+                request.add(createIndexRequest(document, exchange));
+            }
+            return request;
+        } else {
+            throw new IllegalArgumentException("Wrong body type. Only BulkRequest or List is allowed as a type");
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/main/resources/META-INF/services/org/apache/camel/component/elasticsearch5-rest
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/main/resources/META-INF/services/org/apache/camel/component/elasticsearch5-rest b/components/camel-elasticsearch5-rest/src/main/resources/META-INF/services/org/apache/camel/component/elasticsearch5-rest
new file mode 100644
index 0000000..13cc909
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/main/resources/META-INF/services/org/apache/camel/component/elasticsearch5-rest
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+class=org.apache.camel.component.elasticsearch5.ElasticsearchComponent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java
new file mode 100644
index 0000000..f0496e5
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBaseTest.java
@@ -0,0 +1,124 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.http.HttpHost;
+import org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner;
+import org.elasticsearch.client.RestClient;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import static org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner.newConfigs;
+
+public class ElasticsearchBaseTest extends CamelTestSupport {
+
+
+    public static ElasticsearchClusterRunner runner;
+    public static String clusterName;
+    public static RestClient client;
+
+    protected static final int ES_BASE_TRANSPORT_PORT = AvailablePortFinder.getNextAvailable();
+    protected static final int ES_BASE_HTTP_PORT = AvailablePortFinder.getNextAvailable(ES_BASE_TRANSPORT_PORT+1);
+
+    @SuppressWarnings("resource")
+    @BeforeClass
+    public static void cleanupOnce() throws Exception {
+        deleteDirectory("target/testcluster/");
+        clusterName = "es-cl-run-" + System.currentTimeMillis();
+
+        runner = new ElasticsearchClusterRunner();
+        // create ES nodes
+        runner.onBuild((number, settingsBuilder) -> {
+            settingsBuilder.put("http.cors.enabled", true);
+            settingsBuilder.put("http.cors.allow-origin", "*");
+        }).build(newConfigs()
+            .clusterName(clusterName)
+            .numOfNode(1)
+            .baseHttpPort(ES_BASE_TRANSPORT_PORT)
+            .basePath("target/testcluster/"));
+
+        // wait for green status
+        runner.ensureGreen();
+        client = RestClient.builder(new HttpHost(InetAddress.getByName("localhost"),ES_BASE_HTTP_PORT)).build();
+    }
+
+    @AfterClass
+    public static void teardownOnce() throws IOException {
+        if (client != null) {
+            client.close();
+        }
+        if (runner != null) {
+            runner.close();
+        }
+    }
+
+    @Override
+    public boolean isCreateCamelContextPerClass() {
+        // let's speed up the tests using the same context
+        return true;
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        final ElasticsearchComponent elasticsearchComponent = new ElasticsearchComponent();
+        elasticsearchComponent.setHostAddresses("localhost:"+ES_BASE_HTTP_PORT);
+        context.addComponent("elasticsearch5-rest", elasticsearchComponent);
+        return context;
+    }
+
+    /**
+     * As we don't delete the {@code target/data} folder for <b>each</b> test
+     * below (otherwise they would run much slower), we need to make sure
+     * there's no side effect of the same used data through creating unique
+     * indexes.
+     */
+    Map<String, String> createIndexedData(String... additionalPrefixes) {
+        String prefix = createPrefix();
+
+        // take over any potential prefixes we may have been asked for
+        if (additionalPrefixes.length > 0) {
+            StringBuilder sb = new StringBuilder(prefix);
+            for (String additionalPrefix : additionalPrefixes) {
+                sb.append(additionalPrefix).append("-");
+            }
+            prefix = sb.toString();
+        }
+
+        String key = prefix + "key";
+        String value = prefix + "value";
+        log.info("Creating indexed data using the key/value pair {} => {}", key, value);
+
+        Map<String, String> map = new HashMap<String, String>();
+        map.put(key, value);
+        return map;
+    }
+
+    String createPrefix() {
+        // make use of the test method name to avoid collision
+        return getTestMethodName().toLowerCase() + "-";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java
new file mode 100644
index 0000000..979c71c
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchBulkTest.java
@@ -0,0 +1,113 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.elasticsearch.action.bulk.BulkItemResponse;
+import org.elasticsearch.action.bulk.BulkRequest;
+import org.elasticsearch.action.index.IndexRequest;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.notNullValue;
+
+public class ElasticsearchBulkTest extends ElasticsearchBaseTest {
+
+    @Test
+    public void testBulkIndex() throws Exception {
+        List<Map<String, String>> documents = new ArrayList<Map<String, String>>();
+        Map<String, String> document1 = createIndexedData("1");
+        Map<String, String> document2 = createIndexedData("2");
+
+        documents.add(document1);
+        documents.add(document2);
+
+        List<?> indexIds = template.requestBody("direct:bulk_index", documents, List.class);
+        assertNotNull("indexIds should be set", indexIds);
+        assertCollectionSize("Indexed documents should match the size of documents", indexIds, documents.size());
+    }
+
+    @Test
+    public void bulkIndexListRequestBody() throws Exception {
+        String prefix = createPrefix();
+
+        // given
+        List<Map<String, String>> request = new ArrayList<>();
+        final HashMap<String, String> valueMap = new HashMap<>();
+        valueMap.put("id",prefix+"baz");
+        valueMap.put("content",prefix + "hello");
+        request.add(valueMap);
+        // when
+        @SuppressWarnings("unchecked")
+        List<String> indexedDocumentIds = template.requestBody("direct:bulk_index", request, List.class);
+
+        // then
+        assertThat(indexedDocumentIds, notNullValue());
+        assertThat(indexedDocumentIds.size(), equalTo(1));
+    }
+
+    @Test
+    public void bulkIndexRequestBody() throws Exception {
+        String prefix = createPrefix();
+
+        // given
+        BulkRequest request = new BulkRequest();
+        request.add(new IndexRequest(prefix + "foo", prefix + "bar", prefix + "baz").source("{\"" + prefix + "content\": \"" + prefix + "hello\"}"));
+
+        // when
+        @SuppressWarnings("unchecked")
+        List<String> indexedDocumentIds = template.requestBody("direct:bulk_index", request, List.class);
+
+        // then
+        assertThat(indexedDocumentIds, notNullValue());
+        assertThat(indexedDocumentIds.size(), equalTo(1));
+        assertThat(indexedDocumentIds, hasItem(prefix + "baz"));
+    }
+
+    @Test
+    public void bulkRequestBody() throws Exception {
+        String prefix = createPrefix();
+
+        // given
+        BulkRequest request = new BulkRequest();
+        request.add(new IndexRequest(prefix + "foo", prefix + "bar", prefix + "baz").source("{\"" + prefix + "content\": \"" + prefix + "hello\"}"));
+
+        // when
+        BulkItemResponse[] response = (BulkItemResponse[]) template.requestBody("direct:bulk", request);
+
+        // then
+        assertThat(response, notNullValue());
+        assertEquals(prefix + "baz", response[0].getResponse().getId());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:bulk_index").to("elasticsearch5-rest://elasticsearch?operation=BulkIndex&indexName=twitter&indexType=tweet");
+                from("direct:bulk").to("elasticsearch5-rest://elasticsearch?operation=Bulk&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_BASE_HTTP_PORT);
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java
new file mode 100644
index 0000000..6ecd3f9
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterBaseTest.java
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.net.InetAddress;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.http.HttpHost;
+import org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner;
+import org.elasticsearch.client.RestClient;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import static org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner.newConfigs;
+
+public class ElasticsearchClusterBaseTest extends CamelTestSupport {
+
+    public static ElasticsearchClusterRunner runner;
+    public static String clusterName;
+    public static RestClient restclient;
+    public static RestHighLevelClient client;
+
+    protected static final int ES_BASE_HTTP_PORT = AvailablePortFinder.getNextAvailable();
+    protected static final int ES_FIRST_NODE_TRANSPORT_PORT = AvailablePortFinder.getNextAvailable(ES_BASE_HTTP_PORT + 1);
+
+    @SuppressWarnings("resource")
+    @BeforeClass
+    public static void cleanUpOnce() throws Exception {
+        deleteDirectory("target/testcluster/");
+        clusterName = "es-cl-run-" + System.currentTimeMillis();
+        // create runner instance
+
+        runner = new ElasticsearchClusterRunner();
+        // create ES nodes
+        runner.onBuild((number, settingsBuilder) -> {
+            settingsBuilder.put("http.cors.enabled", true);
+            settingsBuilder.put("http.cors.allow-origin", "*");
+            settingsBuilder.put("discovery.zen.ping.unicast.hosts", "127.0.0.1:9301,127.0.0.1:9302,127.0.0.1:9303");
+        }).build(newConfigs()
+                 .clusterName(clusterName)
+                 .numOfNode(3)
+                 .baseHttpPort(ES_BASE_HTTP_PORT)
+                 .basePath("target/testcluster/")
+                 .disableESLogger());
+
+        // wait for green status
+        runner.ensureGreen();
+        restclient = RestClient.builder(new HttpHost(InetAddress.getByName("localhost"),ES_FIRST_NODE_TRANSPORT_PORT)).build();
+        client = new RestHighLevelClient(restclient);
+    }
+
+    @AfterClass
+    public static void teardownOnce() throws Exception {
+        if (restclient != null) {
+            restclient.close();
+        }
+        if (runner != null) {
+            // close runner
+            runner.close();
+            // delete all files
+            runner.clean();
+        }
+    }
+
+    @Override
+    public boolean isCreateCamelContextPerClass() {
+        // let's speed up the tests using the same context
+        return true;
+    }
+
+    /**
+     * As we don't delete the {@code target/data} folder for <b>each</b> test
+     * below (otherwise they would run much slower), we need to make sure
+     * there's no side effect of the same used data through creating unique
+     * indexes.
+     */
+    Map<String, String> createIndexedData(String... additionalPrefixes) {
+        String prefix = createPrefix();
+
+        // take over any potential prefixes we may have been asked for
+        if (additionalPrefixes.length > 0) {
+            StringBuilder sb = new StringBuilder(prefix);
+            for (String additionalPrefix : additionalPrefixes) {
+                sb.append(additionalPrefix).append("-");
+            }
+            prefix = sb.toString();
+        }
+
+        String key = prefix + "key";
+        String value = prefix + "value";
+        log.info("Creating indexed data using the key/value pair {} => {}", key, value);
+
+        Map<String, String> map = new HashMap<>();
+        map.put(key, value);
+        return map;
+    }
+
+    String createPrefix() {
+        // make use of the test method name to avoid collision
+        return getTestMethodName().toLowerCase() + "-";
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/928f185f/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java
new file mode 100644
index 0000000..b0430d0
--- /dev/null
+++ b/components/camel-elasticsearch5-rest/src/test/java/org/apache/camel/component/elasticsearch5/ElasticsearchClusterIndexTest.java
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.http.impl.client.BasicResponseHandler;
+import org.elasticsearch.action.get.GetRequest;
+import org.junit.Test;
+
+public class ElasticsearchClusterIndexTest extends ElasticsearchClusterBaseTest {
+
+    @Test
+    public void indexWithIpAndPort() throws Exception {
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "tweet");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_ID, "1");
+
+        String indexId = template.requestBodyAndHeaders("direct:indexWithIpAndPort", map, headers, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        headers.clear();
+
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "twitter");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "status");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_ID, "2");
+
+        indexId = template.requestBodyAndHeaders("direct:indexWithIpAndPort", map, headers, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        assertEquals("Cluster must be of three nodes", runner.getNodeSize(), 3);
+        assertEquals("Index id 1 must exists", true, client.get(new GetRequest("twitter", "tweet", "1")).isExists());
+        assertEquals("Index id 2 must exists", true, client.get(new GetRequest("twitter", "status", "2")).isExists());
+    }
+
+    @Test
+    public void indexWithSnifferEnable() throws Exception {
+        Map<String, String> map = createIndexedData();
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(ElasticsearchConstants.PARAM_OPERATION, ElasticsearchOperation.Index);
+        headers.put(ElasticsearchConstants.PARAM_INDEX_NAME, "facebook");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_TYPE, "post");
+        headers.put(ElasticsearchConstants.PARAM_INDEX_ID, "4");
+
+        String indexId = template.requestBodyAndHeaders("direct:indexWithSniffer", map, headers, String.class);
+        assertNotNull("indexId should be set", indexId);
+
+        assertEquals("Cluster must be of three nodes", runner.getNodeSize(), 3);
+        assertEquals("Index id 4 must exists", true, client.get(new GetRequest("facebook", "post", "4")).isExists());
+
+        final BasicResponseHandler responseHandler = new BasicResponseHandler();
+        String body = responseHandler.handleEntity(restclient.performRequest("GET", "/_cluster/health?pretty").getEntity());
+        assertStringContains(body,"\"number_of_data_nodes\" : 3");
+
+    }
+
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:indexWithIpAndPort")
+                    .to("elasticsearch5-rest://" + clusterName + "?operation=Index&indexName=twitter&indexType=tweet&hostAddresses=localhost:" + ES_FIRST_NODE_TRANSPORT_PORT);
+                from("direct:indexWithSniffer")
+                    .to("elasticsearch5-rest://" + clusterName + "?operation=Index&indexName=twitter&indexType=tweet&enableSniffer=true&hostAddresses=localhost:" + ES_FIRST_NODE_TRANSPORT_PORT);
+            }
+        };
+    }
+}


[3/7] camel git commit: CAMEL-11868: Regen. This closes #2013

Posted by da...@apache.org.
CAMEL-11868: Regen. This closes #2013


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/037aee4d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/037aee4d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/037aee4d

Branch: refs/heads/master
Commit: 037aee4da369950c6ce206926203a3c8ba0aaa4d
Parents: 928f185
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Oct 16 20:32:23 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Oct 16 20:32:23 2017 +0200

----------------------------------------------------------------------
 components/camel-elasticsearch5-rest/pom.xml    |   2 +-
 components/readme.adoc                          |   5 +-
 docs/user-manual/en/SUMMARY.md                  |   1 +
 .../camel-elasticsearch5-rest-starter/pom.xml   |  61 ++++++
 ...ElasticsearchComponentAutoConfiguration.java | 130 ++++++++++++
 .../ElasticsearchComponentConfiguration.java    | 192 ++++++++++++++++++
 .../src/main/resources/META-INF/LICENSE.txt     | 203 +++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE.txt      |  11 +
 .../main/resources/META-INF/spring.factories    |  19 ++
 .../src/main/resources/META-INF/spring.provides |  17 ++
 10 files changed, 639 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/components/camel-elasticsearch5-rest/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/pom.xml b/components/camel-elasticsearch5-rest/pom.xml
index 77c4516..ed28b69 100644
--- a/components/camel-elasticsearch5-rest/pom.xml
+++ b/components/camel-elasticsearch5-rest/pom.xml
@@ -24,7 +24,7 @@
   <parent>
     <groupId>org.apache.camel</groupId>
     <artifactId>components</artifactId>
-    <version>2.20.0-SNAPSHOT</version>
+    <version>2.21.0-SNAPSHOT</version>
   </parent>
 
   <groupId>org.apache.camel</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/components/readme.adoc
----------------------------------------------------------------------
diff --git a/components/readme.adoc b/components/readme.adoc
index 0cf3301..9145772 100644
--- a/components/readme.adoc
+++ b/components/readme.adoc
@@ -2,7 +2,7 @@ Components
 ^^^^^^^^^^
 
 // components: START
-Number of Components: 284 in 195 JAR artifacts (17 deprecated)
+Number of Components: 285 in 196 JAR artifacts (17 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -227,6 +227,9 @@ Number of Components: 284 in 195 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) +
+`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.
 

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 332940e..60b32b1 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -188,6 +188,7 @@
 	* [EHCache](cache-component.adoc)
 	* [Ehcache](ehcache-component.adoc)
 	* [EJB](ejb-component.adoc)
+	* [Elastichsearch Rest or Elasticsearch 5 Rest](elasticsearch5-rest-component.adoc)
 	* [Elasticsearch](elasticsearch-component.adoc)
 	* [Elasticsearch5](elasticsearch5-component.adoc)
 	* [ElSQL](elsql-component.adoc)

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/pom.xml b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/pom.xml
new file mode 100644
index 0000000..8eb5796
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components-starter</artifactId>
+    <version>2.21.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>camel-elasticsearch5-rest-starter</artifactId>
+  <packaging>jar</packaging>
+  <name>Spring-Boot Starter :: Camel :: ElasticSearch5 :: REST</name>
+  <description>Spring-Boot Starter for Camel ElasticSearch 5.x REST support</description>
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-elasticsearch5-rest</artifactId>
+      <version>${project.version}</version>
+      <!--START OF GENERATED CODE-->
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+      <!--END OF GENERATED CODE-->
+    </dependency>
+    <!--START OF GENERATED CODE-->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <!--END OF GENERATED CODE-->
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java
new file mode 100644
index 0000000..eb8cbff
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java
@@ -0,0 +1,130 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5.springboot;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.elasticsearch5.ElasticsearchComponent;
+import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import org.apache.camel.spring.boot.ComponentConfigurationProperties;
+import org.apache.camel.spring.boot.util.CamelPropertiesHelper;
+import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
+import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
+import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.AutoConfigureAfter;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@Configuration
+@Conditional({ConditionalOnCamelContextAndAutoConfigurationBeans.class,
+        ElasticsearchComponentAutoConfiguration.GroupConditions.class})
+@AutoConfigureAfter(CamelAutoConfiguration.class)
+@EnableConfigurationProperties({ComponentConfigurationProperties.class,
+        ElasticsearchComponentConfiguration.class})
+public class ElasticsearchComponentAutoConfiguration {
+
+    private static final Logger LOGGER = LoggerFactory
+            .getLogger(ElasticsearchComponentAutoConfiguration.class);
+    @Autowired
+    private ApplicationContext applicationContext;
+    @Autowired
+    private CamelContext camelContext;
+    @Autowired
+    private ElasticsearchComponentConfiguration configuration;
+    @Autowired(required = false)
+    private List<ComponentCustomizer<ElasticsearchComponent>> customizers;
+
+    static class GroupConditions extends GroupCondition {
+        public GroupConditions() {
+            super("camel.component", "camel.component.elasticsearch5-rest");
+        }
+    }
+
+    @Lazy
+    @Bean(name = "elasticsearch5-rest-component")
+    @ConditionalOnMissingBean(ElasticsearchComponent.class)
+    public ElasticsearchComponent configureElasticsearchComponent()
+            throws Exception {
+        ElasticsearchComponent component = new ElasticsearchComponent();
+        component.setCamelContext(camelContext);
+        Map<String, Object> parameters = new HashMap<>();
+        IntrospectionSupport.getProperties(configuration, parameters, null,
+                false);
+        for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+            Object value = entry.getValue();
+            Class<?> paramClass = value.getClass();
+            if (paramClass.getName().endsWith("NestedConfiguration")) {
+                Class nestedClass = null;
+                try {
+                    nestedClass = (Class) paramClass.getDeclaredField(
+                            "CAMEL_NESTED_CLASS").get(null);
+                    HashMap<String, Object> nestedParameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(value, nestedParameters,
+                            null, false);
+                    Object nestedProperty = nestedClass.newInstance();
+                    CamelPropertiesHelper.setCamelProperties(camelContext,
+                            nestedProperty, nestedParameters, false);
+                    entry.setValue(nestedProperty);
+                } catch (NoSuchFieldException e) {
+                }
+            }
+        }
+        CamelPropertiesHelper.setCamelProperties(camelContext, component,
+                parameters, false);
+        if (ObjectHelper.isNotEmpty(customizers)) {
+            for (ComponentCustomizer<ElasticsearchComponent> customizer : customizers) {
+                boolean useCustomizer = (customizer instanceof HasId)
+                        ? HierarchicalPropertiesEvaluator
+                                .evaluate(
+                                        applicationContext.getEnvironment(),
+                                        "camel.component.customizer",
+                                        "camel.component.elasticsearch5-rest.customizer",
+                                        ((HasId) customizer).getId())
+                        : HierarchicalPropertiesEvaluator
+                                .evaluate(applicationContext.getEnvironment(),
+                                        "camel.component.customizer",
+                                        "camel.component.elasticsearch5-rest.customizer");
+                if (useCustomizer) {
+                    LOGGER.debug("Configure component {}, with customizer {}",
+                            component, customizer);
+                    customizer.customize(component);
+                }
+            }
+        }
+        return component;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentConfiguration.java
new file mode 100644
index 0000000..ed02138
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentConfiguration.java
@@ -0,0 +1,192 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elasticsearch5.springboot;
+
+import javax.annotation.Generated;
+import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
+import org.elasticsearch.client.RestClient;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.NestedConfigurationProperty;
+
+/**
+ * The elasticsearch component is used for interfacing with ElasticSearch server
+ * using 5.x REST API.
+ * 
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Generated("org.apache.camel.maven.packaging.SpringBootAutoConfigurationMojo")
+@ConfigurationProperties(prefix = "camel.component.elasticsearch5-rest")
+public class ElasticsearchComponentConfiguration
+        extends
+            ComponentConfigurationPropertiesCommon {
+
+    /**
+     * To use an existing configured Elasticsearch client instead of creating a
+     * client per endpoint. This allow to customize the client with specific
+     * settings.
+     */
+    @NestedConfigurationProperty
+    private RestClient client;
+    /**
+     * 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.
+     */
+    private String hostAddresses;
+    /**
+     * The timeout in ms to wait before the socket will timeout.
+     */
+    private Integer socketTimeout = 30000;
+    /**
+     * The time in ms to wait before connection will timeout.
+     */
+    private Integer connectionTimeout = 30000;
+    /**
+     * Basic authenticate user
+     */
+    private String user;
+    /**
+     * Password for authenticate
+     */
+    private String password;
+    /**
+     * Enable SSL
+     */
+    private Boolean enableSSL = false;
+    /**
+     * The time in ms before retry
+     */
+    private Integer maxRetryTimeout = 30000;
+    /**
+     * Enable automatically discover nodes from a running Elasticsearch cluster
+     */
+    private Boolean enableSniffer = false;
+    /**
+     * 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
+     */
+    private Integer snifferInterval = 300000;
+    /**
+     * The delay of a sniff execution scheduled after a failure (in
+     * milliseconds)
+     */
+    private Integer sniffAfterFailureDelay = 60000;
+    /**
+     * Whether the component should resolve property placeholders on itself when
+     * starting. Only properties which are of String type can use property
+     * placeholders.
+     */
+    private Boolean resolvePropertyPlaceholders = true;
+
+    public RestClient getClient() {
+        return client;
+    }
+
+    public void setClient(RestClient client) {
+        this.client = client;
+    }
+
+    public String getHostAddresses() {
+        return hostAddresses;
+    }
+
+    public void setHostAddresses(String hostAddresses) {
+        this.hostAddresses = hostAddresses;
+    }
+
+    public Integer getSocketTimeout() {
+        return socketTimeout;
+    }
+
+    public void setSocketTimeout(Integer socketTimeout) {
+        this.socketTimeout = socketTimeout;
+    }
+
+    public Integer getConnectionTimeout() {
+        return connectionTimeout;
+    }
+
+    public void setConnectionTimeout(Integer connectionTimeout) {
+        this.connectionTimeout = connectionTimeout;
+    }
+
+    public String getUser() {
+        return user;
+    }
+
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public Boolean getEnableSSL() {
+        return enableSSL;
+    }
+
+    public void setEnableSSL(Boolean enableSSL) {
+        this.enableSSL = enableSSL;
+    }
+
+    public Integer getMaxRetryTimeout() {
+        return maxRetryTimeout;
+    }
+
+    public void setMaxRetryTimeout(Integer maxRetryTimeout) {
+        this.maxRetryTimeout = maxRetryTimeout;
+    }
+
+    public Boolean getEnableSniffer() {
+        return enableSniffer;
+    }
+
+    public void setEnableSniffer(Boolean enableSniffer) {
+        this.enableSniffer = enableSniffer;
+    }
+
+    public Integer getSnifferInterval() {
+        return snifferInterval;
+    }
+
+    public void setSnifferInterval(Integer snifferInterval) {
+        this.snifferInterval = snifferInterval;
+    }
+
+    public Integer getSniffAfterFailureDelay() {
+        return sniffAfterFailureDelay;
+    }
+
+    public void setSniffAfterFailureDelay(Integer sniffAfterFailureDelay) {
+        this.sniffAfterFailureDelay = sniffAfterFailureDelay;
+    }
+
+    public Boolean getResolvePropertyPlaceholders() {
+        return resolvePropertyPlaceholders;
+    }
+
+    public void setResolvePropertyPlaceholders(
+            Boolean resolvePropertyPlaceholders) {
+        this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/LICENSE.txt b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/NOTICE.txt b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/spring.factories
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..851c0fe
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+org.apache.camel.component.elasticsearch5.springboot.ElasticsearchComponentAutoConfiguration

http://git-wip-us.apache.org/repos/asf/camel/blob/037aee4d/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/spring.provides
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/spring.provides b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/spring.provides
new file mode 100644
index 0000000..b5c71aa
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch5-rest-starter/src/main/resources/META-INF/spring.provides
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+provides: camel-elasticsearch5-rest


[4/7] camel git commit: CAMEL-11868: Polished

Posted by da...@apache.org.
CAMEL-11868: Polished


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3f2ef737
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3f2ef737
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3f2ef737

Branch: refs/heads/master
Commit: 3f2ef7371189c03e9ffdb2b79e919ca782cf831c
Parents: 037aee4
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Oct 16 20:37:45 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Oct 16 20:37:45 2017 +0200

----------------------------------------------------------------------
 components/camel-elasticsearch5-rest/pom.xml    |  8 +----
 .../src/test/resources/log4j2.properties        | 31 ++++++++++++++++----
 2 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3f2ef737/components/camel-elasticsearch5-rest/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/pom.xml b/components/camel-elasticsearch5-rest/pom.xml
index ed28b69..2f5ae47 100644
--- a/components/camel-elasticsearch5-rest/pom.xml
+++ b/components/camel-elasticsearch5-rest/pom.xml
@@ -27,14 +27,12 @@
     <version>2.21.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.camel</groupId>
   <artifactId>camel-elasticsearch5-rest</artifactId>
   <packaging>jar</packaging>
   <name>Camel :: ElasticSearch5 :: REST</name>
   <description>Camel ElasticSearch 5.x REST support</description>
 
   <properties>
-    <elasticsearch.version>${elasticsearch5-version}</elasticsearch.version>
     <camel.osgi.export.pkg>org.apache.camel.component.elasticsearch5.*;${camel.osgi.version}</camel.osgi.export.pkg>
     <camel.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=elasticsearch-rest</camel.osgi.export.service>
   </properties>
@@ -44,6 +42,7 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.elasticsearch.client</groupId>
       <artifactId>elasticsearch-rest-high-level-client</artifactId>
@@ -95,11 +94,6 @@
       <artifactId>log4j-slf4j-impl</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-1.2-api</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/camel/blob/3f2ef737/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties
----------------------------------------------------------------------
diff --git a/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties b/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties
index 328db35..8f3f866 100644
--- a/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties
+++ b/components/camel-elasticsearch5-rest/src/test/resources/log4j2.properties
@@ -1,7 +1,28 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
 
-appender.out.type = Console
-appender.out.name = out
-appender.out.layout.type = PatternLayout
-appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-elasticsearch5-rest-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.stdout.type = Console
+appender.stdout.name = stdout
+appender.stdout.layout.type = PatternLayout
+appender.stdout.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
 rootLogger.level = INFO
-rootLogger.appenderRef.out.ref = out
+rootLogger.appenderRef.file.ref = file