IndexNotFoundException trying to delete an already created index


I have the following (abbreviated) code:

public void deleteExpiredIndexes() 
 Iterator<String> it = client.admin().indices().stats(new IndicesStatsRequest().indices(this.allIndexes)).get().getIndices().keySet().iterator();

 while (it.hasNext())
  String indexName =;
  if (isIndexExpired(indexName)) client.admin().indices().prepareDelete(indexName).get();

Every 10 minutes we are creating a new index and removing the last one, created 30 minutes ago. I mean, when the index 201601111648 is created, the index 201601111618 is removed.

The only place in my code where an index is removed is in the previous method.

The elasticsearch log sometimes shows this exception:

[2016-01-11 16:38:13,292][INFO ][cluster.metadata ] [ventusproxy01] [190_201601111638] creating index, cause [api], templates [], shards [1]/[0], mappings [190]

[2016-01-11 16:48:13,492][INFO ][cluster.metadata ] [ventusproxy01] [190_201601111618] deleting index
[2016-01-11 16:48:13,576][INFO ][cluster.metadata ] [ventusproxy01] [190_201601111648] creating index, cause [api], templates [], shards [1]/[0], mappings [190]

[2016-01-11 16:58:13,768][INFO ][cluster.metadata ] [ventusproxy01] [190_201601111628] deleting index
[2016-01-11 16:58:13,859][INFO ][cluster.metadata ] [ventusproxy01] [190_201601111658] creating index, cause [api], templates [], shards [1]/[0], mappings [190]

[2016-01-11 17:08:14,217][INFO ][cluster.metadata ] [ventusproxy01] [190_201601111638] deleting index
[2016-01-11 17:08:14,537][DEBUG][action.admin.indices.delete] [ventusproxy01] [190_201601111638] failed to delete index
[190_201601111638] IndexNotFoundException[no such index]
at org.elasticsearch.cluster.metadata.MetaDataDeleteIndexService$2.execute(
at org.elasticsearch.cluster.service.InternalClusterService$
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
[2016-01-11 17:08:14,647][INFO ][cluster.metadata ] [ventusproxy01] [190_201601111708] creating index, cause [api], templates [], shards [1]/[0

This exception does not affect my code, but it's really rare. The index must exist because it's in the iterator, but when I try to remove it, it seems that no longer exists. And the index is physically removed.

It seems that the preparedDelete removes the index but, for any reason, sometimes logs this IndexNotFoundException.

It's ES 2.1.1.