elasticsearch index sink ElasticSearch Index Sink

Provided by: "Apache Software Foundation"

This sink stores documents into ElasticSearch.

Input data must have JSON format according to the index used.

If the indexId parameter is set, that value will be used as the document ID on ElasticSearch.

If the indexId parameter is not set and the source of the kamelet binding is a Kafka broker, it will take the kafka topic, partition and offset of the element to generate an automatic ID that warrantees that this element is processed only once.

Configuration Options

The following table summarizes the configuration options available for the elasticsearch-index-sink Kamelet:

Property Name Description Type Default Example

clusterName *

ElasticSearch Cluster Name

Name of the cluster.

string

"quickstart"

hostAddresses *

Host Addresses

Comma separated list with ip:port formatted remote transport addresses to use.

string

"quickstart-es-http:9200"

indexName *

Index in ElasticSearch

The name of the index to act against.

string

"data"

enableSSL

Enable SSL

Do we want to connect using SSL?

boolean

true

indexId

Index ID

None

string

"NONE"

password

Password

Password to connect to ElasticSearch.

string

user

Username

Username to connect to ElasticSearch.

string

Fields marked with (*) are mandatory.

Usage

This section summarizes how the elasticsearch-index-sink can be used in various contexts.

Knative Sink

The elasticsearch-index-sink Kamelet can be used as Knative sink by binding it to a Knative object.

elasticsearch-index-sink-binding.yaml
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: elasticsearch-index-sink-binding
spec:
  source:
    ref:
      kind: InMemoryChannel
      apiVersion: messaging.knative.dev/v1
      name: mychannel
  sink:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: elasticsearch-index-sink
    properties:
      clusterName: "quickstart"
      hostAddresses: "quickstart-es-http:9200"
      indexName: "data"

Make sure you have Camel K installed into the Kubernetes cluster you’re connected to.

Save the elasticsearch-index-sink-binding.yaml file into your hard drive, then configure it according to your needs.

You can run the sink using the following command:

kubectl apply -f elasticsearch-index-sink-binding.yaml