Hi, I am seeing an IndexMissingException when I do an index create
followed immediately by refresh.
first of all, my setup is:
- ES 0.12.1
- Java client API, embedded no-data node
- local gateway
- remote ES data node
My pseudocode goes like this:
- create index (1 shard, 0 replica for batch indexing)
- add documents if any
- refresh
- flush
- optimize
...
In my first attempt I didn't have documents in my DB, so create was
followed by refresh without delay, in that case I am seeing:
Exception in thread "Thread-6"
org.elasticsearch.indices.IndexMissingException: [index-dev-v0]
missing
at
org.elasticsearch.cluster.routing.RoutingTable.allShardsGrouped(RoutingTable.java:
153)
at
org.elasticsearch.action.admin.indices.refresh.TransportRefreshAction.shards(TransportRefreshAction.java:
116)
at
org.elasticsearch.action.admin.indices.refresh.TransportRefreshAction.shards(TransportRefreshAction.java:
50)
at
org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction
$AsyncBroadcastAction.(TransportBroadcastOperationAction.java:
161)
at
org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:
77)
at
org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:
54)
at
org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:
54)
at
org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:
43)
at
org.elasticsearch.client.node.NodeIndicesAdminClient.refresh(NodeIndicesAdminClient.java:
147)
When I call create index I wait for the future to finish with:
CreateIndexResponse response = future.actionGet();
When using "curl" to the remote ES node I can see the index is in fact
created, contrary to the exception.
If I add a 100ms delay in the "add documents" step everything works
OK, that's why I think it must be a concurrency issue, locking bug or
the like.
I understand that creating an index and then refreshing it is
pointless, I expect "add documents" to actually add some, but in this
case the DB was still empty and this weird thing happened. I could add
some checks in my code for that case, but I think it must be a tiny
bug that's better tackled. I could help with more details or tests if
somebody wishes to trace the problem.
Thanks,
Sebastian.