diff --git a/docs/reference/docs/update.asciidoc b/docs/reference/docs/update.asciidoc index 64731cf81bc..7cfdae2ec4d 100644 --- a/docs/reference/docs/update.asciidoc +++ b/docs/reference/docs/update.asciidoc @@ -200,8 +200,6 @@ including: `routing`:: Sets the routing that will be used to route the document to the relevant shard. -`parent`:: Simply sets the routing. - `timeout`:: Timeout waiting for a shard to become available. `replication`:: The replication type for the delete/index operation diff --git a/docs/reference/migration/migrate_2_0.asciidoc b/docs/reference/migration/migrate_2_0.asciidoc index e48a6527228..63eba254847 100644 --- a/docs/reference/migration/migrate_2_0.asciidoc +++ b/docs/reference/migration/migrate_2_0.asciidoc @@ -110,3 +110,8 @@ large, it is recommended to make it replicated to all nodes by setting `index.auto_expand_replicas: 0-all` in order to remove the network overhead as well. +=== Parent parameter on update request + +The `parent` parameter has been removed from the update request. Before 2.x it just set the routing parameter. The +`routing` setting should be used instead. The `parent` setting was confusing, because it had the impression that the parent +a child documents points to can be changed but this is not true. \ No newline at end of file diff --git a/rest-api-spec/api/update.json b/rest-api-spec/api/update.json index 6196067f63c..6612781796a 100644 --- a/rest-api-spec/api/update.json +++ b/rest-api-spec/api/update.json @@ -36,10 +36,6 @@ "type": "string", "description": "The script language (default: groovy)" }, - "parent": { - "type": "string", - "description": "ID of the parent document" - }, "refresh": { "type": "boolean", "description": "Refresh the index after performing the operation" diff --git a/rest-api-spec/test/update/50_parent.yaml b/rest-api-spec/test/update/50_parent.yaml index 3d15ea9f2a8..4b0bffd0ca8 100644 --- a/rest-api-spec/test/update/50_parent.yaml +++ b/rest-api-spec/test/update/50_parent.yaml @@ -29,10 +29,10 @@ setup: index: test_1 type: test id: 1 - parent: 5 + routing: 5 body: doc: { foo: baz } - upsert: { foo: bar } + upsert: { foo: bar, _parent: 5 } - do: get: @@ -50,7 +50,7 @@ setup: index: test_1 type: test id: 1 - parent: 5 + routing: 5 fields: foo body: doc: { foo: baz } diff --git a/rest-api-spec/test/update/55_parent_with_routing.yaml b/rest-api-spec/test/update/55_parent_with_routing.yaml index 51dd91af3ba..85d59599bc3 100644 --- a/rest-api-spec/test/update/55_parent_with_routing.yaml +++ b/rest-api-spec/test/update/55_parent_with_routing.yaml @@ -21,11 +21,10 @@ index: test_1 type: test id: 1 - parent: 5 routing: 4 body: doc: { foo: baz } - upsert: { foo: bar } + upsert: { foo: bar, _parent: 5 } - do: get: @@ -45,7 +44,7 @@ index: test_1 type: test id: 1 - parent: 5 + routing: 5 body: doc: { foo: baz } @@ -54,7 +53,6 @@ index: test_1 type: test id: 1 - parent: 5 routing: 4 fields: foo body: diff --git a/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java b/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java index da4ef6effde..f4e2ea555d1 100644 --- a/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java +++ b/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java @@ -353,14 +353,13 @@ public class BulkRequest extends ActionRequest implements Composite .create(true) .source(data.slice(from, nextMarker - from), contentUnsafe), payload); } else if ("update".equals(action)) { - UpdateRequest updateRequest = new UpdateRequest(index, type, id).routing(routing).parent(parent).retryOnConflict(retryOnConflict) + UpdateRequest updateRequest = new UpdateRequest(index, type, id).routing(routing).retryOnConflict(retryOnConflict) .version(version).versionType(versionType) .source(data.slice(from, nextMarker - from)); IndexRequest upsertRequest = updateRequest.upsertRequest(); if (upsertRequest != null) { upsertRequest.routing(routing); - upsertRequest.parent(parent); // order is important, set it after routing, so it will set the routing upsertRequest.timestamp(timestamp); upsertRequest.ttl(ttl); upsertRequest.version(version); @@ -369,7 +368,6 @@ public class BulkRequest extends ActionRequest implements Composite IndexRequest doc = updateRequest.doc(); if (doc != null) { doc.routing(routing); - doc.parent(parent); // order is important, set it after routing, so it will set the routing doc.timestamp(timestamp); doc.ttl(ttl); doc.version(version); diff --git a/src/main/java/org/elasticsearch/action/update/UpdateRequest.java b/src/main/java/org/elasticsearch/action/update/UpdateRequest.java index 5b3d329152d..a2617d96338 100644 --- a/src/main/java/org/elasticsearch/action/update/UpdateRequest.java +++ b/src/main/java/org/elasticsearch/action/update/UpdateRequest.java @@ -20,7 +20,6 @@ package org.elasticsearch.action.update; import com.google.common.collect.Maps; -import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.DocumentRequest; import org.elasticsearch.action.WriteConsistencyLevel; @@ -174,17 +173,6 @@ public class UpdateRequest extends InstanceShardOperationRequest return this; } - /** - * Sets the parent id of this document. Will simply set the routing to this value, as it is only - * used for routing with delete requests. - */ - public UpdateRequest parent(String parent) { - if (routing == null) { - routing = parent; - } - return this; - } - /** * Controls the shard routing of the request. Using this value to hash the shard * and not the id. diff --git a/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java b/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java index 640369288ea..8318ce75657 100644 --- a/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java @@ -70,11 +70,6 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder