Skip to content

API Docs - v1.1.2


elasticsearch (Store)

Elasticsearch store implementation uses Elasticsearch indexing document for underlying data storage. The events are converted to Elasticsearch index documents when the events are inserted into the elasticsearch store. Elasticsearch indexing documents are converted to events when the documents are read from Elasticsearch indexes. The internal store is connected to the Elastisearch server via the Elasticsearch Java High Level REST Client library.


@Store(type="elasticsearch", hostname="<STRING>", port="<INT>", scheme="<STRING>", username="<STRING>", password="<STRING>","<STRING>", index.alias="<STRING>", index.number.of.shards="<INT>", index.number.of.replicas="<INT>", bulk.actions="<INT>", bulk.size="<LONG>", concurrent.requests="<INT>", flush.interval="<LONG>","<INT>", backoff.policy.wait.time="<LONG>")


Name Description Default Value Possible Data Types Optional Dynamic
hostname The hostname of the Elasticsearch server. localhost STRING Yes No
port The port of the Elasticsearch server. 9200 INT Yes No
scheme The scheme type of the Elasticsearch server connection. http STRING Yes No
username The username for the Elasticsearch server connection. elastic STRING Yes No
password The password for the Elasticsearch server connection. changeme STRING Yes No The name of the Elasticsearch index. The table name defined in the Siddhi App query. STRING Yes No
index.alias The alias of the Elasticsearch index. null STRING Yes No
index.number.of.shards The number of shards allocated for the index in the Elasticsearch server. 3 INT Yes No
index.number.of.replicas The number of replicas for the index in the Elasticsearch server. 2 INT Yes No
bulk.actions The number of actions to be added to flush a new bulk request. Use -1 to disable it 1 INT Yes No
bulk.size The size of size of actions currently added to the bulk request to flush a new bulk request in MB. Use -1 to disable it 1 LONG Yes No
concurrent.requests The number of concurrent requests allowed to be executed. Use 0 to only allow the execution of a single request 0 INT Yes No
flush.interval The flush interval flushing any BulkRequest pending if the interval passes. 10 LONG Yes No The number of retries until backoff (The backoff policy defines how the bulk processor should handle retries of bulk requests internally in case they have failed due to resource constraints (i.e. a thread pool was full)). 3 INT Yes No
backoff.policy.wait.time The constant back off policy that initially waits until the next retry in seconds. 1 LONG Yes No

Examples EXAMPLE 1

@Store(type="elasticsearch", host="localhost", username="elastic", password="changeme","MyStockTable", field.length="symbol:100", bulk.actions="5000", bulk.size="1", concurrent.requests="2", flush.interval="1","3", backoff.policy.wait.time="1")
@PrimaryKey("symbol")define table StockTable (symbol string, price float, volume long);

This example creates an index named 'MyStockTable' in the Elasticsearch server if it does not already exist (with three attributes named 'symbol', 'price', and 'volume' of the types 'string', 'float' and 'long' respectively). The connection is made as specified by the parameters configured for the '@Store' annotation. The 'symbol' attribute is considered a unique field and an Elasticsearch index document ID is generated for it.