parent
a646e126e9
commit
4c493ac71d
|
@ -49,7 +49,7 @@ public abstract class ActionRequest<T extends ActionRequest> extends TransportRe
|
|||
* <p>When not executing on a thread, it will either be executed on the calling thread, or
|
||||
* on an expensive, IO based, thread.
|
||||
*/
|
||||
public final boolean isListenerThreaded() {
|
||||
public final boolean listenerThreaded() {
|
||||
return this.listenerThreaded;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public abstract class ActionRequest<T extends ActionRequest> extends TransportRe
|
|||
* Sets if the response listener be executed on a thread or not.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final T setListenerThreaded(boolean listenerThreaded) {
|
||||
public final T listenerThreaded(boolean listenerThreaded) {
|
||||
this.listenerThreaded = listenerThreaded;
|
||||
return (T) this;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public abstract class ActionRequestBuilder<Request extends ActionRequest, Respon
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final RequestBuilder setListenerThreaded(boolean listenerThreaded) {
|
||||
request.setListenerThreaded(listenerThreaded);
|
||||
request.listenerThreaded(listenerThreaded);
|
||||
return (RequestBuilder) this;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public abstract class ActionRequestBuilder<Request extends ActionRequest, Respon
|
|||
}
|
||||
|
||||
public ListenableActionFuture<Response> execute() {
|
||||
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<Response>(request.isListenerThreaded(), client.threadPool());
|
||||
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<Response>(request.listenerThreaded(), client.threadPool());
|
||||
execute(future);
|
||||
return future;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class TransportActionNodeProxy<Request extends ActionRequest, Response ex
|
|||
|
||||
public ActionFuture<Response> execute(DiscoveryNode node, Request request) throws ElasticSearchException {
|
||||
PlainActionFuture<Response> future = newFuture();
|
||||
request.setListenerThreaded(false);
|
||||
request.listenerThreaded(false);
|
||||
execute(node, request, future);
|
||||
return future;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class TransportActionNodeProxy<Request extends ActionRequest, Response ex
|
|||
|
||||
@Override
|
||||
public String executor() {
|
||||
if (request.isListenerThreaded()) {
|
||||
if (request.listenerThreaded()) {
|
||||
return ThreadPool.Names.GENERIC;
|
||||
}
|
||||
return ThreadPool.Names.SAME;
|
||||
|
|
|
@ -57,20 +57,20 @@ public class ClusterHealthRequest extends MasterNodeOperationRequest<ClusterHeal
|
|||
this.indices = indices;
|
||||
}
|
||||
|
||||
public String[] getIndices() {
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setIndices(String[] indices) {
|
||||
public ClusterHealthRequest indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimeValue getTimeout() {
|
||||
public TimeValue timeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setTimeout(TimeValue timeout) {
|
||||
public ClusterHealthRequest timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
if (masterNodeTimeout == DEFAULT_MASTER_NODE_TIMEOUT) {
|
||||
masterNodeTimeout = timeout;
|
||||
|
@ -78,63 +78,63 @@ public class ClusterHealthRequest extends MasterNodeOperationRequest<ClusterHeal
|
|||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setTimeout(String timeout) {
|
||||
return setTimeout(TimeValue.parseTimeValue(timeout, null));
|
||||
public ClusterHealthRequest timeout(String timeout) {
|
||||
return this.timeout(TimeValue.parseTimeValue(timeout, null));
|
||||
}
|
||||
|
||||
public ClusterHealthStatus getWaitForStatus() {
|
||||
public ClusterHealthStatus waitForStatus() {
|
||||
return waitForStatus;
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setWaitForStatus(ClusterHealthStatus waitForStatus) {
|
||||
public ClusterHealthRequest waitForStatus(ClusterHealthStatus waitForStatus) {
|
||||
this.waitForStatus = waitForStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setWaitForGreenStatus() {
|
||||
return setWaitForStatus(ClusterHealthStatus.GREEN);
|
||||
public ClusterHealthRequest waitForGreenStatus() {
|
||||
return waitForStatus(ClusterHealthStatus.GREEN);
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setWaitForYellowStatus() {
|
||||
return setWaitForStatus(ClusterHealthStatus.YELLOW);
|
||||
public ClusterHealthRequest waitForYellowStatus() {
|
||||
return waitForStatus(ClusterHealthStatus.YELLOW);
|
||||
}
|
||||
|
||||
public int getWaitForRelocatingShards() {
|
||||
public int waitForRelocatingShards() {
|
||||
return waitForRelocatingShards;
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setWaitForRelocatingShards(int waitForRelocatingShards) {
|
||||
public ClusterHealthRequest waitForRelocatingShards(int waitForRelocatingShards) {
|
||||
this.waitForRelocatingShards = waitForRelocatingShards;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getWaitForActiveShards() {
|
||||
public int waitForActiveShards() {
|
||||
return waitForActiveShards;
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setWaitForActiveShards(int waitForActiveShards) {
|
||||
public ClusterHealthRequest waitForActiveShards(int waitForActiveShards) {
|
||||
this.waitForActiveShards = waitForActiveShards;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getWaitForNodes() {
|
||||
public String waitForNodes() {
|
||||
return waitForNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for N number of nodes. Use "12" for exact mapping, ">12" and "<12" for range.
|
||||
*/
|
||||
public ClusterHealthRequest setWaitForNodes(String waitForNodes) {
|
||||
public ClusterHealthRequest waitForNodes(String waitForNodes) {
|
||||
this.waitForNodes = waitForNodes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequest setLocal(boolean local) {
|
||||
public ClusterHealthRequest local(boolean local) {
|
||||
this.local = local;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
public boolean local() {
|
||||
return this.local;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,42 +35,42 @@ public class ClusterHealthRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setIndices(String... indices) {
|
||||
request.setIndices(indices);
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setTimeout(TimeValue timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setTimeout(String timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setWaitForStatus(ClusterHealthStatus waitForStatus) {
|
||||
request.setWaitForStatus(waitForStatus);
|
||||
request.waitForStatus(waitForStatus);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setWaitForGreenStatus() {
|
||||
request.setWaitForGreenStatus();
|
||||
request.waitForGreenStatus();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setWaitForYellowStatus() {
|
||||
request.setWaitForYellowStatus();
|
||||
request.waitForYellowStatus();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setWaitForRelocatingShards(int waitForRelocatingShards) {
|
||||
request.setWaitForRelocatingShards(waitForRelocatingShards);
|
||||
request.waitForRelocatingShards(waitForRelocatingShards);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setWaitForActiveShards(int waitForActiveShards) {
|
||||
request.setWaitForActiveShards(waitForActiveShards);
|
||||
request.waitForActiveShards(waitForActiveShards);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class ClusterHealthRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
* Waits for N number of nodes. Use "12" for exact mapping, ">12" and "<12" for range.
|
||||
*/
|
||||
public ClusterHealthRequestBuilder setWaitForNodes(String waitForNodes) {
|
||||
request.setWaitForNodes(waitForNodes);
|
||||
request.waitForNodes(waitForNodes);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,19 +73,19 @@ public class TransportClusterHealthAction extends TransportMasterNodeOperationAc
|
|||
@Override
|
||||
protected ClusterHealthResponse masterOperation(ClusterHealthRequest request, ClusterState unusedState) throws ElasticSearchException {
|
||||
int waitFor = 5;
|
||||
if (request.getWaitForStatus() == null) {
|
||||
if (request.waitForStatus() == null) {
|
||||
waitFor--;
|
||||
}
|
||||
if (request.getWaitForRelocatingShards() == -1) {
|
||||
if (request.waitForRelocatingShards() == -1) {
|
||||
waitFor--;
|
||||
}
|
||||
if (request.getWaitForActiveShards() == -1) {
|
||||
if (request.waitForActiveShards() == -1) {
|
||||
waitFor--;
|
||||
}
|
||||
if (request.getWaitForNodes().isEmpty()) {
|
||||
if (request.waitForNodes().isEmpty()) {
|
||||
waitFor--;
|
||||
}
|
||||
if (request.getIndices().length == 0) { // check that they actually exists in the meta data
|
||||
if (request.indices().length == 0) { // check that they actually exists in the meta data
|
||||
waitFor--;
|
||||
}
|
||||
if (waitFor == 0) {
|
||||
|
@ -93,72 +93,72 @@ public class TransportClusterHealthAction extends TransportMasterNodeOperationAc
|
|||
ClusterState clusterState = clusterService.state();
|
||||
return clusterHealth(request, clusterState);
|
||||
}
|
||||
long endTime = System.currentTimeMillis() + request.getTimeout().millis();
|
||||
long endTime = System.currentTimeMillis() + request.timeout().millis();
|
||||
while (true) {
|
||||
int waitForCounter = 0;
|
||||
ClusterState clusterState = clusterService.state();
|
||||
ClusterHealthResponse response = clusterHealth(request, clusterState);
|
||||
if (request.getWaitForStatus() != null && response.getStatus().value() <= request.getWaitForStatus().value()) {
|
||||
if (request.waitForStatus() != null && response.getStatus().value() <= request.waitForStatus().value()) {
|
||||
waitForCounter++;
|
||||
}
|
||||
if (request.getWaitForRelocatingShards() != -1 && response.getRelocatingShards() <= request.getWaitForRelocatingShards()) {
|
||||
if (request.waitForRelocatingShards() != -1 && response.getRelocatingShards() <= request.waitForRelocatingShards()) {
|
||||
waitForCounter++;
|
||||
}
|
||||
if (request.getWaitForActiveShards() != -1 && response.getActiveShards() >= request.getWaitForActiveShards()) {
|
||||
if (request.waitForActiveShards() != -1 && response.getActiveShards() >= request.waitForActiveShards()) {
|
||||
waitForCounter++;
|
||||
}
|
||||
if (request.getIndices().length > 0) {
|
||||
if (request.indices().length > 0) {
|
||||
try {
|
||||
clusterState.metaData().concreteIndices(request.getIndices());
|
||||
clusterState.metaData().concreteIndices(request.indices());
|
||||
waitForCounter++;
|
||||
} catch (IndexMissingException e) {
|
||||
response.status = ClusterHealthStatus.RED; // no indices, make sure its RED
|
||||
// missing indices, wait a bit more...
|
||||
}
|
||||
}
|
||||
if (!request.getWaitForNodes().isEmpty()) {
|
||||
if (request.getWaitForNodes().startsWith(">=")) {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes().substring(2));
|
||||
if (!request.waitForNodes().isEmpty()) {
|
||||
if (request.waitForNodes().startsWith(">=")) {
|
||||
int expected = Integer.parseInt(request.waitForNodes().substring(2));
|
||||
if (response.getNumberOfNodes() >= expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
} else if (request.getWaitForNodes().startsWith("ge(")) {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes().substring(3, request.getWaitForNodes().length() - 1));
|
||||
} else if (request.waitForNodes().startsWith("ge(")) {
|
||||
int expected = Integer.parseInt(request.waitForNodes().substring(3, request.waitForNodes().length() - 1));
|
||||
if (response.getNumberOfNodes() >= expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
} else if (request.getWaitForNodes().startsWith("<=")) {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes().substring(2));
|
||||
} else if (request.waitForNodes().startsWith("<=")) {
|
||||
int expected = Integer.parseInt(request.waitForNodes().substring(2));
|
||||
if (response.getNumberOfNodes() <= expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
} else if (request.getWaitForNodes().startsWith("le(")) {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes().substring(3, request.getWaitForNodes().length() - 1));
|
||||
} else if (request.waitForNodes().startsWith("le(")) {
|
||||
int expected = Integer.parseInt(request.waitForNodes().substring(3, request.waitForNodes().length() - 1));
|
||||
if (response.getNumberOfNodes() <= expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
} else if (request.getWaitForNodes().startsWith(">")) {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes().substring(1));
|
||||
} else if (request.waitForNodes().startsWith(">")) {
|
||||
int expected = Integer.parseInt(request.waitForNodes().substring(1));
|
||||
if (response.getNumberOfNodes() > expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
} else if (request.getWaitForNodes().startsWith("gt(")) {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes().substring(3, request.getWaitForNodes().length() - 1));
|
||||
} else if (request.waitForNodes().startsWith("gt(")) {
|
||||
int expected = Integer.parseInt(request.waitForNodes().substring(3, request.waitForNodes().length() - 1));
|
||||
if (response.getNumberOfNodes() > expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
} else if (request.getWaitForNodes().startsWith("<")) {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes().substring(1));
|
||||
} else if (request.waitForNodes().startsWith("<")) {
|
||||
int expected = Integer.parseInt(request.waitForNodes().substring(1));
|
||||
if (response.getNumberOfNodes() < expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
} else if (request.getWaitForNodes().startsWith("lt(")) {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes().substring(3, request.getWaitForNodes().length() - 1));
|
||||
} else if (request.waitForNodes().startsWith("lt(")) {
|
||||
int expected = Integer.parseInt(request.waitForNodes().substring(3, request.waitForNodes().length() - 1));
|
||||
if (response.getNumberOfNodes() < expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
} else {
|
||||
int expected = Integer.parseInt(request.getWaitForNodes());
|
||||
int expected = Integer.parseInt(request.waitForNodes());
|
||||
if (response.getNumberOfNodes() == expected) {
|
||||
waitForCounter++;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeOperationAc
|
|||
response.numberOfNodes = clusterState.nodes().size();
|
||||
response.numberOfDataNodes = clusterState.nodes().dataNodes().size();
|
||||
|
||||
for (String index : clusterState.metaData().concreteIndicesIgnoreMissing(request.getIndices())) {
|
||||
for (String index : clusterState.metaData().concreteIndicesIgnoreMissing(request.indices())) {
|
||||
IndexRoutingTable indexRoutingTable = clusterState.routingTable().index(index);
|
||||
IndexMetaData indexMetaData = clusterState.metaData().index(index);
|
||||
if (indexRoutingTable == null) {
|
||||
|
|
|
@ -44,38 +44,38 @@ public class NodesHotThreadsRequest extends NodesOperationRequest<NodesHotThread
|
|||
super(nodesIds);
|
||||
}
|
||||
|
||||
public int getThreads() {
|
||||
public int threads() {
|
||||
return this.threads;
|
||||
}
|
||||
|
||||
public NodesHotThreadsRequest setThreads(int threads) {
|
||||
public NodesHotThreadsRequest threads(int threads) {
|
||||
this.threads = threads;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NodesHotThreadsRequest setType(String type) {
|
||||
public NodesHotThreadsRequest type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
public String type() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public NodesHotThreadsRequest setInterval(TimeValue interval) {
|
||||
public NodesHotThreadsRequest interval(TimeValue interval) {
|
||||
this.interval = interval;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimeValue getInterval() {
|
||||
public TimeValue interval() {
|
||||
return this.interval;
|
||||
}
|
||||
|
||||
public int getSnapshots() {
|
||||
public int snapshots() {
|
||||
return this.snapshots;
|
||||
}
|
||||
|
||||
public NodesHotThreadsRequest setSnapshots(int snapshots) {
|
||||
public NodesHotThreadsRequest snapshots(int snapshots) {
|
||||
this.snapshots = snapshots;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -34,17 +34,17 @@ public class NodesHotThreadsRequestBuilder extends NodesOperationRequestBuilder<
|
|||
}
|
||||
|
||||
public NodesHotThreadsRequestBuilder setThreads(int threads) {
|
||||
request.setThreads(threads);
|
||||
request.threads(threads);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NodesHotThreadsRequestBuilder setType(String type) {
|
||||
request.setType(type);
|
||||
request.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
public NodesHotThreadsRequestBuilder setInterval(TimeValue interval) {
|
||||
request.setInterval(interval);
|
||||
request.interval(interval);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,14 +83,14 @@ public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
|
|||
/**
|
||||
* Should the node settings be returned.
|
||||
*/
|
||||
public boolean isSettings() {
|
||||
public boolean settings() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node settings be returned.
|
||||
*/
|
||||
public NodesInfoRequest setSettings(boolean settings) {
|
||||
public NodesInfoRequest settings(boolean settings) {
|
||||
this.settings = settings;
|
||||
return this;
|
||||
}
|
||||
|
@ -98,14 +98,14 @@ public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
|
|||
/**
|
||||
* Should the node OS be returned.
|
||||
*/
|
||||
public boolean isOs() {
|
||||
public boolean os() {
|
||||
return this.os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node OS be returned.
|
||||
*/
|
||||
public NodesInfoRequest setOs(boolean os) {
|
||||
public NodesInfoRequest os(boolean os) {
|
||||
this.os = os;
|
||||
return this;
|
||||
}
|
||||
|
@ -113,14 +113,14 @@ public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
|
|||
/**
|
||||
* Should the node Process be returned.
|
||||
*/
|
||||
public boolean isProcess() {
|
||||
public boolean process() {
|
||||
return this.process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node Process be returned.
|
||||
*/
|
||||
public NodesInfoRequest setProcess(boolean process) {
|
||||
public NodesInfoRequest process(boolean process) {
|
||||
this.process = process;
|
||||
return this;
|
||||
}
|
||||
|
@ -128,14 +128,14 @@ public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
|
|||
/**
|
||||
* Should the node JVM be returned.
|
||||
*/
|
||||
public boolean isJvm() {
|
||||
public boolean jvm() {
|
||||
return this.jvm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node JVM be returned.
|
||||
*/
|
||||
public NodesInfoRequest setJvm(boolean jvm) {
|
||||
public NodesInfoRequest jvm(boolean jvm) {
|
||||
this.jvm = jvm;
|
||||
return this;
|
||||
}
|
||||
|
@ -143,14 +143,14 @@ public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
|
|||
/**
|
||||
* Should the node Thread Pool info be returned.
|
||||
*/
|
||||
public boolean isThreadPool() {
|
||||
public boolean threadPool() {
|
||||
return this.threadPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node Thread Pool info be returned.
|
||||
*/
|
||||
public NodesInfoRequest setThreadPool(boolean threadPool) {
|
||||
public NodesInfoRequest threadPool(boolean threadPool) {
|
||||
this.threadPool = threadPool;
|
||||
return this;
|
||||
}
|
||||
|
@ -158,14 +158,14 @@ public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
|
|||
/**
|
||||
* Should the node Network be returned.
|
||||
*/
|
||||
public boolean isNetwork() {
|
||||
public boolean network() {
|
||||
return this.network;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node Network be returned.
|
||||
*/
|
||||
public NodesInfoRequest setNetwork(boolean network) {
|
||||
public NodesInfoRequest network(boolean network) {
|
||||
this.network = network;
|
||||
return this;
|
||||
}
|
||||
|
@ -173,14 +173,14 @@ public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
|
|||
/**
|
||||
* Should the node Transport be returned.
|
||||
*/
|
||||
public boolean isTransport() {
|
||||
public boolean transport() {
|
||||
return this.transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node Transport be returned.
|
||||
*/
|
||||
public NodesInfoRequest setTransport(boolean transport) {
|
||||
public NodesInfoRequest transport(boolean transport) {
|
||||
this.transport = transport;
|
||||
return this;
|
||||
}
|
||||
|
@ -188,14 +188,14 @@ public class NodesInfoRequest extends NodesOperationRequest<NodesInfoRequest> {
|
|||
/**
|
||||
* Should the node HTTP be returned.
|
||||
*/
|
||||
public boolean isHttp() {
|
||||
public boolean http() {
|
||||
return this.http;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node HTTP be returned.
|
||||
*/
|
||||
public NodesInfoRequest setHttp(boolean http) {
|
||||
public NodesInfoRequest http(boolean http) {
|
||||
this.http = http;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
|
|||
* Should the node settings be returned.
|
||||
*/
|
||||
public NodesInfoRequestBuilder setSettings(boolean settings) {
|
||||
request.setSettings(settings);
|
||||
request.settings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
|
|||
* Should the node OS info be returned.
|
||||
*/
|
||||
public NodesInfoRequestBuilder setOs(boolean os) {
|
||||
request.setOs(os);
|
||||
request.os(os);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
|
|||
* Should the node OS process be returned.
|
||||
*/
|
||||
public NodesInfoRequestBuilder setProcess(boolean process) {
|
||||
request.setProcess(process);
|
||||
request.process(process);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
|
|||
* Should the node JVM info be returned.
|
||||
*/
|
||||
public NodesInfoRequestBuilder setJvm(boolean jvm) {
|
||||
request.setJvm(jvm);
|
||||
request.jvm(jvm);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
|
|||
* Should the node thread pool info be returned.
|
||||
*/
|
||||
public NodesInfoRequestBuilder setThreadPool(boolean threadPool) {
|
||||
request.setThreadPool(threadPool);
|
||||
request.threadPool(threadPool);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
|
|||
* Should the node Network info be returned.
|
||||
*/
|
||||
public NodesInfoRequestBuilder setNetwork(boolean network) {
|
||||
request.setNetwork(network);
|
||||
request.network(network);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
|
|||
* Should the node Transport info be returned.
|
||||
*/
|
||||
public NodesInfoRequestBuilder setTransport(boolean transport) {
|
||||
request.setTransport(transport);
|
||||
request.transport(transport);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
|
|||
* Should the node HTTP info be returned.
|
||||
*/
|
||||
public NodesInfoRequestBuilder setHttp(boolean http) {
|
||||
request.setHttp(http);
|
||||
request.http(http);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public class TransportNodesInfoAction extends TransportNodesOperationAction<Node
|
|||
@Override
|
||||
protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest) throws ElasticSearchException {
|
||||
NodesInfoRequest request = nodeRequest.request;
|
||||
return nodeService.info(request.isSettings(), request.isOs(), request.isProcess(), request.isJvm(), request.isThreadPool(), request.isNetwork(), request.isTransport(), request.isHttp());
|
||||
return nodeService.info(request.settings(), request.os(), request.process(), request.jvm(), request.threadPool(), request.network(), request.transport(), request.http());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,7 +49,7 @@ public class NodesRestartRequest extends NodesOperationRequest<NodesRestartReque
|
|||
/**
|
||||
* The delay for the restart to occur. Defaults to <tt>1s</tt>.
|
||||
*/
|
||||
public NodesRestartRequest setDelay(TimeValue delay) {
|
||||
public NodesRestartRequest delay(TimeValue delay) {
|
||||
this.delay = delay;
|
||||
return this;
|
||||
}
|
||||
|
@ -57,11 +57,11 @@ public class NodesRestartRequest extends NodesOperationRequest<NodesRestartReque
|
|||
/**
|
||||
* The delay for the restart to occur. Defaults to <tt>1s</tt>.
|
||||
*/
|
||||
public NodesRestartRequest setDelay(String delay) {
|
||||
return setDelay(TimeValue.parseTimeValue(delay, null));
|
||||
public NodesRestartRequest delay(String delay) {
|
||||
return delay(TimeValue.parseTimeValue(delay, null));
|
||||
}
|
||||
|
||||
public TimeValue getDelay() {
|
||||
public TimeValue delay() {
|
||||
return this.delay;
|
||||
}
|
||||
|
||||
|
@ -76,4 +76,4 @@ public class NodesRestartRequest extends NodesOperationRequest<NodesRestartReque
|
|||
super.writeTo(out);
|
||||
delay.writeTo(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class NodesRestartRequestBuilder extends NodesOperationRequestBuilder<Nod
|
|||
* The delay for the restart to occur. Defaults to <tt>1s</tt>.
|
||||
*/
|
||||
public NodesRestartRequestBuilder setDelay(TimeValue delay) {
|
||||
request.setDelay(delay);
|
||||
request.delay(delay);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class NodesRestartRequestBuilder extends NodesOperationRequestBuilder<Nod
|
|||
* The delay for the restart to occur. Defaults to <tt>1s</tt>.
|
||||
*/
|
||||
public NodesRestartRequestBuilder setDelay(String delay) {
|
||||
request.setDelay(delay);
|
||||
request.delay(delay);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -54,4 +54,4 @@ public class NodesRestartRequestBuilder extends NodesOperationRequestBuilder<Nod
|
|||
protected void doExecute(ActionListener<NodesRestartResponse> listener) {
|
||||
((ClusterAdminClient) client).nodesRestart(request, listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,26 +56,26 @@ public class NodesShutdownRequest extends MasterNodeOperationRequest<NodesShutdo
|
|||
/**
|
||||
* The delay for the shutdown to occur. Defaults to <tt>1s</tt>.
|
||||
*/
|
||||
public NodesShutdownRequest setDelay(TimeValue delay) {
|
||||
public NodesShutdownRequest delay(TimeValue delay) {
|
||||
this.delay = delay;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TimeValue getDelay() {
|
||||
public TimeValue delay() {
|
||||
return this.delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* The delay for the shutdown to occur. Defaults to <tt>1s</tt>.
|
||||
*/
|
||||
public NodesShutdownRequest setDelay(String delay) {
|
||||
return setDelay(TimeValue.parseTimeValue(delay, null));
|
||||
public NodesShutdownRequest delay(String delay) {
|
||||
return delay(TimeValue.parseTimeValue(delay, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the JVM be exited as well or not. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public NodesShutdownRequest setExit(boolean exit) {
|
||||
public NodesShutdownRequest exit(boolean exit) {
|
||||
this.exit = exit;
|
||||
return this;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class NodesShutdownRequest extends MasterNodeOperationRequest<NodesShutdo
|
|||
/**
|
||||
* Should the JVM be exited as well or not. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public boolean isExit() {
|
||||
public boolean exit() {
|
||||
return exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class NodesShutdownRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
* The delay for the restart to occur. Defaults to <tt>1s</tt>.
|
||||
*/
|
||||
public NodesShutdownRequestBuilder setDelay(TimeValue delay) {
|
||||
request.setDelay(delay);
|
||||
request.delay(delay);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class NodesShutdownRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
* The delay for the restart to occur. Defaults to <tt>1s</tt>.
|
||||
*/
|
||||
public NodesShutdownRequestBuilder setDelay(String delay) {
|
||||
request.setDelay(delay);
|
||||
request.delay(delay);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class NodesShutdownRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
* Should the JVM be exited as well or not. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public NodesShutdownRequestBuilder setExit(boolean exit) {
|
||||
request.setExit(exit);
|
||||
request.exit(exit);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -70,4 +70,4 @@ public class NodesShutdownRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
protected void doExecute(ActionListener<NodesShutdownResponse> listener) {
|
||||
((ClusterAdminClient) client).nodesShutdown(request, listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ public class TransportNodesShutdownAction extends TransportMasterNodeOperationAc
|
|||
|
||||
NodeShutdownRequest(NodesShutdownRequest request) {
|
||||
super(request);
|
||||
this.exit = request.isExit();
|
||||
this.exit = request.exit();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,14 +86,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should indices stats be returned.
|
||||
*/
|
||||
public boolean isIndices() {
|
||||
public boolean indices() {
|
||||
return this.indices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should indices stats be returned.
|
||||
*/
|
||||
public NodesStatsRequest setIndices(boolean indices) {
|
||||
public NodesStatsRequest indices(boolean indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
@ -101,14 +101,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should the node OS be returned.
|
||||
*/
|
||||
public boolean isOs() {
|
||||
public boolean os() {
|
||||
return this.os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node OS be returned.
|
||||
*/
|
||||
public NodesStatsRequest setOs(boolean os) {
|
||||
public NodesStatsRequest os(boolean os) {
|
||||
this.os = os;
|
||||
return this;
|
||||
}
|
||||
|
@ -116,14 +116,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should the node Process be returned.
|
||||
*/
|
||||
public boolean isProcess() {
|
||||
public boolean process() {
|
||||
return this.process;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node Process be returned.
|
||||
*/
|
||||
public NodesStatsRequest setProcess(boolean process) {
|
||||
public NodesStatsRequest process(boolean process) {
|
||||
this.process = process;
|
||||
return this;
|
||||
}
|
||||
|
@ -131,14 +131,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should the node JVM be returned.
|
||||
*/
|
||||
public boolean isJvm() {
|
||||
public boolean jvm() {
|
||||
return this.jvm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node JVM be returned.
|
||||
*/
|
||||
public NodesStatsRequest setJvm(boolean jvm) {
|
||||
public NodesStatsRequest jvm(boolean jvm) {
|
||||
this.jvm = jvm;
|
||||
return this;
|
||||
}
|
||||
|
@ -146,14 +146,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should the node Thread Pool be returned.
|
||||
*/
|
||||
public boolean isThreadPool() {
|
||||
public boolean threadPool() {
|
||||
return this.threadPool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node Thread Pool be returned.
|
||||
*/
|
||||
public NodesStatsRequest setThreadPool(boolean threadPool) {
|
||||
public NodesStatsRequest threadPool(boolean threadPool) {
|
||||
this.threadPool = threadPool;
|
||||
return this;
|
||||
}
|
||||
|
@ -161,14 +161,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should the node Network be returned.
|
||||
*/
|
||||
public boolean isNetwork() {
|
||||
public boolean network() {
|
||||
return this.network;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node Network be returned.
|
||||
*/
|
||||
public NodesStatsRequest setNetwork(boolean network) {
|
||||
public NodesStatsRequest network(boolean network) {
|
||||
this.network = network;
|
||||
return this;
|
||||
}
|
||||
|
@ -176,14 +176,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should the node file system stats be returned.
|
||||
*/
|
||||
public boolean isFs() {
|
||||
public boolean fs() {
|
||||
return this.fs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node file system stats be returned.
|
||||
*/
|
||||
public NodesStatsRequest setFs(boolean fs) {
|
||||
public NodesStatsRequest fs(boolean fs) {
|
||||
this.fs = fs;
|
||||
return this;
|
||||
}
|
||||
|
@ -191,14 +191,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should the node Transport be returned.
|
||||
*/
|
||||
public boolean isTransport() {
|
||||
public boolean transport() {
|
||||
return this.transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node Transport be returned.
|
||||
*/
|
||||
public NodesStatsRequest setTransport(boolean transport) {
|
||||
public NodesStatsRequest transport(boolean transport) {
|
||||
this.transport = transport;
|
||||
return this;
|
||||
}
|
||||
|
@ -206,14 +206,14 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
/**
|
||||
* Should the node HTTP be returned.
|
||||
*/
|
||||
public boolean isHttp() {
|
||||
public boolean http() {
|
||||
return this.http;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the node HTTP be returned.
|
||||
*/
|
||||
public NodesStatsRequest setHttp(boolean http) {
|
||||
public NodesStatsRequest http(boolean http) {
|
||||
this.http = http;
|
||||
return this;
|
||||
}
|
||||
|
@ -246,4 +246,4 @@ public class NodesStatsRequest extends NodesOperationRequest<NodesStatsRequest>
|
|||
out.writeBoolean(http);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node indices stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setIndices(boolean indices) {
|
||||
request.setIndices(indices);
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node OS stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setOs(boolean os) {
|
||||
request.setOs(os);
|
||||
request.os(os);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node OS stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setProcess(boolean process) {
|
||||
request.setProcess(process);
|
||||
request.process(process);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node JVM stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setJvm(boolean jvm) {
|
||||
request.setJvm(jvm);
|
||||
request.jvm(jvm);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node thread pool stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setThreadPool(boolean threadPool) {
|
||||
request.setThreadPool(threadPool);
|
||||
request.threadPool(threadPool);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node Network stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setNetwork(boolean network) {
|
||||
request.setNetwork(network);
|
||||
request.network(network);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node file system stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setFs(boolean fs) {
|
||||
request.setFs(fs);
|
||||
request.fs(fs);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node Transport stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setTransport(boolean transport) {
|
||||
request.setTransport(transport);
|
||||
request.transport(transport);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
* Should the node HTTP stats be returned.
|
||||
*/
|
||||
public NodesStatsRequestBuilder setHttp(boolean http) {
|
||||
request.setHttp(http);
|
||||
request.http(http);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -125,4 +125,4 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
|
|||
protected void doExecute(ActionListener<NodesStatsResponse> listener) {
|
||||
((ClusterAdminClient) client).nodesStats(request, listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class TransportNodesStatsAction extends TransportNodesOperationAction<Nod
|
|||
@Override
|
||||
protected NodeStats nodeOperation(NodeStatsRequest nodeStatsRequest) throws ElasticSearchException {
|
||||
NodesStatsRequest request = nodeStatsRequest.request;
|
||||
return nodeService.stats(request.isIndices(), request.isOs(), request.isProcess(), request.isJvm(), request.isThreadPool(), request.isNetwork(), request.isFs(), request.isTransport(), request.isHttp());
|
||||
return nodeService.stats(request.indices(), request.os(), request.process(), request.jvm(), request.threadPool(), request.network(), request.fs(), request.transport(), request.http());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -130,4 +130,4 @@ public class TransportNodesStatsAction extends TransportNodesOperationAction<Nod
|
|||
request.writeTo(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ClusterRerouteRequest extends MasterNodeOperationRequest<ClusterRer
|
|||
/**
|
||||
* Sets the source for the request.
|
||||
*/
|
||||
public ClusterRerouteRequest setSource(BytesReference source) throws Exception {
|
||||
public ClusterRerouteRequest source(BytesReference source) throws Exception {
|
||||
XContentParser parser = XContentHelper.createParser(source);
|
||||
try {
|
||||
XContentParser.Token token;
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ClusterRerouteRequestBuilder extends MasterNodeOperationRequestBuil
|
|||
}
|
||||
|
||||
public ClusterRerouteRequestBuilder setSource(BytesReference source) throws Exception {
|
||||
request.setSource(source);
|
||||
request.source(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,60 +57,60 @@ public class ClusterUpdateSettingsRequest extends MasterNodeOperationRequest<Clu
|
|||
return validationException;
|
||||
}
|
||||
|
||||
public Settings getTransientSettings() {
|
||||
Settings transientSettings() {
|
||||
return transientSettings;
|
||||
}
|
||||
|
||||
public Settings getPersistentSettings() {
|
||||
Settings persistentSettings() {
|
||||
return persistentSettings;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequest setTransientSettings(Settings settings) {
|
||||
public ClusterUpdateSettingsRequest transientSettings(Settings settings) {
|
||||
this.transientSettings = settings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequest setTransientSettings(Settings.Builder settings) {
|
||||
public ClusterUpdateSettingsRequest transientSettings(Settings.Builder settings) {
|
||||
this.transientSettings = settings.build();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequest setTransientSettings(String source) {
|
||||
public ClusterUpdateSettingsRequest transientSettings(String source) {
|
||||
this.transientSettings = ImmutableSettings.settingsBuilder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequest setTransientSettings(Map source) {
|
||||
public ClusterUpdateSettingsRequest transientSettings(Map source) {
|
||||
try {
|
||||
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
|
||||
builder.map(source);
|
||||
setTransientSettings(builder.string());
|
||||
transientSettings(builder.string());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchGenerationException("Failed to generate [" + source + "]", e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequest setPersistentSettings(Settings settings) {
|
||||
public ClusterUpdateSettingsRequest persistentSettings(Settings settings) {
|
||||
this.persistentSettings = settings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequest setPersistentSettings(Settings.Builder settings) {
|
||||
public ClusterUpdateSettingsRequest persistentSettings(Settings.Builder settings) {
|
||||
this.persistentSettings = settings.build();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequest setPersistentSettings(String source) {
|
||||
public ClusterUpdateSettingsRequest persistentSettings(String source) {
|
||||
this.persistentSettings = ImmutableSettings.settingsBuilder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequest setPersistentSettings(Map source) {
|
||||
public ClusterUpdateSettingsRequest persistentSettings(Map source) {
|
||||
try {
|
||||
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
|
||||
builder.map(source);
|
||||
setPersistentSettings(builder.string());
|
||||
persistentSettings(builder.string());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchGenerationException("Failed to generate [" + source + "]", e);
|
||||
}
|
||||
|
@ -131,4 +131,4 @@ public class ClusterUpdateSettingsRequest extends MasterNodeOperationRequest<Clu
|
|||
writeSettingsToStream(transientSettings, out);
|
||||
writeSettingsToStream(persistentSettings, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,42 +36,42 @@ public class ClusterUpdateSettingsRequestBuilder extends MasterNodeOperationRequ
|
|||
}
|
||||
|
||||
public ClusterUpdateSettingsRequestBuilder setTransientSettings(Settings settings) {
|
||||
request.setTransientSettings(settings);
|
||||
request.transientSettings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequestBuilder setTransientSettings(Settings.Builder settings) {
|
||||
request.setTransientSettings(settings);
|
||||
request.transientSettings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequestBuilder setTransientSettings(String settings) {
|
||||
request.setTransientSettings(settings);
|
||||
request.transientSettings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequestBuilder setTransientSettings(Map settings) {
|
||||
request.setTransientSettings(settings);
|
||||
request.transientSettings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequestBuilder setPersistentSettings(Settings settings) {
|
||||
request.setPersistentSettings(settings);
|
||||
request.persistentSettings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequestBuilder setPersistentSettings(Settings.Builder settings) {
|
||||
request.setPersistentSettings(settings);
|
||||
request.persistentSettings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequestBuilder setPersistentSettings(String settings) {
|
||||
request.setPersistentSettings(settings);
|
||||
request.persistentSettings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterUpdateSettingsRequestBuilder setPersistentSettings(Map settings) {
|
||||
request.setPersistentSettings(settings);
|
||||
request.persistentSettings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeOpe
|
|||
boolean changed = false;
|
||||
ImmutableSettings.Builder transientSettings = ImmutableSettings.settingsBuilder();
|
||||
transientSettings.put(currentState.metaData().transientSettings());
|
||||
for (Map.Entry<String, String> entry : request.getTransientSettings().getAsMap().entrySet()) {
|
||||
for (Map.Entry<String, String> entry : request.transientSettings().getAsMap().entrySet()) {
|
||||
if (MetaData.hasDynamicSetting(entry.getKey()) || entry.getKey().startsWith("logger.")) {
|
||||
transientSettings.put(entry.getKey(), entry.getValue());
|
||||
changed = true;
|
||||
|
@ -99,7 +99,7 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeOpe
|
|||
|
||||
ImmutableSettings.Builder persistentSettings = ImmutableSettings.settingsBuilder();
|
||||
persistentSettings.put(currentState.metaData().persistentSettings());
|
||||
for (Map.Entry<String, String> entry : request.getPersistentSettings().getAsMap().entrySet()) {
|
||||
for (Map.Entry<String, String> entry : request.persistentSettings().getAsMap().entrySet()) {
|
||||
if (MetaData.hasDynamicSetting(entry.getKey()) || entry.getKey().startsWith("logger.")) {
|
||||
changed = true;
|
||||
persistentSettings.put(entry.getKey(), entry.getValue());
|
||||
|
|
|
@ -64,66 +64,66 @@ public class ClusterStateRequest extends MasterNodeOperationRequest<ClusterState
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isFilterRoutingTable() {
|
||||
public boolean filterRoutingTable() {
|
||||
return filterRoutingTable;
|
||||
}
|
||||
|
||||
public ClusterStateRequest setFilterRoutingTable(boolean filterRoutingTable) {
|
||||
public ClusterStateRequest filterRoutingTable(boolean filterRoutingTable) {
|
||||
this.filterRoutingTable = filterRoutingTable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFilterNodes() {
|
||||
public boolean filterNodes() {
|
||||
return filterNodes;
|
||||
}
|
||||
|
||||
public ClusterStateRequest setFilterNodes(boolean filterNodes) {
|
||||
public ClusterStateRequest filterNodes(boolean filterNodes) {
|
||||
this.filterNodes = filterNodes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFilterMetaData() {
|
||||
public boolean filterMetaData() {
|
||||
return filterMetaData;
|
||||
}
|
||||
|
||||
public ClusterStateRequest setFilterMetaData(boolean filterMetaData) {
|
||||
public ClusterStateRequest filterMetaData(boolean filterMetaData) {
|
||||
this.filterMetaData = filterMetaData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFilterBlocks() {
|
||||
public boolean filterBlocks() {
|
||||
return filterBlocks;
|
||||
}
|
||||
|
||||
public ClusterStateRequest setFilterBlocks(boolean filterBlocks) {
|
||||
public ClusterStateRequest filterBlocks(boolean filterBlocks) {
|
||||
this.filterBlocks = filterBlocks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] getFilteredIndices() {
|
||||
public String[] filteredIndices() {
|
||||
return filteredIndices;
|
||||
}
|
||||
|
||||
public ClusterStateRequest setFilteredIndices(String... filteredIndices) {
|
||||
public ClusterStateRequest filteredIndices(String... filteredIndices) {
|
||||
this.filteredIndices = filteredIndices;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] getFilteredIndexTemplates() {
|
||||
public String[] filteredIndexTemplates() {
|
||||
return this.filteredIndexTemplates;
|
||||
}
|
||||
|
||||
public ClusterStateRequest setFilteredIndexTemplates(String... filteredIndexTemplates) {
|
||||
public ClusterStateRequest filteredIndexTemplates(String... filteredIndexTemplates) {
|
||||
this.filteredIndexTemplates = filteredIndexTemplates;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterStateRequest setLocal(boolean local) {
|
||||
public ClusterStateRequest local(boolean local) {
|
||||
this.local = local;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
public boolean local() {
|
||||
return this.local;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ClusterStateRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
}
|
||||
|
||||
public ClusterStateRequestBuilder setFilterBlocks(boolean filter) {
|
||||
request.setFilterBlocks(filter);
|
||||
request.filterBlocks(filter);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class ClusterStateRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
* to <tt>false</tt>.
|
||||
*/
|
||||
public ClusterStateRequestBuilder setFilterMetaData(boolean filter) {
|
||||
request.setFilterMetaData(filter);
|
||||
request.filterMetaData(filter);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class ClusterStateRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
* to <tt>false</tt>.
|
||||
*/
|
||||
public ClusterStateRequestBuilder setFilterNodes(boolean filter) {
|
||||
request.setFilterNodes(filter);
|
||||
request.filterNodes(filter);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class ClusterStateRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
* to <tt>false</tt>.
|
||||
*/
|
||||
public ClusterStateRequestBuilder setFilterRoutingTable(boolean filter) {
|
||||
request.setFilterRoutingTable(filter);
|
||||
request.filterRoutingTable(filter);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -78,12 +78,12 @@ public class ClusterStateRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
* for. Defaults to all indices.
|
||||
*/
|
||||
public ClusterStateRequestBuilder setFilterIndices(String... indices) {
|
||||
request.setFilteredIndices(indices);
|
||||
request.filteredIndices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClusterStateRequestBuilder setFilterIndexTemplates(String... templates) {
|
||||
request.setFilteredIndexTemplates(templates);
|
||||
request.filteredIndexTemplates(templates);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class ClusterStateRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
* Sets if the cluster state request should be executed locally on the node, and not go to the master.
|
||||
*/
|
||||
public ClusterStateRequestBuilder setLocal(boolean local) {
|
||||
request.setLocal(local);
|
||||
request.local(local);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,31 +71,31 @@ public class TransportClusterStateAction extends TransportMasterNodeOperationAct
|
|||
|
||||
@Override
|
||||
protected boolean localExecute(ClusterStateRequest request) {
|
||||
return request.isLocal();
|
||||
return request.local();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClusterStateResponse masterOperation(ClusterStateRequest request, ClusterState state) throws ElasticSearchException {
|
||||
ClusterState currentState = clusterService.state();
|
||||
ClusterState.Builder builder = newClusterStateBuilder();
|
||||
if (!request.isFilterNodes()) {
|
||||
if (!request.filterNodes()) {
|
||||
builder.nodes(currentState.nodes());
|
||||
}
|
||||
if (!request.isFilterRoutingTable()) {
|
||||
if (!request.filterRoutingTable()) {
|
||||
builder.routingTable(currentState.routingTable());
|
||||
builder.allocationExplanation(currentState.allocationExplanation());
|
||||
}
|
||||
if (!request.isFilterBlocks()) {
|
||||
if (!request.filterBlocks()) {
|
||||
builder.blocks(currentState.blocks());
|
||||
}
|
||||
if (!request.isFilterMetaData()) {
|
||||
if (!request.filterMetaData()) {
|
||||
MetaData.Builder mdBuilder = newMetaDataBuilder();
|
||||
if (request.getFilteredIndices().length == 0 && request.getFilteredIndexTemplates().length == 0) {
|
||||
if (request.filteredIndices().length == 0 && request.filteredIndexTemplates().length == 0) {
|
||||
mdBuilder.metaData(currentState.metaData());
|
||||
}
|
||||
|
||||
if (request.getFilteredIndices().length > 0) {
|
||||
String[] indices = currentState.metaData().concreteIndicesIgnoreMissing(request.getFilteredIndices());
|
||||
if (request.filteredIndices().length > 0) {
|
||||
String[] indices = currentState.metaData().concreteIndicesIgnoreMissing(request.filteredIndices());
|
||||
for (String filteredIndex : indices) {
|
||||
IndexMetaData indexMetaData = currentState.metaData().index(filteredIndex);
|
||||
if (indexMetaData != null) {
|
||||
|
@ -104,8 +104,8 @@ public class TransportClusterStateAction extends TransportMasterNodeOperationAct
|
|||
}
|
||||
}
|
||||
|
||||
if (request.getFilteredIndexTemplates().length > 0) {
|
||||
for (String templateName : request.getFilteredIndexTemplates()) {
|
||||
if (request.filteredIndexTemplates().length > 0) {
|
||||
for (String templateName : request.filteredIndexTemplates()) {
|
||||
IndexTemplateMetaData indexTemplateMetaData = currentState.metaData().templates().get(templateName);
|
||||
if (indexTemplateMetaData != null) {
|
||||
mdBuilder.put(indexTemplateMetaData);
|
||||
|
@ -117,4 +117,4 @@ public class TransportClusterStateAction extends TransportMasterNodeOperationAct
|
|||
}
|
||||
return new ClusterStateResponse(clusterName, builder.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ public class IndicesAliasesRequest extends MasterNodeOperationRequest<IndicesAli
|
|||
return this;
|
||||
}
|
||||
|
||||
public List<AliasAction> getAliasActions() {
|
||||
List<AliasAction> aliasActions() {
|
||||
return this.aliasActions;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class IndicesAliasesRequest extends MasterNodeOperationRequest<IndicesAli
|
|||
* Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to
|
||||
* <tt>10s</tt>.
|
||||
*/
|
||||
public TimeValue getTimeout() {
|
||||
TimeValue timeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class IndicesAliasesRequest extends MasterNodeOperationRequest<IndicesAli
|
|||
* Timeout to wait till the alias operations get acknowledged of all current cluster nodes. Defaults to
|
||||
* <tt>10s</tt>.
|
||||
*/
|
||||
public IndicesAliasesRequest setTimeout(TimeValue timeout) {
|
||||
public IndicesAliasesRequest timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ public class IndicesAliasesRequest extends MasterNodeOperationRequest<IndicesAli
|
|||
* Timeout to wait till the alias operations get acknowledged of all current cluster nodes. Defaults to
|
||||
* <tt>10s</tt>.
|
||||
*/
|
||||
public IndicesAliasesRequest setTimeout(String timeout) {
|
||||
return setTimeout(TimeValue.parseTimeValue(timeout, TimeValue.timeValueSeconds(10)));
|
||||
public IndicesAliasesRequest timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, TimeValue.timeValueSeconds(10)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -112,7 +112,7 @@ public class IndicesAliasesRequestBuilder extends MasterNodeOperationRequestBuil
|
|||
* @param timeout
|
||||
*/
|
||||
public IndicesAliasesRequestBuilder setTimeout(TimeValue timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeOperationA
|
|||
@Override
|
||||
protected ClusterBlockException checkBlock(IndicesAliasesRequest request, ClusterState state) {
|
||||
Set<String> indices = Sets.newHashSet();
|
||||
for (AliasAction aliasAction : request.getAliasActions()) {
|
||||
for (AliasAction aliasAction : request.aliasActions()) {
|
||||
indices.add(aliasAction.index());
|
||||
}
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, indices.toArray(new String[indices.size()]));
|
||||
|
@ -85,7 +85,7 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeOperationA
|
|||
final AtomicReference<IndicesAliasesResponse> responseRef = new AtomicReference<IndicesAliasesResponse>();
|
||||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
indexAliasesService.indicesAliases(new MetaDataIndexAliasesService.Request(request.getAliasActions().toArray(new AliasAction[request.getAliasActions().size()]), request.getTimeout()), new MetaDataIndexAliasesService.Listener() {
|
||||
indexAliasesService.indicesAliases(new MetaDataIndexAliasesService.Request(request.aliasActions().toArray(new AliasAction[request.aliasActions().size()]), request.timeout()), new MetaDataIndexAliasesService.Listener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataIndexAliasesService.Response response) {
|
||||
responseRef.set(new IndicesAliasesResponse(response.acknowledged()));
|
||||
|
|
|
@ -71,52 +71,52 @@ public class AnalyzeRequest extends SingleCustomOperationRequest<AnalyzeRequest>
|
|||
this.text = text;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
public String text() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public AnalyzeRequest setIndex(String index) {
|
||||
public AnalyzeRequest index(String index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIndex() {
|
||||
public String index() {
|
||||
return this.index;
|
||||
}
|
||||
|
||||
public AnalyzeRequest setAnalyzer(String analyzer) {
|
||||
public AnalyzeRequest analyzer(String analyzer) {
|
||||
this.analyzer = analyzer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAnalyzer() {
|
||||
public String analyzer() {
|
||||
return this.analyzer;
|
||||
}
|
||||
|
||||
public AnalyzeRequest setTokenizer(String tokenizer) {
|
||||
public AnalyzeRequest tokenizer(String tokenizer) {
|
||||
this.tokenizer = tokenizer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTokenizer() {
|
||||
public String tokenizer() {
|
||||
return this.tokenizer;
|
||||
}
|
||||
|
||||
public AnalyzeRequest setTokenFilters(String... tokenFilters) {
|
||||
public AnalyzeRequest tokenFilters(String... tokenFilters) {
|
||||
this.tokenFilters = tokenFilters;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] getTokenFilters() {
|
||||
public String[] tokenFilters() {
|
||||
return this.tokenFilters;
|
||||
}
|
||||
|
||||
public AnalyzeRequest setField(String field) {
|
||||
public AnalyzeRequest field(String field) {
|
||||
this.field = field;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getField() {
|
||||
public String field() {
|
||||
return this.field;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<A
|
|||
* registered).
|
||||
*/
|
||||
public AnalyzeRequestBuilder setIndex(String index) {
|
||||
request.setIndex(index);
|
||||
request.index(index);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<A
|
|||
* @param analyzer The analyzer name.
|
||||
*/
|
||||
public AnalyzeRequestBuilder setAnalyzer(String analyzer) {
|
||||
request.setAnalyzer(analyzer);
|
||||
request.analyzer(analyzer);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<A
|
|||
* to be set.
|
||||
*/
|
||||
public AnalyzeRequestBuilder setField(String field) {
|
||||
request.setField(field);
|
||||
request.field(field);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<A
|
|||
* analyzer.
|
||||
*/
|
||||
public AnalyzeRequestBuilder setTokenizer(String tokenizer) {
|
||||
request.setTokenizer(tokenizer);
|
||||
request.tokenizer(tokenizer);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<A
|
|||
* Sets token filters that will be used on top of a tokenizer provided.
|
||||
*/
|
||||
public AnalyzeRequestBuilder setTokenFilters(String... tokenFilters) {
|
||||
request.setTokenFilters(tokenFilters);
|
||||
request.tokenFilters(tokenFilters);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,36 +95,36 @@ public class TransportAnalyzeAction extends TransportSingleCustomOperationAction
|
|||
|
||||
@Override
|
||||
protected ClusterBlockException checkRequestBlock(ClusterState state, AnalyzeRequest request) {
|
||||
if (request.getIndex() != null) {
|
||||
request.setIndex(state.metaData().concreteIndex(request.getIndex()));
|
||||
return state.blocks().indexBlockedException(ClusterBlockLevel.READ, request.getIndex());
|
||||
if (request.index() != null) {
|
||||
request.index(state.metaData().concreteIndex(request.index()));
|
||||
return state.blocks().indexBlockedException(ClusterBlockLevel.READ, request.index());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShardsIterator shards(ClusterState state, AnalyzeRequest request) {
|
||||
if (request.getIndex() == null) {
|
||||
if (request.index() == null) {
|
||||
// just execute locally....
|
||||
return null;
|
||||
}
|
||||
return state.routingTable().index(request.getIndex()).randomAllActiveShardsIt();
|
||||
return state.routingTable().index(request.index()).randomAllActiveShardsIt();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AnalyzeResponse shardOperation(AnalyzeRequest request, int shardId) throws ElasticSearchException {
|
||||
IndexService indexService = null;
|
||||
if (request.getIndex() != null) {
|
||||
indexService = indicesService.indexServiceSafe(request.getIndex());
|
||||
if (request.index() != null) {
|
||||
indexService = indicesService.indexServiceSafe(request.index());
|
||||
}
|
||||
Analyzer analyzer = null;
|
||||
boolean closeAnalyzer = false;
|
||||
String field = null;
|
||||
if (request.getField() != null) {
|
||||
if (request.field() != null) {
|
||||
if (indexService == null) {
|
||||
throw new ElasticSearchIllegalArgumentException("No index provided, and trying to analyzer based on a specific field which requires the index parameter");
|
||||
}
|
||||
FieldMapper fieldMapper = indexService.mapperService().smartNameFieldMapper(request.getField());
|
||||
FieldMapper fieldMapper = indexService.mapperService().smartNameFieldMapper(request.field());
|
||||
if (fieldMapper != null) {
|
||||
analyzer = fieldMapper.indexAnalyzer();
|
||||
field = fieldMapper.names().indexName();
|
||||
|
@ -137,48 +137,48 @@ public class TransportAnalyzeAction extends TransportSingleCustomOperationAction
|
|||
field = AllFieldMapper.NAME;
|
||||
}
|
||||
}
|
||||
if (analyzer == null && request.getAnalyzer() != null) {
|
||||
if (analyzer == null && request.analyzer() != null) {
|
||||
if (indexService == null) {
|
||||
analyzer = indicesAnalysisService.analyzer(request.getAnalyzer());
|
||||
analyzer = indicesAnalysisService.analyzer(request.analyzer());
|
||||
} else {
|
||||
analyzer = indexService.analysisService().analyzer(request.getAnalyzer());
|
||||
analyzer = indexService.analysisService().analyzer(request.analyzer());
|
||||
}
|
||||
if (analyzer == null) {
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find analyzer [" + request.getAnalyzer() + "]");
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find analyzer [" + request.analyzer() + "]");
|
||||
}
|
||||
} else if (request.getTokenizer() != null) {
|
||||
} else if (request.tokenizer() != null) {
|
||||
TokenizerFactory tokenizerFactory;
|
||||
if (indexService == null) {
|
||||
TokenizerFactoryFactory tokenizerFactoryFactory = indicesAnalysisService.tokenizerFactoryFactory(request.getTokenizer());
|
||||
TokenizerFactoryFactory tokenizerFactoryFactory = indicesAnalysisService.tokenizerFactoryFactory(request.tokenizer());
|
||||
if (tokenizerFactoryFactory == null) {
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find global tokenizer under [" + request.getTokenizer() + "]");
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find global tokenizer under [" + request.tokenizer() + "]");
|
||||
}
|
||||
tokenizerFactory = tokenizerFactoryFactory.create(request.getTokenizer(), ImmutableSettings.Builder.EMPTY_SETTINGS);
|
||||
tokenizerFactory = tokenizerFactoryFactory.create(request.tokenizer(), ImmutableSettings.Builder.EMPTY_SETTINGS);
|
||||
} else {
|
||||
tokenizerFactory = indexService.analysisService().tokenizer(request.getTokenizer());
|
||||
tokenizerFactory = indexService.analysisService().tokenizer(request.tokenizer());
|
||||
if (tokenizerFactory == null) {
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find tokenizer under [" + request.getTokenizer() + "]");
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find tokenizer under [" + request.tokenizer() + "]");
|
||||
}
|
||||
}
|
||||
TokenFilterFactory[] tokenFilterFactories = new TokenFilterFactory[0];
|
||||
if (request.getTokenFilters() != null && request.getTokenFilters().length > 0) {
|
||||
tokenFilterFactories = new TokenFilterFactory[request.getTokenFilters().length];
|
||||
for (int i = 0; i < request.getTokenFilters().length; i++) {
|
||||
String tokenFilterName = request.getTokenFilters()[i];
|
||||
if (request.tokenFilters() != null && request.tokenFilters().length > 0) {
|
||||
tokenFilterFactories = new TokenFilterFactory[request.tokenFilters().length];
|
||||
for (int i = 0; i < request.tokenFilters().length; i++) {
|
||||
String tokenFilterName = request.tokenFilters()[i];
|
||||
if (indexService == null) {
|
||||
TokenFilterFactoryFactory tokenFilterFactoryFactory = indicesAnalysisService.tokenFilterFactoryFactory(tokenFilterName);
|
||||
if (tokenFilterFactoryFactory == null) {
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find global token filter under [" + request.getTokenizer() + "]");
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find global token filter under [" + request.tokenizer() + "]");
|
||||
}
|
||||
tokenFilterFactories[i] = tokenFilterFactoryFactory.create(tokenFilterName, ImmutableSettings.Builder.EMPTY_SETTINGS);
|
||||
} else {
|
||||
tokenFilterFactories[i] = indexService.analysisService().tokenFilter(tokenFilterName);
|
||||
if (tokenFilterFactories[i] == null) {
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find token filter under [" + request.getTokenizer() + "]");
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find token filter under [" + request.tokenizer() + "]");
|
||||
}
|
||||
}
|
||||
if (tokenFilterFactories[i] == null) {
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find token filter under [" + request.getTokenizer() + "]");
|
||||
throw new ElasticSearchIllegalArgumentException("failed to find token filter under [" + request.tokenizer() + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ public class TransportAnalyzeAction extends TransportSingleCustomOperationAction
|
|||
List<AnalyzeResponse.AnalyzeToken> tokens = Lists.newArrayList();
|
||||
TokenStream stream = null;
|
||||
try {
|
||||
stream = analyzer.tokenStream(field, new FastStringReader(request.getText()));
|
||||
stream = analyzer.tokenStream(field, new FastStringReader(request.text()));
|
||||
stream.reset();
|
||||
CharTermAttribute term = stream.addAttribute(CharTermAttribute.class);
|
||||
PositionIncrementAttribute posIncr = stream.addAttribute(PositionIncrementAttribute.class);
|
||||
|
|
|
@ -43,50 +43,50 @@ public class ClearIndicesCacheRequest extends BroadcastOperationRequest<ClearInd
|
|||
public ClearIndicesCacheRequest(String... indices) {
|
||||
super(indices);
|
||||
// we want to do the refresh in parallel on local shards...
|
||||
setOperationThreading(BroadcastOperationThreading.THREAD_PER_SHARD);
|
||||
operationThreading(BroadcastOperationThreading.THREAD_PER_SHARD);
|
||||
}
|
||||
|
||||
public boolean isFilterCache() {
|
||||
public boolean filterCache() {
|
||||
return filterCache;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequest setFilterCache(boolean filterCache) {
|
||||
public ClearIndicesCacheRequest filterCache(boolean filterCache) {
|
||||
this.filterCache = filterCache;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFieldDataCache() {
|
||||
public boolean fieldDataCache() {
|
||||
return this.fieldDataCache;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequest setFieldDataCache(boolean fieldDataCache) {
|
||||
public ClearIndicesCacheRequest fieldDataCache(boolean fieldDataCache) {
|
||||
this.fieldDataCache = fieldDataCache;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequest setFields(String... fields) {
|
||||
public ClearIndicesCacheRequest fields(String... fields) {
|
||||
this.fields = fields;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] getFields() {
|
||||
public String[] fields() {
|
||||
return this.fields;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequest setFilterKeys(String... filterKeys) {
|
||||
public ClearIndicesCacheRequest filterKeys(String... filterKeys) {
|
||||
this.filterKeys = filterKeys;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] getFilterKeys() {
|
||||
public String[] filterKeys() {
|
||||
return this.filterKeys;
|
||||
}
|
||||
|
||||
public boolean isIdCache() {
|
||||
public boolean idCache() {
|
||||
return this.idCache;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequest setIdCache(boolean idCache) {
|
||||
public ClearIndicesCacheRequest idCache(boolean idCache) {
|
||||
this.idCache = idCache;
|
||||
return this;
|
||||
}
|
||||
|
@ -108,4 +108,4 @@ public class ClearIndicesCacheRequest extends BroadcastOperationRequest<ClearInd
|
|||
out.writeStringArrayNullable(fields);
|
||||
out.writeStringArrayNullable(filterKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,27 +34,27 @@ public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBu
|
|||
}
|
||||
|
||||
public ClearIndicesCacheRequestBuilder setFilterCache(boolean filterCache) {
|
||||
request.setFilterCache(filterCache);
|
||||
request.filterCache(filterCache);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequestBuilder setFieldDataCache(boolean fieldDataCache) {
|
||||
request.setFieldDataCache(fieldDataCache);
|
||||
request.fieldDataCache(fieldDataCache);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequestBuilder setFields(String... fields) {
|
||||
request.setFields(fields);
|
||||
request.fields(fields);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequestBuilder setFilterKeys(String... filterKeys) {
|
||||
request.setFilterKeys(filterKeys);
|
||||
request.filterKeys(filterKeys);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ClearIndicesCacheRequestBuilder setIdCache(boolean idCache) {
|
||||
request.setIdCache(idCache);
|
||||
request.idCache(idCache);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,30 +41,30 @@ class ShardClearIndicesCacheRequest extends BroadcastShardOperationRequest {
|
|||
|
||||
public ShardClearIndicesCacheRequest(String index, int shardId, ClearIndicesCacheRequest request) {
|
||||
super(index, shardId, request);
|
||||
filterCache = request.isFilterCache();
|
||||
fieldDataCache = request.isFieldDataCache();
|
||||
idCache = request.isIdCache();
|
||||
fields = request.getFields();
|
||||
filterKeys = request.getFilterKeys();
|
||||
filterCache = request.filterCache();
|
||||
fieldDataCache = request.fieldDataCache();
|
||||
idCache = request.idCache();
|
||||
fields = request.fields();
|
||||
filterKeys = request.filterKeys();
|
||||
}
|
||||
|
||||
public boolean isFilterCache() {
|
||||
public boolean filterCache() {
|
||||
return filterCache;
|
||||
}
|
||||
|
||||
public boolean isFieldDataCache() {
|
||||
public boolean fieldDataCache() {
|
||||
return this.fieldDataCache;
|
||||
}
|
||||
|
||||
public boolean isIdCache() {
|
||||
public boolean idCache() {
|
||||
return this.idCache;
|
||||
}
|
||||
|
||||
public String[] getFields() {
|
||||
public String[] fields() {
|
||||
return this.fields;
|
||||
}
|
||||
|
||||
public String[] getFilterKeys() {
|
||||
public String[] filterKeys() {
|
||||
return this.filterKeys;
|
||||
}
|
||||
|
||||
|
@ -92,4 +92,4 @@ class ShardClearIndicesCacheRequest extends BroadcastShardOperationRequest {
|
|||
out.writeStringArrayNullable(fields);
|
||||
out.writeStringArrayNullable(filterKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,39 +118,39 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
|||
|
||||
@Override
|
||||
protected ShardClearIndicesCacheResponse shardOperation(ShardClearIndicesCacheRequest request) throws ElasticSearchException {
|
||||
IndexService service = indicesService.indexService(request.getIndex());
|
||||
IndexService service = indicesService.indexService(request.index());
|
||||
if (service != null) {
|
||||
// we always clear the query cache
|
||||
service.cache().queryParserCache().clear();
|
||||
boolean clearedAtLeastOne = false;
|
||||
if (request.isFilterCache()) {
|
||||
if (request.filterCache()) {
|
||||
clearedAtLeastOne = true;
|
||||
service.cache().filter().clear("api");
|
||||
termsFilterCache.clear("api");
|
||||
}
|
||||
if (request.getFilterKeys() != null && request.getFilterKeys().length > 0) {
|
||||
if (request.filterKeys() != null && request.filterKeys().length > 0) {
|
||||
clearedAtLeastOne = true;
|
||||
service.cache().filter().clear("api", request.getFilterKeys());
|
||||
termsFilterCache.clear("api", request.getFilterKeys());
|
||||
service.cache().filter().clear("api", request.filterKeys());
|
||||
termsFilterCache.clear("api", request.filterKeys());
|
||||
}
|
||||
if (request.isFieldDataCache()) {
|
||||
if (request.fieldDataCache()) {
|
||||
clearedAtLeastOne = true;
|
||||
if (request.getFields() == null || request.getFields().length == 0) {
|
||||
if (request.fields() == null || request.fields().length == 0) {
|
||||
service.fieldData().clear();
|
||||
} else {
|
||||
for (String field : request.getFields()) {
|
||||
for (String field : request.fields()) {
|
||||
service.fieldData().clearField(field);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (request.isIdCache()) {
|
||||
if (request.idCache()) {
|
||||
clearedAtLeastOne = true;
|
||||
service.cache().idCache().clear();
|
||||
}
|
||||
if (!clearedAtLeastOne) {
|
||||
if (request.getFields() != null && request.getFields().length > 0) {
|
||||
if (request.fields() != null && request.fields().length > 0) {
|
||||
// only clear caches relating to the specified fields
|
||||
for (String field : request.getFields()) {
|
||||
for (String field : request.fields()) {
|
||||
service.fieldData().clearField(field);
|
||||
}
|
||||
} else {
|
||||
|
@ -160,7 +160,7 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
|||
}
|
||||
service.cache().invalidateStatsCache();
|
||||
}
|
||||
return new ShardClearIndicesCacheResponse(request.getIndex(), request.getShardId());
|
||||
return new ShardClearIndicesCacheResponse(request.index(), request.shardId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,4 +181,4 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
|||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, concreteIndices);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,11 +62,11 @@ public class CloseIndexRequest extends MasterNodeOperationRequest<CloseIndexRequ
|
|||
/**
|
||||
* The index to delete.
|
||||
*/
|
||||
String getIndex() {
|
||||
String index() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public CloseIndexRequest setIndex(String index) {
|
||||
public CloseIndexRequest index(String index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class CloseIndexRequest extends MasterNodeOperationRequest<CloseIndexRequ
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
TimeValue getTimeout() {
|
||||
TimeValue timeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class CloseIndexRequest extends MasterNodeOperationRequest<CloseIndexRequ
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public CloseIndexRequest setTimeout(TimeValue timeout) {
|
||||
public CloseIndexRequest timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ public class CloseIndexRequest extends MasterNodeOperationRequest<CloseIndexRequ
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public CloseIndexRequest setTimeout(String timeout) {
|
||||
return setTimeout(TimeValue.parseTimeValue(timeout, null));
|
||||
public CloseIndexRequest timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -109,4 +109,4 @@ public class CloseIndexRequest extends MasterNodeOperationRequest<CloseIndexRequ
|
|||
out.writeString(index);
|
||||
timeout.writeTo(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class CloseIndexRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
}
|
||||
|
||||
public CloseIndexRequestBuilder setIndex(String index) {
|
||||
request.setIndex(index);
|
||||
request.index(index);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class CloseIndexRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public CloseIndexRequestBuilder setTimeout(TimeValue timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class CloseIndexRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public CloseIndexRequestBuilder setTimeout(String timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ public class TransportCloseIndexAction extends TransportMasterNodeOperationActio
|
|||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(CloseIndexRequest request, ClusterState state) {
|
||||
request.setIndex(clusterService.state().metaData().concreteIndex(request.getIndex()));
|
||||
return state.blocks().indexBlockedException(ClusterBlockLevel.METADATA, request.getIndex());
|
||||
request.index(clusterService.state().metaData().concreteIndex(request.index()));
|
||||
return state.blocks().indexBlockedException(ClusterBlockLevel.METADATA, request.index());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,7 @@ public class TransportCloseIndexAction extends TransportMasterNodeOperationActio
|
|||
final AtomicReference<CloseIndexResponse> responseRef = new AtomicReference<CloseIndexResponse>();
|
||||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
stateIndexService.closeIndex(new MetaDataStateIndexService.Request(request.getIndex()).timeout(request.getTimeout()), new MetaDataStateIndexService.Listener() {
|
||||
stateIndexService.closeIndex(new MetaDataStateIndexService.Request(request.index()).timeout(request.timeout()), new MetaDataStateIndexService.Listener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataStateIndexService.Response response) {
|
||||
responseRef.set(new CloseIndexResponse(response.acknowledged()));
|
||||
|
|
|
@ -52,7 +52,7 @@ import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
|
|||
/**
|
||||
* A request to create an index. Best created with {@link org.elasticsearch.client.Requests#createIndexRequest(String)}.
|
||||
* <p/>
|
||||
* <p>The index created can optionally be created with {@link #setSettings(org.elasticsearch.common.settings.Settings)}.
|
||||
* <p>The index created can optionally be created with {@link #settings(org.elasticsearch.common.settings.Settings)}.
|
||||
*
|
||||
* @see org.elasticsearch.client.IndicesAdminClient#create(CreateIndexRequest)
|
||||
* @see org.elasticsearch.client.Requests#createIndexRequest(String)
|
||||
|
@ -102,11 +102,11 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* The index name to create.
|
||||
*/
|
||||
String getIndex() {
|
||||
String index() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public CreateIndexRequest setIndex(String index) {
|
||||
public CreateIndexRequest index(String index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
}
|
||||
|
@ -114,21 +114,21 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* The settings to created the index with.
|
||||
*/
|
||||
Settings getSettings() {
|
||||
Settings settings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* The cause for this index creation.
|
||||
*/
|
||||
String getCause() {
|
||||
String cause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* The settings to created the index with.
|
||||
*/
|
||||
public CreateIndexRequest setSettings(Settings settings) {
|
||||
public CreateIndexRequest settings(Settings settings) {
|
||||
this.settings = settings;
|
||||
return this;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* The settings to created the index with.
|
||||
*/
|
||||
public CreateIndexRequest setSettings(Settings.Builder settings) {
|
||||
public CreateIndexRequest settings(Settings.Builder settings) {
|
||||
this.settings = settings.build();
|
||||
return this;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* The settings to crete the index with (either json/yaml/properties format)
|
||||
*/
|
||||
public CreateIndexRequest setSettings(String source) {
|
||||
public CreateIndexRequest settings(String source) {
|
||||
this.settings = ImmutableSettings.settingsBuilder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
@ -152,9 +152,9 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* Allows to set the settings using a json builder.
|
||||
*/
|
||||
public CreateIndexRequest setSettings(XContentBuilder builder) {
|
||||
public CreateIndexRequest settings(XContentBuilder builder) {
|
||||
try {
|
||||
setSettings(builder.string());
|
||||
settings(builder.string());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchGenerationException("Failed to generate json settings from builder", e);
|
||||
}
|
||||
|
@ -164,11 +164,11 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* The settings to crete the index with (either json/yaml/properties format)
|
||||
*/
|
||||
public CreateIndexRequest setSettings(Map source) {
|
||||
public CreateIndexRequest settings(Map source) {
|
||||
try {
|
||||
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
|
||||
builder.map(source);
|
||||
setSettings(builder.string());
|
||||
settings(builder.string());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchGenerationException("Failed to generate [" + source + "]", e);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
* @param type The mapping type
|
||||
* @param source The mapping source
|
||||
*/
|
||||
public CreateIndexRequest addMapping(String type, String source) {
|
||||
public CreateIndexRequest mapping(String type, String source) {
|
||||
mappings.put(type, source);
|
||||
return this;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* The cause for this index creation.
|
||||
*/
|
||||
public CreateIndexRequest setCause(String cause) {
|
||||
public CreateIndexRequest cause(String cause) {
|
||||
this.cause = cause;
|
||||
return this;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
* @param type The mapping type
|
||||
* @param source The mapping source
|
||||
*/
|
||||
public CreateIndexRequest addMapping(String type, XContentBuilder source) {
|
||||
public CreateIndexRequest mapping(String type, XContentBuilder source) {
|
||||
try {
|
||||
mappings.put(type, source.string());
|
||||
} catch (IOException e) {
|
||||
|
@ -215,7 +215,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
* @param type The mapping type
|
||||
* @param source The mapping source
|
||||
*/
|
||||
public CreateIndexRequest addMapping(String type, Map source) {
|
||||
public CreateIndexRequest mapping(String type, Map source) {
|
||||
// wrap it in a type map if its not
|
||||
if (source.size() != 1 || !source.containsKey(type)) {
|
||||
source = MapBuilder.<String, Object>newMapBuilder().put(type, source).map();
|
||||
|
@ -223,7 +223,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
try {
|
||||
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
|
||||
builder.map(source);
|
||||
return addMapping(type, builder.string());
|
||||
return mapping(type, builder.string());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchGenerationException("Failed to generate [" + source + "]", e);
|
||||
}
|
||||
|
@ -232,41 +232,41 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequest setSource(String source) {
|
||||
return setSource(source.getBytes(Charsets.UTF_8));
|
||||
public CreateIndexRequest source(String source) {
|
||||
return source(source.getBytes(Charsets.UTF_8));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequest setSource(XContentBuilder source) {
|
||||
return setSource(source.bytes());
|
||||
public CreateIndexRequest source(XContentBuilder source) {
|
||||
return source(source.bytes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequest setSource(byte[] source) {
|
||||
return setSource(source, 0, source.length);
|
||||
public CreateIndexRequest source(byte[] source) {
|
||||
return source(source, 0, source.length);
|
||||
}
|
||||
|
||||
public CreateIndexRequest setSource(byte[] source, int offset, int length) {
|
||||
return setSource(new BytesArray(source, offset, length));
|
||||
public CreateIndexRequest source(byte[] source, int offset, int length) {
|
||||
return source(new BytesArray(source, offset, length));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequest setSource(BytesReference source) {
|
||||
public CreateIndexRequest source(BytesReference source) {
|
||||
XContentType xContentType = XContentFactory.xContentType(source);
|
||||
if (xContentType != null) {
|
||||
try {
|
||||
setSource(XContentFactory.xContent(xContentType).createParser(source).mapAndClose());
|
||||
source(XContentFactory.xContent(xContentType).createParser(source).mapAndClose());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchParseException("failed to parse source for create index", e);
|
||||
}
|
||||
} else {
|
||||
setSettings(new String(source.toBytes(), Charsets.UTF_8));
|
||||
settings(new String(source.toBytes(), Charsets.UTF_8));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -274,18 +274,18 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
/**
|
||||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequest setSource(Map<String, Object> source) {
|
||||
public CreateIndexRequest source(Map<String, Object> source) {
|
||||
boolean found = false;
|
||||
for (Map.Entry<String, Object> entry : source.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
if (name.equals("settings")) {
|
||||
found = true;
|
||||
setSettings((Map<String, Object>) entry.getValue());
|
||||
settings((Map<String, Object>) entry.getValue());
|
||||
} else if (name.equals("mappings")) {
|
||||
found = true;
|
||||
Map<String, Object> mappings = (Map<String, Object>) entry.getValue();
|
||||
for (Map.Entry<String, Object> entry1 : mappings.entrySet()) {
|
||||
addMapping(entry1.getKey(), (Map<String, Object>) entry1.getValue());
|
||||
mapping(entry1.getKey(), (Map<String, Object>) entry1.getValue());
|
||||
}
|
||||
} else {
|
||||
// maybe custom?
|
||||
|
@ -302,21 +302,21 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
}
|
||||
if (!found) {
|
||||
// the top level are settings, use them
|
||||
setSettings(source);
|
||||
settings(source);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
Map<String, String> getMappings() {
|
||||
Map<String, String> mappings() {
|
||||
return this.mappings;
|
||||
}
|
||||
|
||||
public CreateIndexRequest addCustom(IndexMetaData.Custom custom) {
|
||||
public CreateIndexRequest custom(IndexMetaData.Custom custom) {
|
||||
customs.put(custom.type(), custom);
|
||||
return this;
|
||||
}
|
||||
|
||||
Map<String, IndexMetaData.Custom> getCustoms() {
|
||||
Map<String, IndexMetaData.Custom> customs() {
|
||||
return this.customs;
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
* Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
TimeValue getTimeout() {
|
||||
TimeValue timeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
* Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public CreateIndexRequest setTimeout(TimeValue timeout) {
|
||||
public CreateIndexRequest timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
@ -341,8 +341,8 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
* Timeout to wait for the index creation to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public CreateIndexRequest setTimeout(String timeout) {
|
||||
return setTimeout(TimeValue.parseTimeValue(timeout, null));
|
||||
public CreateIndexRequest timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -382,4 +382,4 @@ public class CreateIndexRequest extends MasterNodeOperationRequest<CreateIndexRe
|
|||
IndexMetaData.lookupFactorySafe(entry.getKey()).writeTo(entry.getValue(), out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
}
|
||||
|
||||
public CreateIndexRequestBuilder setIndex(String index) {
|
||||
request.setIndex(index);
|
||||
request.index(index);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* The settings to created the index with.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSettings(Settings settings) {
|
||||
request.setSettings(settings);
|
||||
request.settings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* The settings to created the index with.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSettings(Settings.Builder settings) {
|
||||
request.setSettings(settings);
|
||||
request.settings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* Allows to set the settings using a json builder.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSettings(XContentBuilder builder) {
|
||||
request.setSettings(builder);
|
||||
request.settings(builder);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* The settings to crete the index with (either json/yaml/properties format)
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSettings(String source) {
|
||||
request.setSettings(source);
|
||||
request.settings(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* The settings to crete the index with (either json/yaml/properties format)
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSettings(Map<String, Object> source) {
|
||||
request.setSettings(source);
|
||||
request.settings(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* @param source The mapping source
|
||||
*/
|
||||
public CreateIndexRequestBuilder addMapping(String type, String source) {
|
||||
request.addMapping(type, source);
|
||||
request.mapping(type, source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* The cause for this index creation.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setCause(String cause) {
|
||||
request.setCause(cause);
|
||||
request.cause(cause);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* @param source The mapping source
|
||||
*/
|
||||
public CreateIndexRequestBuilder addMapping(String type, XContentBuilder source) {
|
||||
request.addMapping(type, source);
|
||||
request.mapping(type, source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* @param source The mapping source
|
||||
*/
|
||||
public CreateIndexRequestBuilder addMapping(String type, Map<String, Object> source) {
|
||||
request.addMapping(type, source);
|
||||
request.mapping(type, source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSource(String source) {
|
||||
request.setSource(source);
|
||||
request.source(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSource(BytesReference source) {
|
||||
request.setSource(source);
|
||||
request.source(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSource(byte[] source) {
|
||||
request.setSource(source);
|
||||
request.source(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSource(byte[] source, int offset, int length) {
|
||||
request.setSource(source, offset, length);
|
||||
request.source(source, offset, length);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -166,12 +166,12 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSource(Map<String, Object> source) {
|
||||
request.setSource(source);
|
||||
request.source(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CreateIndexRequestBuilder addCustom(IndexMetaData.Custom custom) {
|
||||
request.addCustom(custom);
|
||||
request.custom(custom);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* Sets the settings and mappings as a single source.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setSource(XContentBuilder source) {
|
||||
request.setSource(source);
|
||||
request.source(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setTimeout(TimeValue timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public CreateIndexRequestBuilder setTimeout(String timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class CreateIndexResponse extends ActionResponse {
|
|||
|
||||
/**
|
||||
* Has the index creation been acknowledged by all current cluster nodes within the
|
||||
* provided {@link CreateIndexRequest#setTimeout(org.elasticsearch.common.unit.TimeValue)}.
|
||||
* provided {@link CreateIndexRequest#timeout(org.elasticsearch.common.unit.TimeValue)}.
|
||||
*/
|
||||
public boolean isAcknowledged() {
|
||||
return acknowledged;
|
||||
|
|
|
@ -70,12 +70,12 @@ public class TransportCreateIndexAction extends TransportMasterNodeOperationActi
|
|||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(CreateIndexRequest request, ClusterState state) {
|
||||
return state.blocks().indexBlockedException(ClusterBlockLevel.METADATA, request.getIndex());
|
||||
return state.blocks().indexBlockedException(ClusterBlockLevel.METADATA, request.index());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CreateIndexResponse masterOperation(CreateIndexRequest request, ClusterState state) throws ElasticSearchException {
|
||||
String cause = request.getCause();
|
||||
String cause = request.cause();
|
||||
if (cause.length() == 0) {
|
||||
cause = "api";
|
||||
}
|
||||
|
@ -83,10 +83,10 @@ public class TransportCreateIndexAction extends TransportMasterNodeOperationActi
|
|||
final AtomicReference<CreateIndexResponse> responseRef = new AtomicReference<CreateIndexResponse>();
|
||||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
createIndexService.createIndex(new MetaDataCreateIndexService.Request(cause, request.getIndex()).settings(request.getSettings())
|
||||
.mappings(request.getMappings())
|
||||
.customs(request.getCustoms())
|
||||
.timeout(request.getTimeout()),
|
||||
createIndexService.createIndex(new MetaDataCreateIndexService.Request(cause, request.index()).settings(request.settings())
|
||||
.mappings(request.mappings())
|
||||
.customs(request.customs())
|
||||
.timeout(request.timeout()),
|
||||
new MetaDataCreateIndexService.Listener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataCreateIndexService.Response response) {
|
||||
|
|
|
@ -63,7 +63,7 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
|
|||
return validationException;
|
||||
}
|
||||
|
||||
public DeleteIndexRequest setIndices(String... indices) {
|
||||
public DeleteIndexRequest indices(String... indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
|
|||
/**
|
||||
* The index to delete.
|
||||
*/
|
||||
String[] getIndices() {
|
||||
String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
TimeValue getTimeout() {
|
||||
TimeValue timeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public DeleteIndexRequest setTimeout(TimeValue timeout) {
|
||||
public DeleteIndexRequest timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public DeleteIndexRequest setTimeout(String timeout) {
|
||||
return setTimeout(TimeValue.parseTimeValue(timeout, null));
|
||||
public DeleteIndexRequest timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,4 +123,4 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
|
|||
}
|
||||
timeout.writeTo(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public DeleteIndexRequestBuilder setTimeout(TimeValue timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public DeleteIndexRequestBuilder setTimeout(String timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public class DeleteIndexResponse extends ActionResponse {
|
|||
|
||||
/**
|
||||
* Has the index deletion been acknowledged by all current cluster nodes within the
|
||||
* provided {@link DeleteIndexRequest#setTimeout(org.elasticsearch.common.unit.TimeValue)}.
|
||||
* provided {@link DeleteIndexRequest#timeout(org.elasticsearch.common.unit.TimeValue)}.
|
||||
*/
|
||||
public boolean isAcknowledged() {
|
||||
return acknowledged;
|
||||
|
|
|
@ -86,15 +86,15 @@ public class TransportDeleteIndexAction extends TransportMasterNodeOperationActi
|
|||
@Override
|
||||
protected void doExecute(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener) {
|
||||
ClusterState state = clusterService.state();
|
||||
String[] indicesOrAliases = request.getIndices();
|
||||
request.setIndices(state.metaData().concreteIndices(request.getIndices()));
|
||||
String[] indicesOrAliases = request.indices();
|
||||
request.indices(state.metaData().concreteIndices(request.indices()));
|
||||
if (disableDeleteAllIndices) {
|
||||
// simple check on the original indices with "all" default parameter
|
||||
if (indicesOrAliases == null || indicesOrAliases.length == 0 || (indicesOrAliases.length == 1 && indicesOrAliases[0].equals("_all"))) {
|
||||
throw new ElasticSearchIllegalArgumentException("deleting all indices is disabled");
|
||||
}
|
||||
// if we end up matching on all indices, check, if its a wildcard parameter, or a "-something" structure
|
||||
if (request.getIndices().length == state.metaData().concreteAllIndices().length && indicesOrAliases.length > 0) {
|
||||
if (request.indices().length == state.metaData().concreteAllIndices().length && indicesOrAliases.length > 0) {
|
||||
boolean hasRegex = false;
|
||||
for (String indexOrAlias : indicesOrAliases) {
|
||||
if (Regex.isSimpleMatchPattern(indexOrAlias)) {
|
||||
|
@ -111,26 +111,26 @@ public class TransportDeleteIndexAction extends TransportMasterNodeOperationActi
|
|||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(DeleteIndexRequest request, ClusterState state) {
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.getIndices());
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.indices());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DeleteIndexResponse masterOperation(DeleteIndexRequest request, final ClusterState state) throws ElasticSearchException {
|
||||
if (request.getIndices().length == 0) {
|
||||
if (request.indices().length == 0) {
|
||||
return new DeleteIndexResponse(true);
|
||||
}
|
||||
final AtomicReference<DeleteIndexResponse> responseRef = new AtomicReference<DeleteIndexResponse>();
|
||||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(request.getIndices().length);
|
||||
for (final String index : request.getIndices()) {
|
||||
deleteIndexService.deleteIndex(new MetaDataDeleteIndexService.Request(index).timeout(request.getTimeout()), new MetaDataDeleteIndexService.Listener() {
|
||||
final CountDownLatch latch = new CountDownLatch(request.indices().length);
|
||||
for (final String index : request.indices()) {
|
||||
deleteIndexService.deleteIndex(new MetaDataDeleteIndexService.Request(index).timeout(request.timeout()), new MetaDataDeleteIndexService.Listener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataDeleteIndexService.Response response) {
|
||||
responseRef.set(new DeleteIndexResponse(response.acknowledged()));
|
||||
// YACK, but here we go: If this index is also percolated, make sure to delete all percolated queries from the _percolator index
|
||||
IndexMetaData percolatorMetaData = state.metaData().index(PercolatorService.INDEX_NAME);
|
||||
if (percolatorMetaData != null && percolatorMetaData.mappings().containsKey(index)) {
|
||||
deleteMappingAction.execute(new DeleteMappingRequest(PercolatorService.INDEX_NAME).setType(index), new ActionListener<DeleteMappingResponse>() {
|
||||
deleteMappingAction.execute(new DeleteMappingRequest(PercolatorService.INDEX_NAME).type(index), new ActionListener<DeleteMappingResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteMappingResponse deleteMappingResponse) {
|
||||
latch.countDown();
|
||||
|
|
|
@ -37,11 +37,11 @@ public class IndicesExistsRequest extends MasterNodeOperationRequest<IndicesExis
|
|||
this.indices = indices;
|
||||
}
|
||||
|
||||
public String[] getIndices() {
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
public void setIndices(String[] indices) {
|
||||
public void indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
}
|
||||
|
||||
|
@ -65,4 +65,4 @@ public class IndicesExistsRequest extends MasterNodeOperationRequest<IndicesExis
|
|||
super.writeTo(out);
|
||||
out.writeStringArray(indices);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class IndicesExistsRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
}
|
||||
|
||||
public IndicesExistsRequestBuilder setIndices(String... indices) {
|
||||
request.setIndices(indices);
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,13 +71,13 @@ public class TransportIndicesExistsAction extends TransportMasterNodeOperationAc
|
|||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(IndicesExistsRequest request, ClusterState state) {
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.getIndices());
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.indices());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IndicesExistsResponse masterOperation(IndicesExistsRequest request, ClusterState state) throws ElasticSearchException {
|
||||
boolean exists = true;
|
||||
for (String index : request.getIndices()) {
|
||||
for (String index : request.indices()) {
|
||||
if (!state.metaData().hasConcreteIndex(index)) {
|
||||
exists = false;
|
||||
}
|
||||
|
|
|
@ -65,12 +65,12 @@ public class TransportTypesExistsAction extends TransportMasterNodeOperationActi
|
|||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(TypesExistsRequest request, ClusterState state) {
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.getIndices());
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.indices());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypesExistsResponse masterOperation(TypesExistsRequest request, ClusterState state) throws ElasticSearchException {
|
||||
String[] concreteIndices = state.metaData().concreteIndices(request.getIndices(), request.getIgnoreIndices(), false);
|
||||
String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.ignoreIndices(), false);
|
||||
if (concreteIndices.length == 0) {
|
||||
return new TypesExistsResponse(false);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class TransportTypesExistsAction extends TransportMasterNodeOperationActi
|
|||
return new TypesExistsResponse(false);
|
||||
}
|
||||
|
||||
for (String type : request.getTypes()) {
|
||||
for (String type : request.types()) {
|
||||
if (!mappings.containsKey(type)) {
|
||||
return new TypesExistsResponse(false);
|
||||
}
|
||||
|
|
|
@ -46,27 +46,27 @@ public class TypesExistsRequest extends MasterNodeOperationRequest<TypesExistsRe
|
|||
this.types = types;
|
||||
}
|
||||
|
||||
public String[] getIndices() {
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
public void setIndices(String[] indices) {
|
||||
public void indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
}
|
||||
|
||||
public String[] getTypes() {
|
||||
public String[] types() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(String[] types) {
|
||||
public void types(String[] types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
public IgnoreIndices getIgnoreIndices() {
|
||||
public IgnoreIndices ignoreIndices() {
|
||||
return ignoreIndices;
|
||||
}
|
||||
|
||||
public TypesExistsRequest setIgnoreIndices(IgnoreIndices ignoreIndices) {
|
||||
public TypesExistsRequest ignoreIndices(IgnoreIndices ignoreIndices) {
|
||||
this.ignoreIndices = ignoreIndices;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class TypesExistsRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* @param indices What indices to check for types
|
||||
*/
|
||||
public TypesExistsRequestBuilder setIndices(String[] indices) {
|
||||
request.setIndices(indices);
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class TypesExistsRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* @param types The types to check if they exist
|
||||
*/
|
||||
public TypesExistsRequestBuilder setTypes(String... types) {
|
||||
request.setTypes(types);
|
||||
request.types(types);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class TypesExistsRequestBuilder extends MasterNodeOperationRequestBuilder
|
|||
* @param ignoreIndices Specifies how to resolve indices that aren't active / ready
|
||||
*/
|
||||
public TypesExistsRequestBuilder setIgnoreIndices(IgnoreIndices ignoreIndices) {
|
||||
request.setIgnoreIndices(ignoreIndices);
|
||||
request.ignoreIndices(ignoreIndices);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,20 +56,20 @@ public class FlushRequest extends BroadcastOperationRequest<FlushRequest> {
|
|||
public FlushRequest(String... indices) {
|
||||
super(indices);
|
||||
// we want to do the refresh in parallel on local shards...
|
||||
setOperationThreading(BroadcastOperationThreading.THREAD_PER_SHARD);
|
||||
operationThreading(BroadcastOperationThreading.THREAD_PER_SHARD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a refresh be performed once the flush is done. Defaults to <tt>false</tt>.
|
||||
*/
|
||||
public boolean isRefresh() {
|
||||
public boolean refresh() {
|
||||
return this.refresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a refresh be performed once the flush is done. Defaults to <tt>false</tt>.
|
||||
*/
|
||||
public FlushRequest setRefresh(boolean refresh) {
|
||||
public FlushRequest refresh(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
return this;
|
||||
}
|
||||
|
@ -77,14 +77,14 @@ public class FlushRequest extends BroadcastOperationRequest<FlushRequest> {
|
|||
/**
|
||||
* Should a "full" flush be performed.
|
||||
*/
|
||||
public boolean isFull() {
|
||||
public boolean full() {
|
||||
return this.full;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a "full" flush be performed.
|
||||
*/
|
||||
public FlushRequest setFull(boolean full) {
|
||||
public FlushRequest full(boolean full) {
|
||||
this.full = full;
|
||||
return this;
|
||||
}
|
||||
|
@ -92,14 +92,14 @@ public class FlushRequest extends BroadcastOperationRequest<FlushRequest> {
|
|||
/**
|
||||
* Force flushing, even if one is possibly not needed.
|
||||
*/
|
||||
public boolean isForce() {
|
||||
public boolean force() {
|
||||
return force;
|
||||
}
|
||||
|
||||
/**
|
||||
* Force flushing, even if one is possibly not needed.
|
||||
*/
|
||||
public FlushRequest setForce(boolean force) {
|
||||
public FlushRequest force(boolean force) {
|
||||
this.force = force;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -34,12 +34,12 @@ public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushR
|
|||
}
|
||||
|
||||
public FlushRequestBuilder setRefresh(boolean refresh) {
|
||||
request.setRefresh(refresh);
|
||||
request.refresh(refresh);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FlushRequestBuilder setFull(boolean full) {
|
||||
request.setFull(full);
|
||||
request.full(full);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,20 +39,20 @@ class ShardFlushRequest extends BroadcastShardOperationRequest {
|
|||
|
||||
public ShardFlushRequest(String index, int shardId, FlushRequest request) {
|
||||
super(index, shardId, request);
|
||||
this.refresh = request.isRefresh();
|
||||
this.full = request.isFull();
|
||||
this.force = request.isForce();
|
||||
this.refresh = request.refresh();
|
||||
this.full = request.full();
|
||||
this.force = request.force();
|
||||
}
|
||||
|
||||
public boolean isRefresh() {
|
||||
public boolean refresh() {
|
||||
return this.refresh;
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
public boolean full() {
|
||||
return this.full;
|
||||
}
|
||||
|
||||
public boolean isForce() {
|
||||
public boolean force() {
|
||||
return this.force;
|
||||
}
|
||||
|
||||
|
@ -71,4 +71,4 @@ class ShardFlushRequest extends BroadcastShardOperationRequest {
|
|||
out.writeBoolean(full);
|
||||
out.writeBoolean(force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,9 +115,9 @@ public class TransportFlushAction extends TransportBroadcastOperationAction<Flus
|
|||
|
||||
@Override
|
||||
protected ShardFlushResponse shardOperation(ShardFlushRequest request) throws ElasticSearchException {
|
||||
IndexShard indexShard = indicesService.indexServiceSafe(request.getIndex()).shardSafe(request.getShardId());
|
||||
indexShard.flush(new Engine.Flush().refresh(request.isRefresh()).type(request.isFull() ? Engine.Flush.Type.NEW_WRITER : Engine.Flush.Type.COMMIT_TRANSLOG).force(request.isForce()));
|
||||
return new ShardFlushResponse(request.getIndex(), request.getShardId());
|
||||
IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
|
||||
indexShard.flush(new Engine.Flush().refresh(request.refresh()).type(request.full() ? Engine.Flush.Type.NEW_WRITER : Engine.Flush.Type.COMMIT_TRANSLOG).force(request.force()));
|
||||
return new ShardFlushResponse(request.index(), request.shardId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,4 +137,4 @@ public class TransportFlushAction extends TransportBroadcastOperationAction<Flus
|
|||
protected ClusterBlockException checkRequestBlock(ClusterState state, FlushRequest countRequest, String[] concreteIndices) {
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, concreteIndices);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,10 +114,10 @@ public class TransportGatewaySnapshotAction extends TransportBroadcastOperationA
|
|||
|
||||
@Override
|
||||
protected ShardGatewaySnapshotResponse shardOperation(ShardGatewaySnapshotRequest request) throws ElasticSearchException {
|
||||
IndexShardGatewayService shardGatewayService = indicesService.indexServiceSafe(request.getIndex())
|
||||
.shardInjectorSafe(request.getShardId()).getInstance(IndexShardGatewayService.class);
|
||||
IndexShardGatewayService shardGatewayService = indicesService.indexServiceSafe(request.index())
|
||||
.shardInjectorSafe(request.shardId()).getInstance(IndexShardGatewayService.class);
|
||||
shardGatewayService.snapshot("api");
|
||||
return new ShardGatewaySnapshotResponse(request.getIndex(), request.getShardId());
|
||||
return new ShardGatewaySnapshotResponse(request.index(), request.shardId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,7 @@ public class DeleteMappingRequest extends MasterNodeOperationRequest<DeleteMappi
|
|||
/**
|
||||
* Sets the indices this put mapping operation will execute on.
|
||||
*/
|
||||
public DeleteMappingRequest setIndices(String[] indices) {
|
||||
public DeleteMappingRequest indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
@ -68,21 +68,21 @@ public class DeleteMappingRequest extends MasterNodeOperationRequest<DeleteMappi
|
|||
/**
|
||||
* The indices the mappings will be put.
|
||||
*/
|
||||
public String[] setIndices() {
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
/**
|
||||
* The mapping type.
|
||||
*/
|
||||
public String getType() {
|
||||
public String type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of the mappings to remove.
|
||||
*/
|
||||
public DeleteMappingRequest setType(String type) {
|
||||
public DeleteMappingRequest type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
@ -117,4 +117,4 @@ public class DeleteMappingRequest extends MasterNodeOperationRequest<DeleteMappi
|
|||
out.writeString(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class DeleteMappingRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
}
|
||||
|
||||
public DeleteMappingRequestBuilder setIndices(String... indices) {
|
||||
request.setIndices(indices);
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class DeleteMappingRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
* The type of the mapping to remove.
|
||||
*/
|
||||
public DeleteMappingRequestBuilder setType(String type) {
|
||||
request.setType(type);
|
||||
request.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -50,4 +50,4 @@ public class DeleteMappingRequestBuilder extends MasterNodeOperationRequestBuild
|
|||
protected void doExecute(ActionListener<DeleteMappingResponse> listener) {
|
||||
((IndicesAdminClient) client).deleteMapping(request, listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,13 +91,13 @@ public class TransportDeleteMappingAction extends TransportMasterNodeOperationAc
|
|||
@Override
|
||||
protected void doExecute(DeleteMappingRequest request, ActionListener<DeleteMappingResponse> listener) {
|
||||
// update to concrete indices
|
||||
request.setIndices(clusterService.state().metaData().concreteIndices(request.setIndices()));
|
||||
request.indices(clusterService.state().metaData().concreteIndices(request.indices()));
|
||||
super.doExecute(request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(DeleteMappingRequest request, ClusterState state) {
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.setIndices());
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.indices());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -105,16 +105,16 @@ public class TransportDeleteMappingAction extends TransportMasterNodeOperationAc
|
|||
|
||||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
flushAction.execute(Requests.flushRequest(request.setIndices()), new ActionListener<FlushResponse>() {
|
||||
flushAction.execute(Requests.flushRequest(request.indices()), new ActionListener<FlushResponse>() {
|
||||
@Override
|
||||
public void onResponse(FlushResponse flushResponse) {
|
||||
deleteByQueryAction.execute(Requests.deleteByQueryRequest(request.setIndices()).setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.typeFilter(request.getType()))), new ActionListener<DeleteByQueryResponse>() {
|
||||
deleteByQueryAction.execute(Requests.deleteByQueryRequest(request.indices()).query(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.typeFilter(request.type()))), new ActionListener<DeleteByQueryResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteByQueryResponse deleteByQueryResponse) {
|
||||
refreshAction.execute(Requests.refreshRequest(request.setIndices()), new ActionListener<RefreshResponse>() {
|
||||
refreshAction.execute(Requests.refreshRequest(request.indices()), new ActionListener<RefreshResponse>() {
|
||||
@Override
|
||||
public void onResponse(RefreshResponse refreshResponse) {
|
||||
metaDataMappingService.removeMapping(new MetaDataMappingService.RemoveRequest(request.setIndices(), request.getType()), new MetaDataMappingService.Listener() {
|
||||
metaDataMappingService.removeMapping(new MetaDataMappingService.RemoveRequest(request.indices(), request.type()), new MetaDataMappingService.Listener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataMappingService.Response response) {
|
||||
latch.countDown();
|
||||
|
@ -130,7 +130,7 @@ public class TransportDeleteMappingAction extends TransportMasterNodeOperationAc
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable e) {
|
||||
metaDataMappingService.removeMapping(new MetaDataMappingService.RemoveRequest(request.setIndices(), request.getType()), new MetaDataMappingService.Listener() {
|
||||
metaDataMappingService.removeMapping(new MetaDataMappingService.RemoveRequest(request.indices(), request.type()), new MetaDataMappingService.Listener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataMappingService.Response response) {
|
||||
latch.countDown();
|
||||
|
@ -177,4 +177,4 @@ public class TransportDeleteMappingAction extends TransportMasterNodeOperationAc
|
|||
|
||||
return new DeleteMappingResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import static org.elasticsearch.common.unit.TimeValue.readTimeValue;
|
|||
* {@link org.elasticsearch.client.Requests#putMappingRequest(String...)}.
|
||||
* <p/>
|
||||
* <p>If the mappings already exists, the new mappings will be merged with the new one. If there are elements
|
||||
* that can't be merged are detected, the request will be rejected unless the {@link #setIgnoreConflicts(boolean)}
|
||||
* that can't be merged are detected, the request will be rejected unless the {@link #ignoreConflicts(boolean)}
|
||||
* is set. In such a case, the duplicate mappings will be rejected.
|
||||
*
|
||||
* @see org.elasticsearch.client.Requests#putMappingRequest(String...)
|
||||
|
@ -88,7 +88,7 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
/**
|
||||
* Sets the indices this put mapping operation will execute on.
|
||||
*/
|
||||
public PutMappingRequest setIndices(String[] indices) {
|
||||
public PutMappingRequest indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
@ -96,14 +96,14 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
/**
|
||||
* The indices the mappings will be put.
|
||||
*/
|
||||
public String[] getIndices() {
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
/**
|
||||
* The mapping type.
|
||||
*/
|
||||
public String getType() {
|
||||
public String type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
* The type of the mappings.
|
||||
*/
|
||||
@Required
|
||||
public PutMappingRequest setType(String type) {
|
||||
public PutMappingRequest type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
/**
|
||||
* The mapping source definition.
|
||||
*/
|
||||
public String getSource() {
|
||||
public String source() {
|
||||
return source;
|
||||
}
|
||||
|
||||
|
@ -127,9 +127,9 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
* The mapping source definition.
|
||||
*/
|
||||
@Required
|
||||
public PutMappingRequest setSource(XContentBuilder mappingBuilder) {
|
||||
public PutMappingRequest source(XContentBuilder mappingBuilder) {
|
||||
try {
|
||||
return setSource(mappingBuilder.string());
|
||||
return source(mappingBuilder.string());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchIllegalArgumentException("Failed to build json for mapping request", e);
|
||||
}
|
||||
|
@ -139,11 +139,11 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
* The mapping source definition.
|
||||
*/
|
||||
@Required
|
||||
public PutMappingRequest setSource(Map mappingSource) {
|
||||
public PutMappingRequest source(Map mappingSource) {
|
||||
try {
|
||||
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
|
||||
builder.map(mappingSource);
|
||||
return setSource(builder.string());
|
||||
return source(builder.string());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchGenerationException("Failed to generate [" + mappingSource + "]", e);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
* The mapping source definition.
|
||||
*/
|
||||
@Required
|
||||
public PutMappingRequest setSource(String mappingSource) {
|
||||
public PutMappingRequest source(String mappingSource) {
|
||||
this.source = mappingSource;
|
||||
return this;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
* Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to
|
||||
* <tt>10s</tt>.
|
||||
*/
|
||||
public TimeValue getTimeout() {
|
||||
TimeValue timeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
* Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to
|
||||
* <tt>10s</tt>.
|
||||
*/
|
||||
public PutMappingRequest setTimeout(TimeValue timeout) {
|
||||
public PutMappingRequest timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
@ -179,25 +179,25 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
* Timeout to wait till the put mapping gets acknowledged of all current cluster nodes. Defaults to
|
||||
* <tt>10s</tt>.
|
||||
*/
|
||||
public PutMappingRequest setTimeout(String timeout) {
|
||||
return setTimeout(TimeValue.parseTimeValue(timeout, null));
|
||||
public PutMappingRequest timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is already a mapping definition registered against the type, then it will be merged. If there are
|
||||
* elements that can't be merged are detected, the request will be rejected unless the
|
||||
* {@link #setIgnoreConflicts(boolean)} is set. In such a case, the duplicate mappings will be rejected.
|
||||
* {@link #ignoreConflicts(boolean)} is set. In such a case, the duplicate mappings will be rejected.
|
||||
*/
|
||||
public boolean isIgnoreConflicts() {
|
||||
public boolean ignoreConflicts() {
|
||||
return ignoreConflicts;
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is already a mapping definition registered against the type, then it will be merged. If there are
|
||||
* elements that can't be merged are detected, the request will be rejected unless the
|
||||
* {@link #setIgnoreConflicts(boolean)} is set. In such a case, the duplicate mappings will be rejected.
|
||||
* {@link #ignoreConflicts(boolean)} is set. In such a case, the duplicate mappings will be rejected.
|
||||
*/
|
||||
public PutMappingRequest setIgnoreConflicts(boolean ignoreDuplicates) {
|
||||
public PutMappingRequest ignoreConflicts(boolean ignoreDuplicates) {
|
||||
this.ignoreConflicts = ignoreDuplicates;
|
||||
return this;
|
||||
}
|
||||
|
@ -221,4 +221,4 @@ public class PutMappingRequest extends MasterNodeOperationRequest<PutMappingRequ
|
|||
timeout.writeTo(out);
|
||||
out.writeBoolean(ignoreConflicts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
}
|
||||
|
||||
public PutMappingRequestBuilder setIndices(String... indices) {
|
||||
request.setIndices(indices);
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
*/
|
||||
@Required
|
||||
public PutMappingRequestBuilder setType(String type) {
|
||||
request.setType(type);
|
||||
request.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
* The mapping source definition.
|
||||
*/
|
||||
public PutMappingRequestBuilder setSource(XContentBuilder mappingBuilder) {
|
||||
request.setSource(mappingBuilder);
|
||||
request.source(mappingBuilder);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
* The mapping source definition.
|
||||
*/
|
||||
public PutMappingRequestBuilder setSource(Map mappingSource) {
|
||||
request.setSource(mappingSource);
|
||||
request.source(mappingSource);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
* The mapping source definition.
|
||||
*/
|
||||
public PutMappingRequestBuilder setSource(String mappingSource) {
|
||||
request.setSource(mappingSource);
|
||||
request.source(mappingSource);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
* <tt>10s</tt>.
|
||||
*/
|
||||
public PutMappingRequestBuilder setTimeout(TimeValue timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
* <tt>10s</tt>.
|
||||
*/
|
||||
public PutMappingRequestBuilder setTimeout(String timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
* {@link #setIgnoreConflicts(boolean)} is set. In such a case, the duplicate mappings will be rejected.
|
||||
*/
|
||||
public PutMappingRequestBuilder setIgnoreConflicts(boolean ignoreConflicts) {
|
||||
request.setIgnoreConflicts(ignoreConflicts);
|
||||
request.ignoreConflicts(ignoreConflicts);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -108,4 +108,4 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder<
|
|||
protected void doExecute(ActionListener<PutMappingResponse> listener) {
|
||||
((IndicesAdminClient) client).putMapping(request, listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class PutMappingResponse extends ActionResponse {
|
|||
|
||||
/**
|
||||
* Has the put mapping creation been acknowledged by all current cluster nodes within the
|
||||
* provided {@link PutMappingRequest#setTimeout(org.elasticsearch.common.unit.TimeValue)}.
|
||||
* provided {@link PutMappingRequest#timeout(org.elasticsearch.common.unit.TimeValue)}.
|
||||
*/
|
||||
public boolean isAcknowledged() {
|
||||
return acknowledged;
|
||||
|
@ -59,4 +59,4 @@ public class PutMappingResponse extends ActionResponse {
|
|||
super.writeTo(out);
|
||||
out.writeBoolean(acknowledged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,13 +71,13 @@ public class TransportPutMappingAction extends TransportMasterNodeOperationActio
|
|||
|
||||
@Override
|
||||
protected void doExecute(PutMappingRequest request, ActionListener<PutMappingResponse> listener) {
|
||||
request.setIndices(clusterService.state().metaData().concreteIndices(request.getIndices()));
|
||||
request.indices(clusterService.state().metaData().concreteIndices(request.indices()));
|
||||
super.doExecute(request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(PutMappingRequest request, ClusterState state) {
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.getIndices());
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.indices());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -85,12 +85,12 @@ public class TransportPutMappingAction extends TransportMasterNodeOperationActio
|
|||
ClusterState clusterState = clusterService.state();
|
||||
|
||||
// update to concrete indices
|
||||
request.setIndices(clusterState.metaData().concreteIndices(request.getIndices()));
|
||||
request.indices(clusterState.metaData().concreteIndices(request.indices()));
|
||||
|
||||
final AtomicReference<PutMappingResponse> responseRef = new AtomicReference<PutMappingResponse>();
|
||||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
metaDataMappingService.putMapping(new MetaDataMappingService.PutRequest(request.getIndices(), request.getType(), request.getSource()).ignoreConflicts(request.isIgnoreConflicts()).timeout(request.getTimeout()), new MetaDataMappingService.Listener() {
|
||||
metaDataMappingService.putMapping(new MetaDataMappingService.PutRequest(request.indices(), request.type(), request.source()).ignoreConflicts(request.ignoreConflicts()).timeout(request.timeout()), new MetaDataMappingService.Listener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataMappingService.Response response) {
|
||||
responseRef.set(new PutMappingResponse(response.acknowledged()));
|
||||
|
@ -120,4 +120,4 @@ public class TransportPutMappingAction extends TransportMasterNodeOperationActio
|
|||
|
||||
return responseRef.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,11 +62,11 @@ public class OpenIndexRequest extends MasterNodeOperationRequest<OpenIndexReques
|
|||
/**
|
||||
* The index to delete.
|
||||
*/
|
||||
public String getIndex() {
|
||||
String index() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public OpenIndexRequest setIndex(String index) {
|
||||
public OpenIndexRequest index(String index) {
|
||||
this.index = index;
|
||||
return this;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class OpenIndexRequest extends MasterNodeOperationRequest<OpenIndexReques
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public TimeValue getTimeout() {
|
||||
TimeValue timeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class OpenIndexRequest extends MasterNodeOperationRequest<OpenIndexReques
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public OpenIndexRequest setTimeout(TimeValue timeout) {
|
||||
public OpenIndexRequest timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ public class OpenIndexRequest extends MasterNodeOperationRequest<OpenIndexReques
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public OpenIndexRequest setTimeout(String timeout) {
|
||||
return setTimeout(TimeValue.parseTimeValue(timeout, null));
|
||||
public OpenIndexRequest timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -109,4 +109,4 @@ public class OpenIndexRequest extends MasterNodeOperationRequest<OpenIndexReques
|
|||
out.writeString(index);
|
||||
timeout.writeTo(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class OpenIndexRequestBuilder extends MasterNodeOperationRequestBuilder<O
|
|||
}
|
||||
|
||||
public OpenIndexRequestBuilder setIndex(String index) {
|
||||
request.setIndex(index);
|
||||
request.index(index);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class OpenIndexRequestBuilder extends MasterNodeOperationRequestBuilder<O
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public OpenIndexRequestBuilder setTimeout(TimeValue timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class OpenIndexRequestBuilder extends MasterNodeOperationRequestBuilder<O
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public OpenIndexRequestBuilder setTimeout(String timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ public class TransportOpenIndexAction extends TransportMasterNodeOperationAction
|
|||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(OpenIndexRequest request, ClusterState state) {
|
||||
request.setIndex(clusterService.state().metaData().concreteIndex(request.getIndex()));
|
||||
return state.blocks().indexBlockedException(ClusterBlockLevel.METADATA, request.getIndex());
|
||||
request.index(clusterService.state().metaData().concreteIndex(request.index()));
|
||||
return state.blocks().indexBlockedException(ClusterBlockLevel.METADATA, request.index());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,7 @@ public class TransportOpenIndexAction extends TransportMasterNodeOperationAction
|
|||
final AtomicReference<OpenIndexResponse> responseRef = new AtomicReference<OpenIndexResponse>();
|
||||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
stateIndexService.openIndex(new MetaDataStateIndexService.Request(request.getIndex()).timeout(request.getTimeout()), new MetaDataStateIndexService.Listener() {
|
||||
stateIndexService.openIndex(new MetaDataStateIndexService.Request(request.index()).timeout(request.timeout()), new MetaDataStateIndexService.Listener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataStateIndexService.Response response) {
|
||||
responseRef.set(new OpenIndexResponse(response.acknowledged()));
|
||||
|
|
|
@ -30,10 +30,10 @@ import java.io.IOException;
|
|||
* A request to optimize one or more indices. In order to optimize on all the indices, pass an empty array or
|
||||
* <tt>null</tt> for the indices.
|
||||
* <p/>
|
||||
* <p>{@link #setWaitForMerge(boolean)} allows to control if the call will block until the optimize completes and
|
||||
* <p>{@link #waitForMerge(boolean)} allows to control if the call will block until the optimize completes and
|
||||
* defaults to <tt>true</tt>.
|
||||
* <p/>
|
||||
* <p>{@link #setMaxNumSegments(int)} allows to control the number of segments to optimize down to. By default, will
|
||||
* <p>{@link #maxNumSegments(int)} allows to control the number of segments to optimize down to. By default, will
|
||||
* cause the optimize process to optimize down to half the configured number of segments.
|
||||
*
|
||||
* @see org.elasticsearch.client.Requests#optimizeRequest(String...)
|
||||
|
@ -68,7 +68,7 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
public OptimizeRequest(String... indices) {
|
||||
super(indices);
|
||||
// we want to do the optimize in parallel on local shards...
|
||||
setOperationThreading(BroadcastOperationThreading.THREAD_PER_SHARD);
|
||||
operationThreading(BroadcastOperationThreading.THREAD_PER_SHARD);
|
||||
}
|
||||
|
||||
public OptimizeRequest() {
|
||||
|
@ -78,14 +78,14 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
/**
|
||||
* Should the call block until the optimize completes. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public boolean isWaitForMerge() {
|
||||
public boolean waitForMerge() {
|
||||
return waitForMerge;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the call block until the optimize completes. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public OptimizeRequest setWaitForMerge(boolean waitForMerge) {
|
||||
public OptimizeRequest waitForMerge(boolean waitForMerge) {
|
||||
this.waitForMerge = waitForMerge;
|
||||
return this;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
* Will optimize the index down to <= maxNumSegments. By default, will cause the optimize
|
||||
* process to optimize down to half the configured number of segments.
|
||||
*/
|
||||
public int getMaxNumSegments() {
|
||||
public int maxNumSegments() {
|
||||
return maxNumSegments;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
* Will optimize the index down to <= maxNumSegments. By default, will cause the optimize
|
||||
* process to optimize down to half the configured number of segments.
|
||||
*/
|
||||
public OptimizeRequest setMaxNumSegments(int maxNumSegments) {
|
||||
public OptimizeRequest maxNumSegments(int maxNumSegments) {
|
||||
this.maxNumSegments = maxNumSegments;
|
||||
return this;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
* Should the optimization only expunge deletes from the index, without full optimization.
|
||||
* Defaults to full optimization (<tt>false</tt>).
|
||||
*/
|
||||
public boolean isOnlyExpungeDeletes() {
|
||||
public boolean onlyExpungeDeletes() {
|
||||
return onlyExpungeDeletes;
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
* Should the optimization only expunge deletes from the index, without full optimization.
|
||||
* Defaults to full optimization (<tt>false</tt>).
|
||||
*/
|
||||
public OptimizeRequest setOnlyExpungeDeletes(boolean onlyExpungeDeletes) {
|
||||
public OptimizeRequest onlyExpungeDeletes(boolean onlyExpungeDeletes) {
|
||||
this.onlyExpungeDeletes = onlyExpungeDeletes;
|
||||
return this;
|
||||
}
|
||||
|
@ -127,14 +127,14 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
/**
|
||||
* Should flush be performed after the optimization. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public boolean isFlush() {
|
||||
public boolean flush() {
|
||||
return flush;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should flush be performed after the optimization. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public OptimizeRequest setFlush(boolean flush) {
|
||||
public OptimizeRequest flush(boolean flush) {
|
||||
this.flush = flush;
|
||||
return this;
|
||||
}
|
||||
|
@ -142,14 +142,14 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
/**
|
||||
* Should refresh be performed after the optimization. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public boolean isRefresh() {
|
||||
public boolean refresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should refresh be performed after the optimization. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public OptimizeRequest setRefresh(boolean refresh) {
|
||||
public OptimizeRequest refresh(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
return this;
|
||||
}
|
||||
|
@ -171,4 +171,4 @@ public class OptimizeRequest extends BroadcastOperationRequest<OptimizeRequest>
|
|||
out.writeBoolean(flush);
|
||||
out.writeBoolean(refresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<Opt
|
|||
* Should the call block until the optimize completes. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public OptimizeRequestBuilder setWaitForMerge(boolean waitForMerge) {
|
||||
request.setWaitForMerge(waitForMerge);
|
||||
request.waitForMerge(waitForMerge);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<Opt
|
|||
* process to optimize down to half the configured number of segments.
|
||||
*/
|
||||
public OptimizeRequestBuilder setMaxNumSegments(int maxNumSegments) {
|
||||
request.setMaxNumSegments(maxNumSegments);
|
||||
request.maxNumSegments(maxNumSegments);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<Opt
|
|||
* Defaults to full optimization (<tt>false</tt>).
|
||||
*/
|
||||
public OptimizeRequestBuilder setOnlyExpungeDeletes(boolean onlyExpungeDeletes) {
|
||||
request.setOnlyExpungeDeletes(onlyExpungeDeletes);
|
||||
request.onlyExpungeDeletes(onlyExpungeDeletes);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<Opt
|
|||
* Should flush be performed after the optimization. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public OptimizeRequestBuilder setFlush(boolean flush) {
|
||||
request.setFlush(flush);
|
||||
request.flush(flush);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<Opt
|
|||
* Should refresh be performed after the optimization. Defaults to <tt>true</tt>.
|
||||
*/
|
||||
public OptimizeRequestBuilder setRefresh(boolean refresh) {
|
||||
request.setRefresh(refresh);
|
||||
request.refresh(refresh);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,30 +41,30 @@ class ShardOptimizeRequest extends BroadcastShardOperationRequest {
|
|||
|
||||
public ShardOptimizeRequest(String index, int shardId, OptimizeRequest request) {
|
||||
super(index, shardId, request);
|
||||
waitForMerge = request.isWaitForMerge();
|
||||
maxNumSegments = request.getMaxNumSegments();
|
||||
onlyExpungeDeletes = request.isOnlyExpungeDeletes();
|
||||
flush = request.isFlush();
|
||||
refresh = request.isRefresh();
|
||||
waitForMerge = request.waitForMerge();
|
||||
maxNumSegments = request.maxNumSegments();
|
||||
onlyExpungeDeletes = request.onlyExpungeDeletes();
|
||||
flush = request.flush();
|
||||
refresh = request.refresh();
|
||||
}
|
||||
|
||||
public boolean isWaitForMerge() {
|
||||
boolean waitForMerge() {
|
||||
return waitForMerge;
|
||||
}
|
||||
|
||||
public int getMaxNumSegments() {
|
||||
int maxNumSegments() {
|
||||
return maxNumSegments;
|
||||
}
|
||||
|
||||
public boolean isOnlyExpungeDeletes() {
|
||||
public boolean onlyExpungeDeletes() {
|
||||
return onlyExpungeDeletes;
|
||||
}
|
||||
|
||||
public boolean isFlush() {
|
||||
public boolean flush() {
|
||||
return flush;
|
||||
}
|
||||
|
||||
public boolean isRefresh() {
|
||||
public boolean refresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
|
@ -87,4 +87,4 @@ class ShardOptimizeRequest extends BroadcastShardOperationRequest {
|
|||
out.writeBoolean(flush);
|
||||
out.writeBoolean(refresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,15 +119,15 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction<O
|
|||
@Override
|
||||
protected ShardOptimizeResponse shardOperation(ShardOptimizeRequest request) throws ElasticSearchException {
|
||||
synchronized (optimizeMutex) {
|
||||
IndexShard indexShard = indicesService.indexServiceSafe(request.getIndex()).shardSafe(request.getShardId());
|
||||
IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
|
||||
indexShard.optimize(new Engine.Optimize()
|
||||
.waitForMerge(request.isWaitForMerge())
|
||||
.maxNumSegments(request.getMaxNumSegments())
|
||||
.onlyExpungeDeletes(request.isOnlyExpungeDeletes())
|
||||
.flush(request.isFlush())
|
||||
.refresh(request.isRefresh())
|
||||
.waitForMerge(request.waitForMerge())
|
||||
.maxNumSegments(request.maxNumSegments())
|
||||
.onlyExpungeDeletes(request.onlyExpungeDeletes())
|
||||
.flush(request.flush())
|
||||
.refresh(request.refresh())
|
||||
);
|
||||
return new ShardOptimizeResponse(request.getIndex(), request.getShardId());
|
||||
return new ShardOptimizeResponse(request.index(), request.shardId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,4 +148,4 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction<O
|
|||
protected ClusterBlockException checkRequestBlock(ClusterState state, OptimizeRequest request, String[] concreteIndices) {
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, concreteIndices);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ public class RefreshRequest extends BroadcastOperationRequest<RefreshRequest> {
|
|||
public RefreshRequest(String... indices) {
|
||||
super(indices);
|
||||
// we want to do the refresh in parallel on local shards...
|
||||
setOperationThreading(BroadcastOperationThreading.THREAD_PER_SHARD);
|
||||
operationThreading(BroadcastOperationThreading.THREAD_PER_SHARD);
|
||||
}
|
||||
|
||||
public boolean isWaitForOperations() {
|
||||
public boolean waitForOperations() {
|
||||
return waitForOperations;
|
||||
}
|
||||
|
||||
public RefreshRequest setWaitForOperations(boolean waitForOperations) {
|
||||
public RefreshRequest waitForOperations(boolean waitForOperations) {
|
||||
this.waitForOperations = waitForOperations;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<Refr
|
|||
}
|
||||
|
||||
public RefreshRequestBuilder setWaitForOperations(boolean waitForOperations) {
|
||||
request.setWaitForOperations(waitForOperations);
|
||||
request.waitForOperations(waitForOperations);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,14 +37,14 @@ class ShardRefreshRequest extends BroadcastShardOperationRequest {
|
|||
|
||||
public ShardRefreshRequest(String index, int shardId, RefreshRequest request) {
|
||||
super(index, shardId, request);
|
||||
waitForOperations = request.isWaitForOperations();
|
||||
waitForOperations = request.waitForOperations();
|
||||
}
|
||||
|
||||
public boolean isWaitForOperations() {
|
||||
public boolean waitForOperations() {
|
||||
return waitForOperations;
|
||||
}
|
||||
|
||||
public ShardRefreshRequest setWaitForOperations(boolean waitForOperations) {
|
||||
public ShardRefreshRequest waitForOperations(boolean waitForOperations) {
|
||||
this.waitForOperations = waitForOperations;
|
||||
return this;
|
||||
}
|
||||
|
@ -60,4 +60,4 @@ class ShardRefreshRequest extends BroadcastShardOperationRequest {
|
|||
super.writeTo(out);
|
||||
out.writeBoolean(waitForOperations);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,9 +135,9 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
|
|||
|
||||
@Override
|
||||
protected ShardRefreshResponse shardOperation(ShardRefreshRequest request) throws ElasticSearchException {
|
||||
IndexShard indexShard = indicesService.indexServiceSafe(request.getIndex()).shardSafe(request.getShardId());
|
||||
indexShard.refresh(new Engine.Refresh(request.isWaitForOperations()));
|
||||
return new ShardRefreshResponse(request.getIndex(), request.getShardId());
|
||||
IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
|
||||
indexShard.refresh(new Engine.Refresh(request.waitForOperations()));
|
||||
return new ShardRefreshResponse(request.index(), request.shardId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -140,8 +140,8 @@ public class TransportIndicesSegmentsAction extends TransportBroadcastOperationA
|
|||
|
||||
@Override
|
||||
protected ShardSegments shardOperation(IndexShardSegmentRequest request) throws ElasticSearchException {
|
||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.getIndex());
|
||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.getShardId());
|
||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.index());
|
||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
|
||||
return new ShardSegments(indexShard.routingEntry(), indexShard.engine().segments());
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class TransportUpdateSettingsAction extends TransportMasterNodeOperationA
|
|||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
updateSettingsService.updateSettings(request.getSettings(), request.getIndices(), new MetaDataUpdateSettingsService.Listener() {
|
||||
updateSettingsService.updateSettings(request.settings(), request.indices(), new MetaDataUpdateSettingsService.Listener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
latch.countDown();
|
||||
|
|
|
@ -74,15 +74,15 @@ public class UpdateSettingsRequest extends MasterNodeOperationRequest<UpdateSett
|
|||
return validationException;
|
||||
}
|
||||
|
||||
public String[] getIndices() {
|
||||
String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
public Settings getSettings() {
|
||||
Settings settings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public UpdateSettingsRequest setIndices(String... indices) {
|
||||
public UpdateSettingsRequest indices(String... indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class UpdateSettingsRequest extends MasterNodeOperationRequest<UpdateSett
|
|||
/**
|
||||
* The settings to created the index with.
|
||||
*/
|
||||
public UpdateSettingsRequest setSettings(Settings settings) {
|
||||
public UpdateSettingsRequest settings(Settings settings) {
|
||||
this.settings = settings;
|
||||
return this;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class UpdateSettingsRequest extends MasterNodeOperationRequest<UpdateSett
|
|||
/**
|
||||
* The settings to created the index with.
|
||||
*/
|
||||
public UpdateSettingsRequest setSettings(Settings.Builder settings) {
|
||||
public UpdateSettingsRequest settings(Settings.Builder settings) {
|
||||
this.settings = settings.build();
|
||||
return this;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class UpdateSettingsRequest extends MasterNodeOperationRequest<UpdateSett
|
|||
/**
|
||||
* The settings to crete the index with (either json/yaml/properties format)
|
||||
*/
|
||||
public UpdateSettingsRequest setSettings(String source) {
|
||||
public UpdateSettingsRequest settings(String source) {
|
||||
this.settings = ImmutableSettings.settingsBuilder().loadFromSource(source).build();
|
||||
return this;
|
||||
}
|
||||
|
@ -114,11 +114,11 @@ public class UpdateSettingsRequest extends MasterNodeOperationRequest<UpdateSett
|
|||
/**
|
||||
* The settings to crete the index with (either json/yaml/properties format)
|
||||
*/
|
||||
public UpdateSettingsRequest setSettings(Map source) {
|
||||
public UpdateSettingsRequest settings(Map source) {
|
||||
try {
|
||||
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
|
||||
builder.map(source);
|
||||
setSettings(builder.string());
|
||||
settings(builder.string());
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchGenerationException("Failed to generate [" + source + "]", e);
|
||||
}
|
||||
|
@ -138,4 +138,4 @@ public class UpdateSettingsRequest extends MasterNodeOperationRequest<UpdateSett
|
|||
out.writeStringArrayNullable(indices);
|
||||
writeSettingsToStream(settings, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class UpdateSettingsRequestBuilder extends MasterNodeOperationRequestBuil
|
|||
}
|
||||
|
||||
public UpdateSettingsRequestBuilder setIndices(String... indices) {
|
||||
request.setIndices(indices);
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class UpdateSettingsRequestBuilder extends MasterNodeOperationRequestBuil
|
|||
* The settings update.
|
||||
*/
|
||||
public UpdateSettingsRequestBuilder setSettings(Settings settings) {
|
||||
request.setSettings(settings);
|
||||
request.settings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class UpdateSettingsRequestBuilder extends MasterNodeOperationRequestBuil
|
|||
* The settings to update.
|
||||
*/
|
||||
public UpdateSettingsRequestBuilder setSettings(Settings.Builder settings) {
|
||||
request.setSettings(settings);
|
||||
request.settings(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class UpdateSettingsRequestBuilder extends MasterNodeOperationRequestBuil
|
|||
* The settings to update (either json/yaml/properties format)
|
||||
*/
|
||||
public UpdateSettingsRequestBuilder setSettings(String source) {
|
||||
request.setSettings(source);
|
||||
request.settings(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class UpdateSettingsRequestBuilder extends MasterNodeOperationRequestBuil
|
|||
* The settings to update (either json/yaml/properties format)
|
||||
*/
|
||||
public UpdateSettingsRequestBuilder setSettings(Map<String, Object> source) {
|
||||
request.setSettings(source);
|
||||
request.settings(source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* A request to get indices level stats. Allow to enable different stats to be returned.
|
||||
* <p/>
|
||||
* <p>By default, the {@link #setDocs(boolean)}, {@link #setStore(boolean)}, {@link #setIndexing(boolean)}
|
||||
* <p>By default, the {@link #docs(boolean)}, {@link #store(boolean)}, {@link #indexing(boolean)}
|
||||
* are enabled. Other stats can be enabled as well.
|
||||
* <p/>
|
||||
* <p>All the stats to be returned can be cleared using {@link #clear()}, at which point, specific
|
||||
|
@ -85,19 +85,19 @@ public class IndicesStatsRequest extends BroadcastOperationRequest<IndicesStatsR
|
|||
}
|
||||
|
||||
/**
|
||||
* Document types to return stats for. Mainly affects {@link #setIndexing(boolean)} when
|
||||
* Document types to return stats for. Mainly affects {@link #indexing(boolean)} when
|
||||
* enabled, returning specific indexing stats for those types.
|
||||
*/
|
||||
public IndicesStatsRequest setTypes(String... types) {
|
||||
public IndicesStatsRequest types(String... types) {
|
||||
this.types = types;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document types to return stats for. Mainly affects {@link #setIndexing(boolean)} when
|
||||
* Document types to return stats for. Mainly affects {@link #indexing(boolean)} when
|
||||
* enabled, returning specific indexing stats for those types.
|
||||
*/
|
||||
public String[] getTypes() {
|
||||
public String[] types() {
|
||||
return this.types;
|
||||
}
|
||||
|
||||
|
@ -105,93 +105,93 @@ public class IndicesStatsRequest extends BroadcastOperationRequest<IndicesStatsR
|
|||
* Sets specific search group stats to retrieve the stats for. Mainly affects search
|
||||
* when enabled.
|
||||
*/
|
||||
public IndicesStatsRequest setGroups(String... groups) {
|
||||
public IndicesStatsRequest groups(String... groups) {
|
||||
this.groups = groups;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String[] getGroups() {
|
||||
public String[] groups() {
|
||||
return this.groups;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setDocs(boolean docs) {
|
||||
public IndicesStatsRequest docs(boolean docs) {
|
||||
this.docs = docs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDocs() {
|
||||
public boolean docs() {
|
||||
return this.docs;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setStore(boolean store) {
|
||||
public IndicesStatsRequest store(boolean store) {
|
||||
this.store = store;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isStore() {
|
||||
public boolean store() {
|
||||
return this.store;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setIndexing(boolean indexing) {
|
||||
public IndicesStatsRequest indexing(boolean indexing) {
|
||||
this.indexing = indexing;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isIndexing() {
|
||||
public boolean indexing() {
|
||||
return this.indexing;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setGet(boolean get) {
|
||||
public IndicesStatsRequest get(boolean get) {
|
||||
this.get = get;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isGet() {
|
||||
public boolean get() {
|
||||
return this.get;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setSearch(boolean search) {
|
||||
public IndicesStatsRequest search(boolean search) {
|
||||
this.search = search;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSearch() {
|
||||
public boolean search() {
|
||||
return this.search;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setMerge(boolean merge) {
|
||||
public IndicesStatsRequest merge(boolean merge) {
|
||||
this.merge = merge;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMerge() {
|
||||
public boolean merge() {
|
||||
return this.merge;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setRefresh(boolean refresh) {
|
||||
public IndicesStatsRequest refresh(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isRefresh() {
|
||||
public boolean refresh() {
|
||||
return this.refresh;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setFlush(boolean flush) {
|
||||
public IndicesStatsRequest flush(boolean flush) {
|
||||
this.flush = flush;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlush() {
|
||||
public boolean flush() {
|
||||
return this.flush;
|
||||
}
|
||||
|
||||
public IndicesStatsRequest setWarmer(boolean warmer) {
|
||||
public IndicesStatsRequest warmer(boolean warmer) {
|
||||
this.warmer = warmer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isWarmer() {
|
||||
public boolean warmer() {
|
||||
return this.warmer;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,57 +60,57 @@ public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder
|
|||
* enabled, returning specific indexing stats for those types.
|
||||
*/
|
||||
public IndicesStatsRequestBuilder setTypes(String... types) {
|
||||
request.setTypes(types);
|
||||
request.types(types);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setGroups(String... groups) {
|
||||
request.setGroups(groups);
|
||||
request.groups(groups);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setDocs(boolean docs) {
|
||||
request.setDocs(docs);
|
||||
request.docs(docs);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setStore(boolean store) {
|
||||
request.setStore(store);
|
||||
request.store(store);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setIndexing(boolean indexing) {
|
||||
request.setIndexing(indexing);
|
||||
request.indexing(indexing);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setGet(boolean get) {
|
||||
request.setGet(get);
|
||||
request.get(get);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setSearch(boolean search) {
|
||||
request.setSearch(search);
|
||||
request.search(search);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setMerge(boolean merge) {
|
||||
request.setMerge(merge);
|
||||
request.merge(merge);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setRefresh(boolean refresh) {
|
||||
request.setRefresh(refresh);
|
||||
request.refresh(refresh);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setFlush(boolean flush) {
|
||||
request.setFlush(flush);
|
||||
request.flush(flush);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IndicesStatsRequestBuilder setWarmer(boolean warmer) {
|
||||
request.setWarmer(warmer);
|
||||
request.warmer(warmer);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,35 +141,35 @@ public class TransportIndicesStatsAction extends TransportBroadcastOperationActi
|
|||
|
||||
@Override
|
||||
protected ShardStats shardOperation(IndexShardStatsRequest request) throws ElasticSearchException {
|
||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.getIndex());
|
||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.getShardId());
|
||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.index());
|
||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
|
||||
ShardStats stats = new ShardStats(indexShard.routingEntry());
|
||||
|
||||
if (request.request.isDocs()) {
|
||||
if (request.request.docs()) {
|
||||
stats.stats.docs = indexShard.docStats();
|
||||
}
|
||||
if (request.request.isStore()) {
|
||||
if (request.request.store()) {
|
||||
stats.stats.store = indexShard.storeStats();
|
||||
}
|
||||
if (request.request.isIndexing()) {
|
||||
stats.stats.indexing = indexShard.indexingStats(request.request.getTypes());
|
||||
if (request.request.indexing()) {
|
||||
stats.stats.indexing = indexShard.indexingStats(request.request.types());
|
||||
}
|
||||
if (request.request.isGet()) {
|
||||
if (request.request.get()) {
|
||||
stats.stats.get = indexShard.getStats();
|
||||
}
|
||||
if (request.request.isSearch()) {
|
||||
stats.getStats().search = indexShard.searchStats(request.request.getGroups());
|
||||
if (request.request.search()) {
|
||||
stats.getStats().search = indexShard.searchStats(request.request.groups());
|
||||
}
|
||||
if (request.request.isMerge()) {
|
||||
if (request.request.merge()) {
|
||||
stats.stats.merge = indexShard.mergeStats();
|
||||
}
|
||||
if (request.request.isRefresh()) {
|
||||
if (request.request.refresh()) {
|
||||
stats.stats.refresh = indexShard.refreshStats();
|
||||
}
|
||||
if (request.request.isFlush()) {
|
||||
if (request.request.flush()) {
|
||||
stats.stats.flush = indexShard.flushStats();
|
||||
}
|
||||
if (request.request.isWarmer()) {
|
||||
if (request.request.warmer()) {
|
||||
stats.stats.warmer = indexShard.warmerStats();
|
||||
}
|
||||
|
||||
|
|
|
@ -46,24 +46,24 @@ public class IndicesStatusRequest extends BroadcastOperationRequest<IndicesStatu
|
|||
/**
|
||||
* Should the status include recovery information. Defaults to <tt>false</tt>.
|
||||
*/
|
||||
public IndicesStatusRequest setRecovery(boolean recovery) {
|
||||
public IndicesStatusRequest recovery(boolean recovery) {
|
||||
this.recovery = recovery;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isRecovery() {
|
||||
public boolean recovery() {
|
||||
return this.recovery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the status include recovery information. Defaults to <tt>false</tt>.
|
||||
*/
|
||||
public IndicesStatusRequest setSnapshot(boolean snapshot) {
|
||||
public IndicesStatusRequest snapshot(boolean snapshot) {
|
||||
this.snapshot = snapshot;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSnapshot() {
|
||||
public boolean snapshot() {
|
||||
return this.snapshot;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class IndicesStatusRequestBuilder extends BroadcastOperationRequestBuilde
|
|||
* Should the status include recovery information. Defaults to <tt>false</tt>.
|
||||
*/
|
||||
public IndicesStatusRequestBuilder setRecovery(boolean recovery) {
|
||||
request.setRecovery(recovery);
|
||||
request.recovery(recovery);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class IndicesStatusRequestBuilder extends BroadcastOperationRequestBuilde
|
|||
* Should the status include recovery information. Defaults to <tt>false</tt>.
|
||||
*/
|
||||
public IndicesStatusRequestBuilder setSnapshot(boolean snapshot) {
|
||||
request.setSnapshot(snapshot);
|
||||
request.snapshot(snapshot);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,8 +149,8 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct
|
|||
|
||||
@Override
|
||||
protected ShardStatus shardOperation(IndexShardStatusRequest request) throws ElasticSearchException {
|
||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.getIndex());
|
||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.getShardId());
|
||||
InternalIndexService indexService = (InternalIndexService) indicesService.indexServiceSafe(request.index());
|
||||
InternalIndexShard indexShard = (InternalIndexShard) indexService.shardSafe(request.shardId());
|
||||
ShardStatus shardStatus = new ShardStatus(indexShard.routingEntry());
|
||||
shardStatus.state = indexShard.state();
|
||||
try {
|
||||
|
@ -209,7 +209,7 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct
|
|||
peerRecoveryStatus.currentFilesSize(), peerRecoveryStatus.currentTranslogOperations());
|
||||
}
|
||||
|
||||
IndexShardGatewayService gatewayService = indexService.shardInjector(request.getShardId()).getInstance(IndexShardGatewayService.class);
|
||||
IndexShardGatewayService gatewayService = indexService.shardInjector(request.shardId()).getInstance(IndexShardGatewayService.class);
|
||||
org.elasticsearch.index.gateway.RecoveryStatus gatewayRecoveryStatus = gatewayService.recoveryStatus();
|
||||
if (gatewayRecoveryStatus != null) {
|
||||
GatewayRecoveryStatus.Stage stage;
|
||||
|
@ -235,7 +235,7 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct
|
|||
}
|
||||
|
||||
if (request.snapshot) {
|
||||
IndexShardGatewayService gatewayService = indexService.shardInjector(request.getShardId()).getInstance(IndexShardGatewayService.class);
|
||||
IndexShardGatewayService gatewayService = indexService.shardInjector(request.shardId()).getInstance(IndexShardGatewayService.class);
|
||||
SnapshotStatus snapshotStatus = gatewayService.snapshotStatus();
|
||||
if (snapshotStatus != null) {
|
||||
GatewaySnapshotStatus.Stage stage;
|
||||
|
@ -278,8 +278,8 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct
|
|||
|
||||
IndexShardStatusRequest(String index, int shardId, IndicesStatusRequest request) {
|
||||
super(index, shardId, request);
|
||||
recovery = request.isRecovery();
|
||||
snapshot = request.isSnapshot();
|
||||
recovery = request.recovery();
|
||||
snapshot = request.snapshot();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -62,7 +62,7 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest<Delet
|
|||
/**
|
||||
* The index template name to delete.
|
||||
*/
|
||||
public String getName() {
|
||||
String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest<Delet
|
|||
* Timeout to wait for the index deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public TimeValue getTimeout() {
|
||||
TimeValue timeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest<Delet
|
|||
* Timeout to wait for the index template deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public DeleteIndexTemplateRequest setTimeout(TimeValue timeout) {
|
||||
public DeleteIndexTemplateRequest timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest<Delet
|
|||
* Timeout to wait for the index template deletion to be acknowledged by current cluster nodes. Defaults
|
||||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public DeleteIndexTemplateRequest setTimeout(String timeout) {
|
||||
return setTimeout(TimeValue.parseTimeValue(timeout, null));
|
||||
public DeleteIndexTemplateRequest timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,4 +104,4 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest<Delet
|
|||
out.writeString(name);
|
||||
timeout.writeTo(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationReques
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public DeleteIndexTemplateRequestBuilder setTimeout(TimeValue timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationReques
|
|||
* to <tt>10s</tt>.
|
||||
*/
|
||||
public DeleteIndexTemplateRequestBuilder setTimeout(String timeout) {
|
||||
request.setTimeout(timeout);
|
||||
request.timeout(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class TransportDeleteIndexTemplateAction extends TransportMasterNodeOpera
|
|||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
indexTemplateService.removeTemplate(new MetaDataIndexTemplateService.RemoveRequest(request.getName()), new MetaDataIndexTemplateService.RemoveListener() {
|
||||
indexTemplateService.removeTemplate(new MetaDataIndexTemplateService.RemoveRequest(request.name()), new MetaDataIndexTemplateService.RemoveListener() {
|
||||
@Override
|
||||
public void onResponse(MetaDataIndexTemplateService.RemoveResponse response) {
|
||||
responseRef.set(new DeleteIndexTemplateResponse(response.acknowledged()));
|
||||
|
|
|
@ -96,7 +96,7 @@ public class PutIndexTemplateRequest extends MasterNodeOperationRequest<PutIndex
|
|||
/**
|
||||
* Sets the name of the index template.
|
||||
*/
|
||||
public PutIndexTemplateRequest setName(String name) {
|
||||
public PutIndexTemplateRequest name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class PutIndexTemplateRequest extends MasterNodeOperationRequest<PutIndex
|
|||
/**
|
||||
* The name of the index template.
|
||||
*/
|
||||
public String getName() {
|
||||
public String name() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
@ -410,4 +410,4 @@ public class PutIndexTemplateRequest extends MasterNodeOperationRequest<PutIndex
|
|||
IndexMetaData.lookupFactorySafe(entry.getKey()).writeTo(entry.getValue(), out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeOperatio
|
|||
final AtomicReference<PutIndexTemplateResponse> responseRef = new AtomicReference<PutIndexTemplateResponse>();
|
||||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
indexTemplateService.putTemplate(new MetaDataIndexTemplateService.PutRequest(request.cause(), request.getName())
|
||||
indexTemplateService.putTemplate(new MetaDataIndexTemplateService.PutRequest(request.cause(), request.name())
|
||||
.template(request.template())
|
||||
.order(request.order())
|
||||
.settings(request.settings())
|
||||
|
|
|
@ -46,9 +46,9 @@ class ShardValidateQueryRequest extends BroadcastShardOperationRequest {
|
|||
|
||||
public ShardValidateQueryRequest(String index, int shardId, @Nullable String[] filteringAliases, ValidateQueryRequest request) {
|
||||
super(index, shardId, request);
|
||||
this.querySource = request.getQuerySource();
|
||||
this.types = request.getTypes();
|
||||
this.explain = request.isExplain();
|
||||
this.querySource = request.querySource();
|
||||
this.types = request.types();
|
||||
this.explain = request.explain();
|
||||
this.filteringAliases = filteringAliases;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
|
|||
|
||||
@Override
|
||||
protected ShardValidateQueryRequest newShardRequest(ShardRouting shard, ValidateQueryRequest request) {
|
||||
String[] filteringAliases = clusterService.state().metaData().filteringAliases(shard.index(), request.getIndices());
|
||||
String[] filteringAliases = clusterService.state().metaData().filteringAliases(shard.index(), request.indices());
|
||||
return new ShardValidateQueryRequest(shard.index(), shard.id(), filteringAliases, request);
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
|
|||
@Override
|
||||
protected GroupShardsIterator shards(ClusterState clusterState, ValidateQueryRequest request, String[] concreteIndices) {
|
||||
// Hard-code routing to limit request to a single shard, but still, randomize it...
|
||||
Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(Integer.toString(ThreadLocalRandom.current().nextInt(1000)), request.getIndices());
|
||||
return clusterService.operationRouting().searchShards(clusterState, request.getIndices(), concreteIndices, routingMap, "_local");
|
||||
Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(Integer.toString(ThreadLocalRandom.current().nextInt(1000)), request.indices());
|
||||
return clusterService.operationRouting().searchShards(clusterState, request.indices(), concreteIndices, routingMap, "_local");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,7 +136,7 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
|
|||
} else {
|
||||
ShardValidateQueryResponse validateQueryResponse = (ShardValidateQueryResponse) shardResponse;
|
||||
valid = valid && validateQueryResponse.isValid();
|
||||
if (request.isExplain()) {
|
||||
if (request.explain()) {
|
||||
if (queryExplanations == null) {
|
||||
queryExplanations = newArrayList();
|
||||
}
|
||||
|
@ -155,9 +155,9 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
|
|||
|
||||
@Override
|
||||
protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request) throws ElasticSearchException {
|
||||
IndexQueryParserService queryParserService = indicesService.indexServiceSafe(request.getIndex()).queryParserService();
|
||||
IndexService indexService = indicesService.indexServiceSafe(request.getIndex());
|
||||
IndexShard indexShard = indexService.shardSafe(request.getShardId());
|
||||
IndexQueryParserService queryParserService = indicesService.indexServiceSafe(request.index()).queryParserService();
|
||||
IndexService indexService = indicesService.indexServiceSafe(request.index());
|
||||
IndexShard indexShard = indexService.shardSafe(request.shardId());
|
||||
|
||||
boolean valid;
|
||||
String explanation = null;
|
||||
|
@ -186,6 +186,6 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
|
|||
SearchContext.removeCurrent();
|
||||
}
|
||||
}
|
||||
return new ShardValidateQueryResponse(request.getIndex(), request.getShardId(), valid, explanation, error);
|
||||
return new ShardValidateQueryResponse(request.index(), request.shardId(), valid, explanation, error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ import java.util.Map;
|
|||
/**
|
||||
* A request to validate a specific query.
|
||||
* <p/>
|
||||
* <p>The request requires the query source to be set either using {@link #setQuery(org.elasticsearch.index.query.QueryBuilder)},
|
||||
* or {@link #setQuery(byte[])}.
|
||||
* <p>The request requires the query source to be set either using {@link #query(org.elasticsearch.index.query.QueryBuilder)},
|
||||
* or {@link #query(byte[])}.
|
||||
*/
|
||||
public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQueryRequest> {
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
|
|||
/**
|
||||
* The query source to execute.
|
||||
*/
|
||||
public BytesReference getQuerySource() {
|
||||
BytesReference querySource() {
|
||||
return querySource;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
|
|||
* @see org.elasticsearch.index.query.QueryBuilders
|
||||
*/
|
||||
@Required
|
||||
public ValidateQueryRequest setQuery(QueryBuilder queryBuilder) {
|
||||
public ValidateQueryRequest query(QueryBuilder queryBuilder) {
|
||||
this.querySource = queryBuilder.buildAsBytes();
|
||||
this.querySourceUnsafe = false;
|
||||
return this;
|
||||
|
@ -104,29 +104,29 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
|
|||
* The query source to execute in the form of a map.
|
||||
*/
|
||||
@Required
|
||||
public ValidateQueryRequest setQuery(Map querySource) {
|
||||
public ValidateQueryRequest query(Map querySource) {
|
||||
try {
|
||||
XContentBuilder builder = XContentFactory.contentBuilder(contentType);
|
||||
builder.map(querySource);
|
||||
return setQuery(builder);
|
||||
return query(builder);
|
||||
} catch (IOException e) {
|
||||
throw new ElasticSearchGenerationException("Failed to generate [" + querySource + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Required
|
||||
public ValidateQueryRequest setQuery(XContentBuilder builder) {
|
||||
public ValidateQueryRequest query(XContentBuilder builder) {
|
||||
this.querySource = builder.bytes();
|
||||
this.querySourceUnsafe = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The query source to validate. It is preferable to use either {@link #setQuery(byte[])}
|
||||
* or {@link #setQuery(org.elasticsearch.index.query.QueryBuilder)}.
|
||||
* The query source to validate. It is preferable to use either {@link #query(byte[])}
|
||||
* or {@link #query(org.elasticsearch.index.query.QueryBuilder)}.
|
||||
*/
|
||||
@Required
|
||||
public ValidateQueryRequest setQuery(String querySource) {
|
||||
public ValidateQueryRequest query(String querySource) {
|
||||
this.querySource = new BytesArray(querySource);
|
||||
;
|
||||
this.querySourceUnsafe = false;
|
||||
|
@ -137,23 +137,23 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
|
|||
* The query source to validate.
|
||||
*/
|
||||
@Required
|
||||
public ValidateQueryRequest setQuery(byte[] querySource) {
|
||||
return setQuery(querySource, 0, querySource.length, false);
|
||||
public ValidateQueryRequest query(byte[] querySource) {
|
||||
return query(querySource, 0, querySource.length, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The query source to validate.
|
||||
*/
|
||||
@Required
|
||||
public ValidateQueryRequest setQuery(byte[] querySource, int offset, int length, boolean unsafe) {
|
||||
return setQuery(new BytesArray(querySource, offset, length), unsafe);
|
||||
public ValidateQueryRequest query(byte[] querySource, int offset, int length, boolean unsafe) {
|
||||
return query(new BytesArray(querySource, offset, length), unsafe);
|
||||
}
|
||||
|
||||
/**
|
||||
* The query source to validate.
|
||||
*/
|
||||
@Required
|
||||
public ValidateQueryRequest setQuery(BytesReference querySource, boolean unsafe) {
|
||||
public ValidateQueryRequest query(BytesReference querySource, boolean unsafe) {
|
||||
this.querySource = querySource;
|
||||
this.querySourceUnsafe = unsafe;
|
||||
return this;
|
||||
|
@ -162,14 +162,14 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
|
|||
/**
|
||||
* The types of documents the query will run against. Defaults to all types.
|
||||
*/
|
||||
public String[] getTypes() {
|
||||
String[] types() {
|
||||
return this.types;
|
||||
}
|
||||
|
||||
/**
|
||||
* The types of documents the query will run against. Defaults to all types.
|
||||
*/
|
||||
public ValidateQueryRequest setTypes(String... types) {
|
||||
public ValidateQueryRequest types(String... types) {
|
||||
this.types = types;
|
||||
return this;
|
||||
}
|
||||
|
@ -177,14 +177,14 @@ public class ValidateQueryRequest extends BroadcastOperationRequest<ValidateQuer
|
|||
/**
|
||||
* Indicate if detailed information about query is requested
|
||||
*/
|
||||
public void setExplain(boolean explain) {
|
||||
public void explain(boolean explain) {
|
||||
this.explain = explain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if detailed information about query is requested
|
||||
*/
|
||||
public boolean isExplain() {
|
||||
public boolean explain() {
|
||||
return explain;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
|
|||
* The types of documents the query will run against. Defaults to all types.
|
||||
*/
|
||||
public ValidateQueryRequestBuilder setTypes(String... types) {
|
||||
request.setTypes(types);
|
||||
request.types(types);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
|
|||
* @see org.elasticsearch.index.query.QueryBuilders
|
||||
*/
|
||||
public ValidateQueryRequestBuilder setQuery(QueryBuilder queryBuilder) {
|
||||
request.setQuery(queryBuilder);
|
||||
request.query(queryBuilder);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
|
|||
* @see org.elasticsearch.index.query.QueryBuilders
|
||||
*/
|
||||
public ValidateQueryRequestBuilder setQuery(BytesReference querySource) {
|
||||
request.setQuery(querySource, false);
|
||||
request.query(querySource, false);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
|
|||
* @see org.elasticsearch.index.query.QueryBuilders
|
||||
*/
|
||||
public ValidateQueryRequestBuilder setQuery(BytesReference querySource, boolean unsafe) {
|
||||
request.setQuery(querySource, unsafe);
|
||||
request.query(querySource, unsafe);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
|
|||
* @see org.elasticsearch.index.query.QueryBuilders
|
||||
*/
|
||||
public ValidateQueryRequestBuilder setQuery(byte[] querySource) {
|
||||
request.setQuery(querySource);
|
||||
request.query(querySource);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
|
|||
* @see org.elasticsearch.index.query.QueryBuilders
|
||||
*/
|
||||
public ValidateQueryRequestBuilder setExplain(boolean explain) {
|
||||
request.setExplain(explain);
|
||||
request.explain(explain);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class DeleteWarmerRequest extends MasterNodeOperationRequest<DeleteWarmer
|
|||
* The name to delete.
|
||||
*/
|
||||
@Nullable
|
||||
public String getName() {
|
||||
String name() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class DeleteWarmerRequest extends MasterNodeOperationRequest<DeleteWarmer
|
|||
* The name (or wildcard expression) of the index warmer to delete, or null
|
||||
* to delete all warmers.
|
||||
*/
|
||||
public DeleteWarmerRequest setName(@Nullable String name) {
|
||||
public DeleteWarmerRequest name(@Nullable String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class DeleteWarmerRequest extends MasterNodeOperationRequest<DeleteWarmer
|
|||
/**
|
||||
* Sets the indices this put mapping operation will execute on.
|
||||
*/
|
||||
public DeleteWarmerRequest setIndices(String[] indices) {
|
||||
public DeleteWarmerRequest indices(String[] indices) {
|
||||
this.indices = indices;
|
||||
return this;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class DeleteWarmerRequest extends MasterNodeOperationRequest<DeleteWarmer
|
|||
/**
|
||||
* The indices the mappings will be put.
|
||||
*/
|
||||
public String[] getIndices() {
|
||||
public String[] indices() {
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
@ -100,4 +100,4 @@ public class DeleteWarmerRequest extends MasterNodeOperationRequest<DeleteWarmer
|
|||
out.writeOptionalString(name);
|
||||
out.writeStringArrayNullable(indices);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class DeleteWarmerRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
}
|
||||
|
||||
public DeleteWarmerRequestBuilder setIndices(String... indices) {
|
||||
request.setIndices(indices);
|
||||
request.indices(indices);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class DeleteWarmerRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
* to delete all warmers.
|
||||
*/
|
||||
public DeleteWarmerRequestBuilder setName(String name) {
|
||||
request.setName(name);
|
||||
request.name(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -51,4 +51,4 @@ public class DeleteWarmerRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
protected void doExecute(ActionListener<DeleteWarmerResponse> listener) {
|
||||
((IndicesAdminClient) client).deleteWarmer(request, listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,13 +77,13 @@ public class TransportDeleteWarmerAction extends TransportMasterNodeOperationAct
|
|||
@Override
|
||||
protected void doExecute(DeleteWarmerRequest request, ActionListener<DeleteWarmerResponse> listener) {
|
||||
// update to concrete indices
|
||||
request.setIndices(clusterService.state().metaData().concreteIndices(request.getIndices()));
|
||||
request.indices(clusterService.state().metaData().concreteIndices(request.indices()));
|
||||
super.doExecute(request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClusterBlockException checkBlock(DeleteWarmerRequest request, ClusterState state) {
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.getIndices());
|
||||
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.indices());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,14 +91,14 @@ public class TransportDeleteWarmerAction extends TransportMasterNodeOperationAct
|
|||
final AtomicReference<Throwable> failureRef = new AtomicReference<Throwable>();
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
clusterService.submitStateUpdateTask("delete_warmer [" + request.getName() + "]", new ProcessedClusterStateUpdateTask() {
|
||||
clusterService.submitStateUpdateTask("delete_warmer [" + request.name() + "]", new ProcessedClusterStateUpdateTask() {
|
||||
@Override
|
||||
public ClusterState execute(ClusterState currentState) {
|
||||
try {
|
||||
MetaData.Builder mdBuilder = MetaData.builder().metaData(currentState.metaData());
|
||||
|
||||
boolean globalFoundAtLeastOne = false;
|
||||
for (String index : request.getIndices()) {
|
||||
for (String index : request.indices()) {
|
||||
IndexMetaData indexMetaData = currentState.metaData().index(index);
|
||||
if (indexMetaData == null) {
|
||||
throw new IndexMissingException(new Index(index));
|
||||
|
@ -107,7 +107,7 @@ public class TransportDeleteWarmerAction extends TransportMasterNodeOperationAct
|
|||
if (warmers != null) {
|
||||
List<IndexWarmersMetaData.Entry> entries = Lists.newArrayList();
|
||||
for (IndexWarmersMetaData.Entry entry : warmers.entries()) {
|
||||
if (request.getName() == null || Regex.simpleMatch(request.getName(), entry.name())) {
|
||||
if (request.name() == null || Regex.simpleMatch(request.name(), entry.name())) {
|
||||
globalFoundAtLeastOne = true;
|
||||
// don't add it...
|
||||
} else {
|
||||
|
@ -124,15 +124,15 @@ public class TransportDeleteWarmerAction extends TransportMasterNodeOperationAct
|
|||
}
|
||||
|
||||
if (!globalFoundAtLeastOne) {
|
||||
if (request.getName() == null) {
|
||||
if (request.name() == null) {
|
||||
// full match, just return with no failure
|
||||
return currentState;
|
||||
}
|
||||
throw new IndexWarmerMissingException(request.getName());
|
||||
throw new IndexWarmerMissingException(request.name());
|
||||
}
|
||||
|
||||
if (logger.isInfoEnabled()) {
|
||||
for (String index : request.getIndices()) {
|
||||
for (String index : request.indices()) {
|
||||
IndexMetaData indexMetaData = currentState.metaData().index(index);
|
||||
if (indexMetaData == null) {
|
||||
throw new IndexMissingException(new Index(index));
|
||||
|
@ -140,7 +140,7 @@ public class TransportDeleteWarmerAction extends TransportMasterNodeOperationAct
|
|||
IndexWarmersMetaData warmers = indexMetaData.custom(IndexWarmersMetaData.TYPE);
|
||||
if (warmers != null) {
|
||||
for (IndexWarmersMetaData.Entry entry : warmers.entries()) {
|
||||
if (Regex.simpleMatch(request.getName(), entry.name())) {
|
||||
if (Regex.simpleMatch(request.name(), entry.name())) {
|
||||
logger.info("[{}] delete warmer [{}]", index, entry.name());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,19 +56,19 @@ public class PutWarmerRequest extends MasterNodeOperationRequest<PutWarmerReques
|
|||
/**
|
||||
* Sets the name of the warmer.
|
||||
*/
|
||||
public PutWarmerRequest setName(String name) {
|
||||
public PutWarmerRequest name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String name() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the search request to warm.
|
||||
*/
|
||||
public PutWarmerRequest setSearchRequest(SearchRequest searchRequest) {
|
||||
public PutWarmerRequest searchRequest(SearchRequest searchRequest) {
|
||||
this.searchRequest = searchRequest;
|
||||
return this;
|
||||
}
|
||||
|
@ -76,13 +76,13 @@ public class PutWarmerRequest extends MasterNodeOperationRequest<PutWarmerReques
|
|||
/**
|
||||
* Sets the search request to warm.
|
||||
*/
|
||||
public PutWarmerRequest setSearchRequest(SearchRequestBuilder searchRequest) {
|
||||
public PutWarmerRequest searchRequest(SearchRequestBuilder searchRequest) {
|
||||
this.searchRequest = searchRequest.request();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public SearchRequest getSearchRequest() {
|
||||
SearchRequest searchRequest() {
|
||||
return this.searchRequest;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue