Get API: Allow to provide a parent value which automatically set the routing value, closes #1961.
This commit is contained in:
parent
be01e8fe19
commit
2cca50d238
|
@ -64,6 +64,15 @@ public class DeleteRequestBuilder extends BaseRequestBuilder<DeleteRequest, Dele
|
|||
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 DeleteRequestBuilder setParent(String parent) {
|
||||
request.parent(parent);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls the shard routing of the delete request. Using this value to hash the shard
|
||||
* and not the id.
|
||||
|
|
|
@ -120,6 +120,17 @@ public class GetRequest extends SingleShardOperationRequest {
|
|||
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 GetRequest 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.
|
||||
|
|
|
@ -62,6 +62,15 @@ public class GetRequestBuilder extends BaseRequestBuilder<GetRequest, GetRespons
|
|||
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 GetRequestBuilder setParent(String parent) {
|
||||
request.parent(parent);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls the shard routing of the request. Using this value to hash the shard
|
||||
* and not the id.
|
||||
|
|
|
@ -55,6 +55,7 @@ public class RestGetAction extends BaseRestHandler {
|
|||
// if we have a local operation, execute it on a thread since we don't spawn
|
||||
getRequest.operationThreaded(true);
|
||||
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
||||
getRequest.parent(request.param("parent"));
|
||||
getRequest.routing(request.param("routing"));
|
||||
getRequest.preference(request.param("preference"));
|
||||
getRequest.realtime(request.paramAsBooleanOptional("realtime", null));
|
||||
|
|
Loading…
Reference in New Issue