Percolator sometimes doesn't refresh queries

I indexed 100000 queries in percolator index. Next 90000 was deleted.
Sometimes it looks like index didn't refresh (I repeated step many times),
deleted queries are still matched and returned in resposne. I tried to
clear cache and refresh index, but sometimes it doesn't work, my code:

BulkRequestBuilder bulkRequest = client.prepareBulk();
while (some condition) {
bulkRequest.add(client.prepareIndex("_percolator", INDEX_NAME,
id).setSource(...));
}
while (some condition) {
bulkRequest.add(client.prepareDelete("_percolator", INDEX_NAME, id));
}
BulkResponse response = bulkRequest.setRefresh(true).execute().actionGet();
client.admin().indices().prepareClearCache(INDEX_NAME).execute().actionGet();
client.admin().indices().prepareClearCache(PERCOLATOR).execute().actionGet();
client.admin().indices().prepareRefresh(INDEX_NAME).execute().actionGet();
client.admin().indices().prepareRefresh(PERCOLATOR).execute().actionGet();

How to make sure that after bulk request (response.hasFailures() always
returns false) percolator index will be refreshed?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4315acb8-8e7e-40bf-a89c-18d8fa476408%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.