Hi thanks again for the answer.
Is there a way you could say 100% sure ? Because, we are currently having certain tests that (periodically) fail, because data we excpect to be in the index does not return results. We call (and wait for) refresh after putting (_bulk) the data in elastic.
After that, sometimes, our tests fail because they don't find the data.
The data in the index not being ready for search after calling refresh might be a possible cause, and we would like to rule that out...
I'm not that familiar with java or the elastic codebase, but after some debugging, in the refresh request, I did see that certain parts of the refresh code are put on a thread, and I'm not sure the main thread waits until they are finished:
TransportBroadcastOperationAction.performOperation is called (where the operation is put on a thread)