I'm writing tests that start a elasticsearch 6.4 single-node cluster to ensure that my queries behave as expected. It takes about 10 seconds for the cluster to start an my tests RestHighLevelClient to ping it without a connection error
Process proc = new ProcessBuilder("elasticsearch").start();
RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(
new HttpHost('localhost', 9200, 'http'),
new HttpHost('localhost', 9201, 'http'),
));
// wait for cluster, takes about 10 seconds in practice.
do {
try {
client.ping(RequestOptions.DEFAULT);
break;
} catch (IOException ex) { }
} while (true);
Are there settings I can change to improve startup time?
- I don't need to persist indexes across test runs, so the index could be kept in memory. I don't see
memory
listed in the 6.4 store types - Are there settings that cause the whole cluster to run without writing to disk (disable logging, disable file storage, disable pid/state)?
- The cluster will be single-node so I can disable discovery, but I haven't found that setting. Edit:
discovery.type=single-node
in 6.4