Fixes the issue that the `parent` option was ignored for delete requests.

The `parent` option was ignored in the delete api (rest only) and for delete actions in the bulk api.
This bug occurred in the case that the _parent field is enabled, and only the parent option was used. This resulted in a situation that documents are deleted even if the specified parent value is incorrect.

Closes #3257
This commit is contained in:
Martijn van Groningen 2013-06-28 14:31:17 +02:00
parent 2d5b832f17
commit f8780751c4
2 changed files with 2 additions and 2 deletions

View File

@ -320,7 +320,7 @@ public class BulkRequest extends ActionRequest<BulkRequest> {
}
if ("delete".equals(action)) {
add(new DeleteRequest(index, type, id).parent(parent).version(version).versionType(versionType).routing(routing), payload);
add(new DeleteRequest(index, type, id).routing(routing).parent(parent).version(version).versionType(versionType), payload);
} else {
nextMarker = findNextMarker(marker, from, data, length);
if (nextMarker == -1) {

View File

@ -58,8 +58,8 @@ public class RestDeleteAction extends BaseRestHandler {
deleteRequest.listenerThreaded(false);
deleteRequest.operationThreaded(true);
deleteRequest.parent(request.param("parent"));
deleteRequest.routing(request.param("routing"));
deleteRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
deleteRequest.timeout(request.paramAsTime("timeout", DeleteRequest.DEFAULT_TIMEOUT));
deleteRequest.refresh(request.paramAsBoolean("refresh", deleteRequest.refresh()));
deleteRequest.version(RestActions.parseVersion(request));