Isolate parallel requests to Elasticsearch

Hi all,

I want to run a set of test classes for my application in parallel. Inside each of the test class, the functions make calls to elasticsearch. Currently the problem I am facing in running the tests in parallel is that when I query elasticsearch from say TestA, it may include documents which were inserted during TestB. In such a case the test would fail since the desired result should contain the documents corresponding to TestA only. So, I was wondering if there was a way to isolate the requests made to elasticsearch or create a sandbox of elasticsearch for each test class.

Currently I am looking for answers which support single node cluster.


Welcome to our community! :smiley:

The simplest way I can think to handle this would be to use different indices for each test. Is that possible?

@warkolm Unfortunately, it is not possible to create new index for each test since some of the test may use some pre-existing index for their operations.

I am looking for a solution more on the lines with the following line of thought - I want to run a single instance of elasticsearch on localhost and treat it as multiple different instances such that the pre-existing indices are available across all the, let's say, "virtual" instances, but any new changes made are restricted to a particular "virtual" instance.

The only way that'd make sense to do that is to use different indices.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.