We have a 6 node elasticsearch 2.4.4 cluster. Each index has 2 shards and 1 replica. When we call _search?size=10, "total" keeps alternating between 257566/257707 in an index. Expected total count is 257707. When i query _search?size=10&preference=_primary, I get 257707 and when i query _search?size=10&preference=_replica I get 257566.
We are noticing this only when we use delete by query to delete some documents and do indexing again. Below is the call we are making to delete the docs
DeleteByQueryRequestBuilder(client, DeleteByQueryAction.INSTANCE) .setIndices(indexName) .setTypes(mappingName) .setSource(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery()).size(5000).toString()) .execute() .actionGet()
Any theory on why we are getting inconsistent count is really appreciated