--- apiVersion: v1 kind: List items: - apiVersion: v1 kind: ConfigMap metadata: labels: funktion.fabric8.io/kind: Connector provider: fabric8 project: connector-elasticsearch version: 1.1.31 group: io.fabric8.funktion.connector name: elasticsearch data: deployment.yml: | --- apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: funktion.fabric8.io/kind: Subscription connector: elasticsearch spec: replicas: 1 template: metadata: labels: funktion.fabric8.io/kind: Subscription connector: elasticsearch spec: containers: - image: fabric8/connector-elasticsearch:1.1.31 name: connector schema.yml: | --- component: kind: component scheme: elasticsearch syntax: elasticsearch:clusterName title: Elasticsearch description: The elasticsearch component is used for interfacing with ElasticSearch server. label: monitoring,search deprecated: false async: false producerOnly: true javaType: org.apache.camel.component.elasticsearch.ElasticsearchComponent groupId: org.apache.camel artifactId: camel-elasticsearch version: 2.18.1 componentProperties: client: kind: property type: object javaType: org.elasticsearch.client.Client deprecated: false secret: false description: To use an existing configured Elasticsearch client instead of creating a client per endpoint. properties: clusterName: kind: path group: producer required: true type: string javaType: java.lang.String deprecated: false secret: false description: Name of cluster or use local for local mode clientTransportSniff: kind: parameter group: producer type: boolean javaType: java.lang.Boolean deprecated: false secret: false defaultValue: true description: Is the client allowed to sniff the rest of the cluster or not (default true). This setting map to the client.transport.sniff setting. consistencyLevel: kind: parameter group: producer type: string javaType: org.elasticsearch.action.WriteConsistencyLevel enum: - DEFAULT - ONE - QUORUM - ALL deprecated: false secret: false defaultValue: DEFAULT description: The write consistency level to use with INDEX and BULK operations (can be any of ONE QUORUM ALL or DEFAULT) data: kind: parameter group: producer type: boolean javaType: java.lang.Boolean deprecated: false secret: false description: Is the node going to be allowed to allocate data (shards) to it or not. This setting map to the node.data setting. indexName: kind: parameter group: producer type: string javaType: java.lang.String deprecated: false secret: false description: The name of the index to act against indexType: kind: parameter group: producer type: string javaType: java.lang.String deprecated: false secret: false description: The type of the index to act against ip: kind: parameter group: producer type: string javaType: java.lang.String deprecated: false secret: false description: The TransportClient remote host ip to use operation: kind: parameter group: producer type: string javaType: java.lang.String enum: - INDEX - UPDATE - BULK - BULK_INDEX - GET_BY_ID - MULTIGET - DELETE - EXISTS - SEARCH - MULTISEARCH deprecated: false secret: false description: What operation to perform pathHome: kind: parameter group: producer type: string javaType: java.lang.String deprecated: false secret: false defaultValue: /root//.elasticsearch description: The path.home property of ElasticSearch configuration. You need to provide a valid path otherwise the default $user.home/.elasticsearch will be used. port: kind: parameter group: producer type: integer javaType: int deprecated: false secret: false defaultValue: "9300" description: The TransportClient remote port to use (defaults to 9300) transportAddresses: kind: parameter group: producer type: string javaType: java.lang.String deprecated: false secret: false description: Comma separated list with ip:port formatted remote transport addresses to use. The ip and port options must be left blank for transportAddresses to be considered instead. synchronous: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). documentation.adoc: |+ [[ElasticSearch-ElasticSearchComponent]] ElasticSearch Component ~~~~~~~~~~~~~~~~~~~~~~~ *Available as of Camel 2.11* The ElasticSearch component allows you to interface with an http://elasticsearch.org[ElasticSearch] server. Maven users will need to add the following dependency to their `pom.xml` for this component: [source,xml] ------------------------------------------------------------ org.apache.camel camel-elasticsearch x.x.x ------------------------------------------------------------ [[ElasticSearch-URIformat]] URI format ^^^^^^^^^^ [source,java] ------------------------------------- elasticsearch://clusterName[?options] ------------------------------------- [Tip] ==== if you want to run against a local (in JVM/classloader) ElasticSearch server, just set the clusterName value in the URI to "local". See the http://www.elasticsearch.org/guide/reference/java-api/client.html[client guide] for more details. ==== [[ElasticSearch-EndpointOptions]] Endpoint Options ^^^^^^^^^^^^^^^^ // component options: START The Elasticsearch component supports 1 options which are listed below. {% raw %} [width="100%",cols="2,1m,7",options="header"] |======================================================================= | Name | Java Type | Description | client | Client | To use an existing configured Elasticsearch client instead of creating a client per endpoint. |======================================================================= {% endraw %} // component options: END // endpoint options: START The Elasticsearch component supports 12 endpoint options which are listed below: {% raw %} [width="100%",cols="2,1,1m,1m,5",options="header"] |======================================================================= | Name | Group | Default | Java Type | Description | clusterName | producer | | String | *Required* Name of cluster or use local for local mode | clientTransportSniff | producer | true | Boolean | Is the client allowed to sniff the rest of the cluster or not (default true). This setting map to the client.transport.sniff setting. | consistencyLevel | producer | DEFAULT | WriteConsistencyLevel | The write consistency level to use with INDEX and BULK operations (can be any of ONE QUORUM ALL or DEFAULT) | data | producer | | Boolean | Is the node going to be allowed to allocate data (shards) to it or not. This setting map to the node.data setting. | indexName | producer | | String | The name of the index to act against | indexType | producer | | String | The type of the index to act against | ip | producer | | String | The TransportClient remote host ip to use | operation | producer | | String | What operation to perform | pathHome | producer | /root//.elasticsearch | String | The path.home property of ElasticSearch configuration. You need to provide a valid path otherwise the default $user.home/.elasticsearch will be used. | port | producer | 9300 | int | The TransportClient remote port to use (defaults to 9300) | transportAddresses | producer | | String | Comma separated list with ip:port formatted remote transport addresses to use. The ip and port options must be left blank for transportAddresses to be considered instead. | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). |======================================================================= {% endraw %} // endpoint options: END [[ElasticSearch-MessageOperations]] Message Operations ^^^^^^^^^^^^^^^^^^ The following ElasticSearch operations are currently supported. Simply set an endpoint URI option or exchange header with a key of "operation" and a value set to one of the following. Some operations also require other parameters or the message body to be set. [width="100%",cols="10%,10%,80%",options="header",] |======================================================================= |operation |message body |description |INDEX |Map, String, byte[] or XContentBuilder content to index |adds content to an index and returns the content's indexId in the body. *Camel 2.15,* you can set the indexId by setting the message header with the key "indexId". |GET_BY_ID |index id of content to retrieve |retrieves the specified index and returns a GetResult object in the body |DELETE |index id of content to delete |deletes the specified indexId and returns a DeleteResult object in the body |BULK_INDEX | a??*List*??or *Collection* of any type that is already accepted (XContentBuilder, Map, byte[], String) |*Camel 2.14,*adds content to an index and return a??List of the id??of the successfully indexed documents in the body |BULK |a??*List*??or *Collection* of any type that is already accepted (XContentBuilder, Map, byte[], String) |*Camel 2.15:* Adds content to an index and returns the BulkResponse object in the body |SEARCH |Map or SearchRequest Object |*Camel 2.15:*??search the content with the map of query string |MULTIGET |List of MultigetRequest.Item object |*Camel 2.17:*??retrieves the specified indexes, types etc. in MultigetRequest and returns a MultigetResponse object in the body |MULTISEARCH |List of SearchRequest object |*Camel 2.17:* search for parameters specified in MultiSearchRequest and returns a MultiSearchResponse object in the body |EXISTS |Index name as header |*Camel 2.17:* Returns a Boolean object in the body |UPDATE |Map, String, byte[] or XContentBuilder content to update |*Camel 2.17:* Updates content to an index and returns the content's indexId in the body. |======================================================================= [[ElasticSearch-IndexExample]] Index Example ^^^^^^^^^^^^^ Below is a simple INDEX example [source,java] ------------------------------------------------------------------------------- from("direct:index") .to("elasticsearch://local?operation=INDEX&indexName=twitter&indexType=tweet"); ------------------------------------------------------------------------------- [source,xml] --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- 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 map = new HashMap(); map.put("content", "test"); String indexId = template.requestBody("direct:index", map, String.class); ------------------------------------------------------------------------- [[ElasticSearch-Formoreinformation,seetheseresources]] For more information, see these resources ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ http://elasticsearch.org[ElasticSearch Main Site] http://www.elasticsearch.org/guide/reference/java-api/[ElasticSearch Java API] [[ElasticSearch-SeeAlso]] See Also ^^^^^^^^ * link:configuring-camel.html[Configuring Camel] * link:component.html[Component] * link:endpoint.html[Endpoint] * link:getting-started.html[Getting Started]