I am writing some integration tests for an app that uses Elasticsearch and
I am experiencing a strange behaviour. If I insert a document and I query
straight after that, I get different results every time. I suspect that,
albeit the insertion itself will return, the indexing itself doesn't take
place synchronously and, because of that, the query will experiment a race
condition with unpredictable results.
If this is the case: is there a way to synchronize, so that when I run my
queries, I know that they are ready and successful???
More details: I am using elasticsearch embedded and the query is a simple
filter. The only odd thing is that I am using template files for the
document model.
EDIT: I even tried to GET the document by ID after insertion, but the
queries still return random results (unless I put a thread Sleep to wait
some seconds).
I am writing some integration tests for an app that uses Elasticsearch and
I am experiencing a strange behaviour. If I insert a document and I query
straight after that, I get different results every time. I suspect that,
albeit the insertion itself will return, the indexing itself doesn't take
place synchronously and, because of that, the query will experiment a race
condition with unpredictable results.
If this is the case: is there a way to synchronize, so that when I run
my queries, I know that they are ready and successful???
More details: I am using elasticsearch embedded and the query is a simple
filter. The only odd thing is that I am using template files for the
document model.
EDIT: I even tried to GET the document by ID after insertion, but the
queries still return random results (unless I put a thread Sleep to wait
some seconds).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.