add refresh support to update
This commit is contained in:
parent
43182f07fd
commit
9816675b61
|
@ -214,7 +214,8 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
.source(source, sourceAndContent.v1())
|
||||
.version(getResult.version()).replicationType(request.replicationType()).consistencyLevel(request.consistencyLevel())
|
||||
.timestamp(timestamp).ttl(ttl)
|
||||
.percolate(request.percolate());
|
||||
.percolate(request.percolate())
|
||||
.refresh(request.refresh());
|
||||
indexRequest.operationThreaded(false);
|
||||
indexAction.execute(indexRequest, new ActionListener<IndexResponse>() {
|
||||
@Override
|
||||
|
|
|
@ -53,6 +53,8 @@ public class UpdateRequest extends InstanceShardOperationRequest {
|
|||
|
||||
private String percolate;
|
||||
|
||||
private boolean refresh = false;
|
||||
|
||||
private ReplicationType replicationType = ReplicationType.DEFAULT;
|
||||
private WriteConsistencyLevel consistencyLevel = WriteConsistencyLevel.DEFAULT;
|
||||
|
||||
|
@ -270,6 +272,20 @@ public class UpdateRequest extends InstanceShardOperationRequest {
|
|||
return timeout(TimeValue.parseTimeValue(timeout, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a refresh be executed post this update operation causing the operation to
|
||||
* be searchable. Note, heavy indexing should not set this to <tt>true</tt>. Defaults
|
||||
* to <tt>false</tt>.
|
||||
*/
|
||||
public UpdateRequest refresh(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean refresh() {
|
||||
return this.refresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* The replication type.
|
||||
*/
|
||||
|
@ -316,6 +332,7 @@ public class UpdateRequest extends InstanceShardOperationRequest {
|
|||
if (in.readBoolean()) {
|
||||
percolate = in.readUTF();
|
||||
}
|
||||
refresh = in.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -346,5 +363,6 @@ public class UpdateRequest extends InstanceShardOperationRequest {
|
|||
out.writeBoolean(true);
|
||||
out.writeUTF(percolate);
|
||||
}
|
||||
out.writeBoolean(refresh);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,6 +136,16 @@ public class UpdateRequestBuilder extends BaseRequestBuilder<UpdateRequest, Upda
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a refresh be executed post this update operation causing the operation to
|
||||
* be searchable. Note, heavy indexing should not set this to <tt>true</tt>. Defaults
|
||||
* to <tt>false</tt>.
|
||||
*/
|
||||
public UpdateRequestBuilder setRefresh(boolean refresh) {
|
||||
request.refresh(refresh);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the replication type.
|
||||
*/
|
||||
|
|
|
@ -57,6 +57,7 @@ public class RestUpdateAction extends BaseRestHandler {
|
|||
updateRequest.routing(request.param("routing"));
|
||||
updateRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
||||
updateRequest.timeout(request.paramAsTime("timeout", updateRequest.timeout()));
|
||||
updateRequest.refresh(request.paramAsBoolean("refresh", updateRequest.refresh()));
|
||||
String replicationType = request.param("replication");
|
||||
if (replicationType != null) {
|
||||
updateRequest.replicationType(ReplicationType.fromString(replicationType));
|
||||
|
|
Loading…
Reference in New Issue