Search code examples
javaelasticsearchelasticsearch-java-api

Getting RoutingMissingException while migrating from ES 2.2.0 to ES 2.3.0


I am using prepareDelete query in a BulkRequest where I have a set of IDs which I have to delete.

I used:

BulkRequestBuilder bulkRequest = searchClient.prepareBulk();
for id in ids {
    bulkRequest.add(searchClient.prepareDelete("indexName", "childType", id));
}
BulkResponse bulkResponse = bulkRequest.execute().actionGet();

This structure for deletion was working in ES 2.2.0 but in ES 2.3.0 I get RoutingMissingException.

If I print bilkResponse.buildFailureMessage() and I get

[0]: index [indexName], type [childType], id [215f3228a3c53970883ae0d3b22dae6f], message [[indexName] RoutingMissingException[routing is required for [indexName]/[childType]/[215f3228a3c53970883ae0d3b22dae6f]]]

I have not even changed the settings/mapping of the existing index.

What could be the reason?


Solution

  • Seems like an issue similar to the one answered here

    Citing the answer for completion

    When you have a parent child relationship, you need to specify the parent in the URL each time you try to access it a child, since routing now depends on the parent.

    In your example, you'd want to try:

    curl -XDELETE http://localhost:9200/indexName/childType/215f3228a3c53970883ae0d3b22dae6f?parent=[parent_id]

    This could also be helpful to you. Delete child doc