Delete API: Allow to set _parent on it (will simply set the routing value), closes #742.
This commit is contained in:
parent
655cbb9440
commit
4631df9d01
|
@ -141,7 +141,7 @@ public class BulkRequest implements ActionRequest {
|
|||
}
|
||||
|
||||
if ("delete".equals(action)) {
|
||||
add(new DeleteRequest(index, type, id).routing(routing));
|
||||
add(new DeleteRequest(index, type, id).parent(parent).routing(routing));
|
||||
} else {
|
||||
nextMarker = findNextMarker(marker, from, data, length);
|
||||
if (nextMarker == -1) {
|
||||
|
|
|
@ -167,6 +167,17 @@ public class DeleteRequest extends ShardReplicationOperationRequest {
|
|||
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 DeleteRequest 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.
|
||||
|
|
|
@ -50,6 +50,7 @@ public class RestDeleteAction extends BaseRestHandler {
|
|||
|
||||
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {
|
||||
DeleteRequest deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||
deleteRequest.parent(request.param("parent"));
|
||||
deleteRequest.routing(request.param("routing"));
|
||||
deleteRequest.timeout(request.paramAsTime("timeout", DeleteRequest.DEFAULT_TIMEOUT));
|
||||
deleteRequest.refresh(request.paramAsBoolean("refresh", deleteRequest.refresh()));
|
||||
|
|
Loading…
Reference in New Issue