package
Small utility to verify if an Elasticsearch cluster is up and running.
npm install is-elasticsearch-runningGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
A small utility to verify if an Elasticsearch cluster is up and running.
It's useful to sue in your test files, without the need to use sleep or other hacks.
npm i is-elasticsearch-running --save-devis-elasticsearch-running needs to be initialized with the client configuration, defaults to { node: 'http://localhost:9200' }.
const Es = require('is-elasticsearch-running')
const es = Es({ node: 'http://localhost:9200' })The builder return an object with two utilities, isRunning and waitCluster.
Checks if Elasticsearch is running in a given moment, returns a boolean.
const Es = require('is-elasticsearch-running')
const es = Es()
es.isRunning()
.then(bool => {
if (bool) console.log('Elasticsearch is up and running')
else console.log('Elasticsearch is not running')
})This is very useful to use at the beginning of your test suite, it send a cluster health request and waits until Elasticsearch is ready. By default it waits for status green and uses a timeout of 50 seconds, with 5 seconds of delay between retries. In total, tries to connect to Elasticsearch 10 times before giving up.
const Es = require('is-elasticsearch-running')
const es = Es()
es.waitCluster()
.then(() => console.log('ready'))
.catch(() => console.log('not ready'))
es.waitCluster('yellow', '30s')
.then(() => console.log('ready'))
.catch(() => console.log('not ready'))Estimated unpacked size across 11 packages.
16.0 MB
Includes dependencies.