Chapter 22. ElasticSearch Index Sink
Stores JSON-formatted data into ElasticSearch.
The input data must be formatted in JSON according to the requirements of the index.
If you specify the certificate property, you must base64 encode it before you pass it as a parameter.
In the header, you can set the following properties:
-
indexId/ce-indexid: The index ID for ElasticSearch. -
indexName/ce-indexname: The index name for ElasticSearch.
If you do not set a property in the header, the Kamelet uses the exchange ID for the index setting.
22.1. Configuration Options Copy linkLink copied to clipboard!
The following table summarizes the configuration options available for the elasticsearch-index-sink Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
| clusterName * | ElasticSearch Cluster Name | The name of the ElasticSearch cluster. | string | quickstart | |
| hostAddresses * | Host Addresses |
A comma-separated list of remote transport addresses in | string | quickstart-es-http:9200 | |
| certificate | Certificate | The Certificate for accessing the Elasticsearch cluster. You must encode this value in base64. | string | ||
| enableSSL | Enable SSL | Specifies to connect by using SSL. | boolean | True | |
| indexName | Index in ElasticSearch | The name of the ElasticSearch index. | string | data | |
| password | Password | The password to connect to ElasticSearch. | string | ||
| user | Username | The username to connect to ElasticSearch. | string |
* = Fields marked with an asterisk are mandatory.
22.2. Dependencies Copy linkLink copied to clipboard!
22.2.1. Quarkus dependencies Copy linkLink copied to clipboard!
22.3. Usage Copy linkLink copied to clipboard!
22.3.1. Camel JBang usage Copy linkLink copied to clipboard!
22.3.1.1. Prerequisites for JBang Copy linkLink copied to clipboard!
- Install JBang.
You have executed the following command:
jbang app install camel@apache/camel
jbang app install camel@apache/camelCopy to Clipboard Copied! Toggle word wrap Toggle overflow
22.3.1.2. Running a route with JBang Copy linkLink copied to clipboard!
Suppose you have a file named route.yaml with this content:
You can now run it directly through the following command.
camel run route.yaml
camel run route.yaml
22.3.2. Knative Sink Copy linkLink copied to clipboard!
You can use the elasticsearch-index-sink Kamelet as a Knative sink by binding it to a Knative object.
elasticsearch-index-sink-binding.yaml
22.3.3. Kafka Sink Copy linkLink copied to clipboard!
You can use the elasticsearch-index-sink Kamelet as a Kafka sink by binding it to a Kafka topic.
elasticsearch-index-sink-binding.yaml