For our ElasticSearch tests, we use a permanent instance of ElasticSearch on our Jenkins build server, which uses each test. For local tests, you need to run local ElasticSearch. We use the rest interface, not the java api.
To make unit tests parallel, we use a global, synchronized name pool (for index names). Each test can configure the json index definition, and if it works fine on a dirty (= already filled) index. A small test superclass (scalatest) will get the index name from the pool. If a clean index is required, (possibly) the existing one will be deleted, and a new one will be created. If the test accepts a dirty index, it checks to see if the definition of the index matches the configured one. If not, the index will also be recreated.
Depending on your test cases, this allows you to navigate with multiple indexes that will be recreated once at a time, and are often reused with tests, speeding up the test.
source share