I'm creating a little wrapper around the elasticsearch java api and found something weird. In my code I have the following sequence of execution:
-
Remove index
.admin().indices().delete(DeleteIndexRequest).get();
2.Create index and index some data with bulk request
bulkRequest.add(IndexRequest)
bulkRequest.execute().get();
3.And finally get count of records:
.getClient().prepareCount(indexes);
The problem is that the count always shows 0 records. To make it working I have to add Thread.Sleep between inserting/indexing data and getting count. I thought that get executes when operation is completed. Is it normally behaviour here? Should I wait a little more to give time to indexing data before execute count?