Camel Spring Boot

Elasticsearch

Index, update, get, search and delete documents and indices in Elasticsearch with the Java API Client.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-elasticsearch-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 19 options, which are listed below.

Name Description Default Type

camel.component.elasticsearch.api-key

API key to authenticate with, sent in the Authorization header instead of a user and password. Either the encoded key as Elasticsearch shows it when the key is created, or the id and the key separated by a colon (id:key). The key is only sent to the configured hosts and the nodes found by the sniffer.

String

camel.component.elasticsearch.autowired-enabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

Boolean

camel.component.elasticsearch.certificate-path

The CA certificate, in X.509 format, that the client trusts for HTTPS instead of the default trust store of the JVM. It is loaded from the classpath by default, or with the prefix classpath:, file: or http:. It needs enableSSL, and sslContextParameters takes precedence.

String

camel.component.elasticsearch.client

To use an existing org.elasticsearch.client.RestClient, shared by all the endpoints of the component, instead of a client that each producer creates. The hostAddresses, timeout, authentication, SSL, sniffer and disconnect options are then not used, and the producers do not close the client. The option is a org.elasticsearch.client.RestClient type.

RestClient

camel.component.elasticsearch.connection-timeout

The connect timeout in milliseconds: the longest time that the client waits to establish the connection to a node. Not used when the client option is set.

30000

Integer

camel.component.elasticsearch.enable-document-only-mode

Whether the body of Update is only the partial document to merge into the document. If false, the body is the request body of the Update API, such as \{doc: \{…​}} or a script. Only JSON text, bytes, a stream, a file or a Map is read this way. The CamelElasticsearchEnableDocumentOnlyMode header replaces this option.

false

Boolean

camel.component.elasticsearch.enable-s-s-l

Whether to connect to the nodes of hostAddresses with HTTPS instead of HTTP. The default SSLContext of the JVM is used unless sslContextParameters or certificatePath is set.

false

Boolean

camel.component.elasticsearch.enable-sniffer

Whether to start the Sniffer of the Elasticsearch REST client, which reads the nodes of the cluster from its Nodes Info API at an interval and updates the nodes that the client uses. Not used when the client option is set or autowired, as Spring Boot does.

false

Boolean

camel.component.elasticsearch.enabled

Whether to enable auto configuration of the elasticsearch component. This is enabled by default.

Boolean

camel.component.elasticsearch.host-addresses

The comma-separated list of the nodes to connect to, each as host:port, for example es1:9200,es2:9200. The port is 9200 if not set, and the scheme is https when enableSSL is set. Required unless the client option is set.

String

camel.component.elasticsearch.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.elasticsearch.password

The password for HTTP basic authentication to the nodes, used only together with user. Not used when the client option is set.

String

camel.component.elasticsearch.sniff-after-failure-delay

The delay in milliseconds of the read of the nodes that the Sniffer schedules after a failed request, when enableSniffer is set.

60000

Integer

camel.component.elasticsearch.sniffer-interval

The interval in milliseconds between two reads of the nodes of the cluster, when enableSniffer is set.

300000

Integer

camel.component.elasticsearch.socket-timeout

The socket timeout in milliseconds: the longest time that the client waits for data from a node before the request fails. Not used when the client option is set.

30000

Integer

camel.component.elasticsearch.ssl-context-parameters

To configure security using SSLContextParameters, which sets the protocols, cipher suites, named groups and signature schemes of the HTTPS connection. It takes precedence over certificatePath, and it needs enableSSL. The option is a org.apache.camel.support.jsse.SSLContextParameters type.

SSLContextParameters

camel.component.elasticsearch.use-global-ssl-context-parameters

Whether to use the global SSLContextParameters of the CamelContext for an endpoint that has no sslContextParameters.

false

Boolean

camel.component.elasticsearch.user

The user name for HTTP basic authentication to the nodes, used only together with password. It cannot be combined with apiKey. Not used when the client option is set.

String

camel.component.elasticsearch.max-retry-timeout

Deprecated: this option has no effect. It was used by the old low-level REST client and is ignored by the current client.

30000

Integer