Skip to content

API Docs - v1.0.2

Store

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 to elasticsearch store. Elasticsearch indexing documents are converted to Events when the documents are read from Elasticsearch indexes. Internally store connected with Elasticsearch server with The Elasticsearch Java High Level REST Client library.

Syntax

@Store(type="elasticsearch", host="<STRING>", port="<INT>", scheme="<STRING>", username="<STRING>", password="<STRING>", index.name="<STRING>", index.alias="<STRING>", index.number.of.shards="<INT>", index.number.of.replicas="<INT>")
@PrimaryKey("PRIMARY_KEY")
@Index("INDEX")

QUERY PARAMETERS

Name Description Default Value Possible Data Types Optional Dynamic
host The host 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 user name for the Elasticsearch server connection. elastic STRING Yes No
password The password for the Elasticsearch server connection. changeme STRING Yes No
index.name 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 for the index in Elasticsearch server. 3 INT Yes No
index.number.of.replicas The number of replicas for the index in Elasticsearch server. 2 INT Yes No

Examples EXAMPLE 1

@Store(type="elasticsearch", host="localhost", username="elastic", password="changeme" , index.name="MyStockTable",field.length="symbol:100")
@PrimaryKey("symbol")define table StockTable (symbol string, price float, volume long);

The above example creates an index named MyStockTable on the Elasticsearch server if it does not already exist (with 3 attributes named symbol, price, and volume of the types 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 a Elasticsearch index document id is generated for it.