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?

Animesh Pandey
  • 5,900
  • 13
  • 64
  • 130

2 Answers2

0

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

Community
  • 1
  • 1
Rahul
  • 15,979
  • 4
  • 42
  • 63
0

@rahulroc is right. I am adding a chronological list of references to the issues that introduced this feature:

  1. Don't broadcast deletes to all shards (2014)
  2. Delete api: remove broadcast delete if routing is missing when required (2015)
  3. Bulk api: fail deletes when routing is required but not specified (2016)

Maybe update 3 was the one that made the exception appear in es-2.3.0. So you can just use has_child query for getting the parent from the child document id.

Animesh Pandey
  • 5,900
  • 13
  • 64
  • 130