ElasticsearchPool

ElasticsearchPool

Create a database pool that works with ElasticSearch server, only the hostname and port will be used, by default each table is stored in its own index.

Configuration:

  • db-elasticseach-pool=default - connect to local ElasticSearch server

  • db-elasticseach-pool=https://eshost:9200/ - connect to remote ElasticSearch server

To define shards and replicas per index:

db-elasticsearch-pool-options-shards-INDEX_NAME=NUM
db-elasticsearch-pool-options-replicas-INDEX_NAME=NUM

To support multiple seed nodes a parameter db-elasticsearch-pool-options-servers=1.1.1.1,2.2.2.2 can be specified, if the primary node fails it will switch to other configured nodes. To control the switch retries and timeout there are options:

db-elasticsearch-pool-options-retry-count=3
db-elasticsearch-pool-options-retry-timeout=250

On successful connect to any node the driver retrieves full list of nodes in the cluster and switches to a random node, this happens every discovery-interval in milliseconds, default is 1h, it can be specified as db-elasticserch-pool-options-discovery-interval=300000