diff --git a/src/main/java/org/elasticsearch/action/ActionRequest.java b/src/main/java/org/elasticsearch/action/ActionRequest.java index dabd42ca43b..714d462facb 100644 --- a/src/main/java/org/elasticsearch/action/ActionRequest.java +++ b/src/main/java/org/elasticsearch/action/ActionRequest.java @@ -49,7 +49,7 @@ public abstract class ActionRequest extends TransportRe *

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 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; } diff --git a/src/main/java/org/elasticsearch/action/ActionRequestBuilder.java b/src/main/java/org/elasticsearch/action/ActionRequestBuilder.java index 22cddb8d0dc..b4515969b03 100644 --- a/src/main/java/org/elasticsearch/action/ActionRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/ActionRequestBuilder.java @@ -42,7 +42,7 @@ public abstract class ActionRequestBuilder execute() { - PlainListenableActionFuture future = new PlainListenableActionFuture(request.isListenerThreaded(), client.threadPool()); + PlainListenableActionFuture future = new PlainListenableActionFuture(request.listenerThreaded(), client.threadPool()); execute(future); return future; } diff --git a/src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java b/src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java index 461cc7eae8a..ab3b86d801a 100644 --- a/src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java +++ b/src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java @@ -54,7 +54,7 @@ public class TransportActionNodeProxy execute(DiscoveryNode node, Request request) throws ElasticSearchException { PlainActionFuture future = newFuture(); - request.setListenerThreaded(false); + request.listenerThreaded(false); execute(node, request, future); return future; } @@ -68,7 +68,7 @@ public class TransportActionNodeProxy12" 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; } diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestBuilder.java index 7b168440aad..eaf231e91b2 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestBuilder.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java index 99e087c8d7f..b88a9207b47 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java @@ -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) { diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java index 09b734968d9..5121514a54c 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/NodesHotThreadsRequest.java @@ -44,38 +44,38 @@ public class NodesHotThreadsRequest extends NodesOperationRequest { /** * 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 { /** * 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 { /** * 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 { /** * 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 { /** * 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 { /** * 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 { /** * 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 { /** * 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; } diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequestBuilder.java index 5bf2905442b..a6acaf8ddf6 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoRequestBuilder.java @@ -53,7 +53,7 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder1s. */ - public NodesRestartRequest setDelay(TimeValue delay) { + public NodesRestartRequest delay(TimeValue delay) { this.delay = delay; return this; } @@ -57,11 +57,11 @@ public class NodesRestartRequest extends NodesOperationRequest1s. */ - 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 NodesOperationRequest1s. */ public NodesRestartRequestBuilder setDelay(TimeValue delay) { - request.setDelay(delay); + request.delay(delay); return this; } @@ -46,7 +46,7 @@ public class NodesRestartRequestBuilder extends NodesOperationRequestBuilder1s. */ public NodesRestartRequestBuilder setDelay(String delay) { - request.setDelay(delay); + request.delay(delay); return this; } @@ -54,4 +54,4 @@ public class NodesRestartRequestBuilder extends NodesOperationRequestBuilder listener) { ((ClusterAdminClient) client).nodesRestart(request, listener); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequest.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequest.java index 060a162f6e7..5549465a25b 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequest.java @@ -56,26 +56,26 @@ public class NodesShutdownRequest extends MasterNodeOperationRequest1s. */ - 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 1s. */ - 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 true. */ - public NodesShutdownRequest setExit(boolean exit) { + public NodesShutdownRequest exit(boolean exit) { this.exit = exit; return this; } @@ -83,7 +83,7 @@ public class NodesShutdownRequest extends MasterNodeOperationRequesttrue. */ - public boolean isExit() { + public boolean exit() { return exit; } diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequestBuilder.java index 26318f1f2c8..0944a36c6a6 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/NodesShutdownRequestBuilder.java @@ -46,7 +46,7 @@ public class NodesShutdownRequestBuilder extends MasterNodeOperationRequestBuild * The delay for the restart to occur. Defaults to 1s. */ 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 1s. */ 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 true. */ 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 listener) { ((ClusterAdminClient) client).nodesShutdown(request, listener); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java index 8328e76bf3b..1d84c4e18f3 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java @@ -297,7 +297,7 @@ public class TransportNodesShutdownAction extends TransportMasterNodeOperationAc NodeShutdownRequest(NodesShutdownRequest request) { super(request); - this.exit = request.isExit(); + this.exit = request.exit(); } @Override diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java index fc1212be9fb..7dbba076d5a 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java @@ -86,14 +86,14 @@ public class NodesStatsRequest extends NodesOperationRequest /** * 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 /** * 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 /** * 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 /** * 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 /** * 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 /** * 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 /** * 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 /** * 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 /** * 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 out.writeBoolean(http); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequestBuilder.java index 4fa5a58a98c..fe0110169d7 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequestBuilder.java @@ -53,7 +53,7 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder listener) { ((ClusterAdminClient) client).nodesStats(request, listener); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java index 43157a1fc3f..488b67966a0 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java @@ -97,7 +97,7 @@ public class TransportNodesStatsAction extends TransportNodesOperationAction entry : request.getTransientSettings().getAsMap().entrySet()) { + for (Map.Entry 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 entry : request.getPersistentSettings().getAsMap().entrySet()) { + for (Map.Entry entry : request.persistentSettings().getAsMap().entrySet()) { if (MetaData.hasDynamicSetting(entry.getKey()) || entry.getKey().startsWith("logger.")) { changed = true; persistentSettings.put(entry.getKey(), entry.getValue()); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java b/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java index 6f9c0caef48..382070e0489 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequest.java @@ -64,66 +64,66 @@ public class ClusterStateRequest extends MasterNodeOperationRequestfalse. */ public ClusterStateRequestBuilder setFilterMetaData(boolean filter) { - request.setFilterMetaData(filter); + request.filterMetaData(filter); return this; } @@ -60,7 +60,7 @@ public class ClusterStateRequestBuilder extends MasterNodeOperationRequestBuilde * to false. */ public ClusterStateRequestBuilder setFilterNodes(boolean filter) { - request.setFilterNodes(filter); + request.filterNodes(filter); return this; } @@ -69,7 +69,7 @@ public class ClusterStateRequestBuilder extends MasterNodeOperationRequestBuilde * to false. */ 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; } diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java index 16befd0b17d..2f1892af194 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java @@ -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()); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java index 719e35aa5ce..633e6846958 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java @@ -137,7 +137,7 @@ public class IndicesAliasesRequest extends MasterNodeOperationRequest getAliasActions() { + List aliasActions() { return this.aliasActions; } @@ -145,7 +145,7 @@ public class IndicesAliasesRequest extends MasterNodeOperationRequest10s. */ - public TimeValue getTimeout() { + TimeValue timeout() { return timeout; } @@ -153,7 +153,7 @@ public class IndicesAliasesRequest extends MasterNodeOperationRequest10s. */ - public IndicesAliasesRequest setTimeout(TimeValue timeout) { + public IndicesAliasesRequest timeout(TimeValue timeout) { this.timeout = timeout; return this; } @@ -162,8 +162,8 @@ public class IndicesAliasesRequest extends MasterNodeOperationRequest10s. */ - 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 diff --git a/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequestBuilder.java index 248d41411a0..812630dc818 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequestBuilder.java @@ -112,7 +112,7 @@ public class IndicesAliasesRequestBuilder extends MasterNodeOperationRequestBuil * @param timeout */ public IndicesAliasesRequestBuilder setTimeout(TimeValue timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java b/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java index 68a6d7349f7..9b4d2b5486b 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java @@ -74,7 +74,7 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeOperationA @Override protected ClusterBlockException checkBlock(IndicesAliasesRequest request, ClusterState state) { Set 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 responseRef = new AtomicReference(); final AtomicReference failureRef = new AtomicReference(); 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())); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeRequest.java index 3b2bab9bc0e..bca9cdf14a8 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeRequest.java @@ -71,52 +71,52 @@ public class AnalyzeRequest extends SingleCustomOperationRequest 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; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeRequestBuilder.java index 343d99d859e..7986375a7cc 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeRequestBuilder.java @@ -42,7 +42,7 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder 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 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); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java index 82b111623c5..ce0963a516e 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/ClearIndicesCacheRequest.java @@ -43,50 +43,50 @@ public class ClearIndicesCacheRequest extends BroadcastOperationRequest 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); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java index 587a882b06d..bf645d6c398 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java @@ -62,11 +62,11 @@ public class CloseIndexRequest extends MasterNodeOperationRequest10s. */ - TimeValue getTimeout() { + TimeValue timeout() { return timeout; } @@ -83,7 +83,7 @@ public class CloseIndexRequest extends MasterNodeOperationRequest10s. */ - public CloseIndexRequest setTimeout(TimeValue timeout) { + public CloseIndexRequest timeout(TimeValue timeout) { this.timeout = timeout; return this; } @@ -92,8 +92,8 @@ public class CloseIndexRequest extends MasterNodeOperationRequest10s. */ - 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 MasterNodeOperationRequest10s. */ public CloseIndexRequestBuilder setTimeout(TimeValue timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } @@ -57,7 +57,7 @@ public class CloseIndexRequestBuilder extends MasterNodeOperationRequestBuilder< * to 10s. */ public CloseIndexRequestBuilder setTimeout(String timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java index c698e55fc69..2d36c6b85ab 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java @@ -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 responseRef = new AtomicReference(); final AtomicReference failureRef = new AtomicReference(); 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())); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java index 048fedb98a3..76a9423edae 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java @@ -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)}. *

- *

The index created can optionally be created with {@link #setSettings(org.elasticsearch.common.settings.Settings)}. + *

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 MasterNodeOperationRequestnewMapBuilder().put(type, source).map(); @@ -223,7 +223,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest source) { + public CreateIndexRequest source(Map source) { boolean found = false; for (Map.Entry entry : source.entrySet()) { String name = entry.getKey(); if (name.equals("settings")) { found = true; - setSettings((Map) entry.getValue()); + settings((Map) entry.getValue()); } else if (name.equals("mappings")) { found = true; Map mappings = (Map) entry.getValue(); for (Map.Entry entry1 : mappings.entrySet()) { - addMapping(entry1.getKey(), (Map) entry1.getValue()); + mapping(entry1.getKey(), (Map) entry1.getValue()); } } else { // maybe custom? @@ -302,21 +302,21 @@ public class CreateIndexRequest extends MasterNodeOperationRequest getMappings() { + Map mappings() { return this.mappings; } - public CreateIndexRequest addCustom(IndexMetaData.Custom custom) { + public CreateIndexRequest custom(IndexMetaData.Custom custom) { customs.put(custom.type(), custom); return this; } - Map getCustoms() { + Map customs() { return this.customs; } @@ -324,7 +324,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest10s. */ - TimeValue getTimeout() { + TimeValue timeout() { return timeout; } @@ -332,7 +332,7 @@ public class CreateIndexRequest extends MasterNodeOperationRequest10s. */ - public CreateIndexRequest setTimeout(TimeValue timeout) { + public CreateIndexRequest timeout(TimeValue timeout) { this.timeout = timeout; return this; } @@ -341,8 +341,8 @@ public class CreateIndexRequest extends MasterNodeOperationRequest10s. */ - 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 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 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 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 10s. */ public CreateIndexRequestBuilder setTimeout(TimeValue timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } @@ -197,7 +197,7 @@ public class CreateIndexRequestBuilder extends MasterNodeOperationRequestBuilder * to 10s. */ public CreateIndexRequestBuilder setTimeout(String timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexResponse.java b/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexResponse.java index 67ccac9c42f..7052861e8c5 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexResponse.java @@ -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; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java index 7a53da06fd2..5168c3a2197 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java @@ -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 responseRef = new AtomicReference(); final AtomicReference failureRef = new AtomicReference(); 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) { diff --git a/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequest.java index 5ee102d976a..81c910183d6 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequest.java @@ -63,7 +63,7 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest10s. */ - TimeValue getTimeout() { + TimeValue timeout() { return timeout; } @@ -87,7 +87,7 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest10s. */ - public DeleteIndexRequest setTimeout(TimeValue timeout) { + public DeleteIndexRequest timeout(TimeValue timeout) { this.timeout = timeout; return this; } @@ -96,8 +96,8 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest10s. */ - 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 MasterNodeOperationRequest10s. */ public DeleteIndexRequestBuilder setTimeout(TimeValue timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } @@ -48,7 +48,7 @@ public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder * to 10s. */ public DeleteIndexRequestBuilder setTimeout(String timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java b/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java index f412890f7a0..c1b9718a209 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java @@ -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; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java index c3f5228afa9..979d120a07d 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java @@ -86,15 +86,15 @@ public class TransportDeleteIndexAction extends TransportMasterNodeOperationActi @Override protected void doExecute(DeleteIndexRequest request, ActionListener 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 responseRef = new AtomicReference(); final AtomicReference failureRef = new AtomicReference(); - 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() { + deleteMappingAction.execute(new DeleteMappingRequest(PercolatorService.INDEX_NAME).type(index), new ActionListener() { @Override public void onResponse(DeleteMappingResponse deleteMappingResponse) { latch.countDown(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsRequest.java index d1832e61eb5..ca5745c1dbb 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsRequest.java @@ -37,11 +37,11 @@ public class IndicesExistsRequest extends MasterNodeOperationRequest { 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 false. */ - public boolean isRefresh() { + public boolean refresh() { return this.refresh; } /** * Should a refresh be performed once the flush is done. Defaults to false. */ - public FlushRequest setRefresh(boolean refresh) { + public FlushRequest refresh(boolean refresh) { this.refresh = refresh; return this; } @@ -77,14 +77,14 @@ public class FlushRequest extends BroadcastOperationRequest { /** * 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 { /** * 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; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequestBuilder.java index 2ad7fb048af..9f250e13472 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequestBuilder.java @@ -34,12 +34,12 @@ public class FlushRequestBuilder extends BroadcastOperationRequestBuilder listener) { ((IndicesAdminClient) client).deleteMapping(request, listener); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/delete/TransportDeleteMappingAction.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/delete/TransportDeleteMappingAction.java index d3998e41081..c8acea7b970 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/delete/TransportDeleteMappingAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/delete/TransportDeleteMappingAction.java @@ -91,13 +91,13 @@ public class TransportDeleteMappingAction extends TransportMasterNodeOperationAc @Override protected void doExecute(DeleteMappingRequest request, ActionListener 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 failureRef = new AtomicReference(); final CountDownLatch latch = new CountDownLatch(1); - flushAction.execute(Requests.flushRequest(request.setIndices()), new ActionListener() { + flushAction.execute(Requests.flushRequest(request.indices()), new ActionListener() { @Override public void onResponse(FlushResponse flushResponse) { - deleteByQueryAction.execute(Requests.deleteByQueryRequest(request.setIndices()).setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.typeFilter(request.getType()))), new ActionListener() { + deleteByQueryAction.execute(Requests.deleteByQueryRequest(request.indices()).query(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.typeFilter(request.type()))), new ActionListener() { @Override public void onResponse(DeleteByQueryResponse deleteByQueryResponse) { - refreshAction.execute(Requests.refreshRequest(request.setIndices()), new ActionListener() { + refreshAction.execute(Requests.refreshRequest(request.indices()), new ActionListener() { @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(); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java index 6cb24170fd5..1425f39f778 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java @@ -43,7 +43,7 @@ import static org.elasticsearch.common.unit.TimeValue.readTimeValue; * {@link org.elasticsearch.client.Requests#putMappingRequest(String...)}. *

*

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 MasterNodeOperationRequest10s. */ - public TimeValue getTimeout() { + TimeValue timeout() { return timeout; } @@ -170,7 +170,7 @@ public class PutMappingRequest extends MasterNodeOperationRequest10s. */ - public PutMappingRequest setTimeout(TimeValue timeout) { + public PutMappingRequest timeout(TimeValue timeout) { this.timeout = timeout; return this; } @@ -179,25 +179,25 @@ public class PutMappingRequest extends MasterNodeOperationRequest10s. */ - 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 MasterNodeOperationRequest10s. */ public PutMappingRequestBuilder setTimeout(TimeValue timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } @@ -90,7 +90,7 @@ public class PutMappingRequestBuilder extends MasterNodeOperationRequestBuilder< * 10s. */ 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 listener) { ((IndicesAdminClient) client).putMapping(request, listener); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java index 5b44f6cee23..58edc44ab02 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java @@ -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); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java index 914550a43f1..ad68088e22a 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java @@ -71,13 +71,13 @@ public class TransportPutMappingAction extends TransportMasterNodeOperationActio @Override protected void doExecute(PutMappingRequest request, ActionListener 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 responseRef = new AtomicReference(); final AtomicReference failureRef = new AtomicReference(); 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(); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java index aac9a3526c0..fbcece7273b 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java @@ -62,11 +62,11 @@ public class OpenIndexRequest extends MasterNodeOperationRequest10s. */ - public TimeValue getTimeout() { + TimeValue timeout() { return timeout; } @@ -83,7 +83,7 @@ public class OpenIndexRequest extends MasterNodeOperationRequest10s. */ - public OpenIndexRequest setTimeout(TimeValue timeout) { + public OpenIndexRequest timeout(TimeValue timeout) { this.timeout = timeout; return this; } @@ -92,8 +92,8 @@ public class OpenIndexRequest extends MasterNodeOperationRequest10s. */ - 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 MasterNodeOperationRequest10s. */ public OpenIndexRequestBuilder setTimeout(TimeValue timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } @@ -57,7 +57,7 @@ public class OpenIndexRequestBuilder extends MasterNodeOperationRequestBuilder10s. */ public OpenIndexRequestBuilder setTimeout(String timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java index 49d4155c101..bac9a962b2f 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java @@ -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 responseRef = new AtomicReference(); final AtomicReference failureRef = new AtomicReference(); 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())); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java index 55f07b48c32..f5da29d4783 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequest.java @@ -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 * null for the indices. *

- *

{@link #setWaitForMerge(boolean)} allows to control if the call will block until the optimize completes and + *

{@link #waitForMerge(boolean)} allows to control if the call will block until the optimize completes and * defaults to true. *

- *

{@link #setMaxNumSegments(int)} allows to control the number of segments to optimize down to. By default, will + *

{@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 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 /** * Should the call block until the optimize completes. Defaults to true. */ - public boolean isWaitForMerge() { + public boolean waitForMerge() { return waitForMerge; } /** * Should the call block until the optimize completes. Defaults to true. */ - public OptimizeRequest setWaitForMerge(boolean waitForMerge) { + public OptimizeRequest waitForMerge(boolean waitForMerge) { this.waitForMerge = waitForMerge; return this; } @@ -94,7 +94,7 @@ public class OptimizeRequest extends BroadcastOperationRequest * 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 * 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 * Should the optimization only expunge deletes from the index, without full optimization. * Defaults to full optimization (false). */ - public boolean isOnlyExpungeDeletes() { + public boolean onlyExpungeDeletes() { return onlyExpungeDeletes; } @@ -119,7 +119,7 @@ public class OptimizeRequest extends BroadcastOperationRequest * Should the optimization only expunge deletes from the index, without full optimization. * Defaults to full optimization (false). */ - public OptimizeRequest setOnlyExpungeDeletes(boolean onlyExpungeDeletes) { + public OptimizeRequest onlyExpungeDeletes(boolean onlyExpungeDeletes) { this.onlyExpungeDeletes = onlyExpungeDeletes; return this; } @@ -127,14 +127,14 @@ public class OptimizeRequest extends BroadcastOperationRequest /** * Should flush be performed after the optimization. Defaults to true. */ - public boolean isFlush() { + public boolean flush() { return flush; } /** * Should flush be performed after the optimization. Defaults to true. */ - public OptimizeRequest setFlush(boolean flush) { + public OptimizeRequest flush(boolean flush) { this.flush = flush; return this; } @@ -142,14 +142,14 @@ public class OptimizeRequest extends BroadcastOperationRequest /** * Should refresh be performed after the optimization. Defaults to true. */ - public boolean isRefresh() { + public boolean refresh() { return refresh; } /** * Should refresh be performed after the optimization. Defaults to true. */ - public OptimizeRequest setRefresh(boolean refresh) { + public OptimizeRequest refresh(boolean refresh) { this.refresh = refresh; return this; } @@ -171,4 +171,4 @@ public class OptimizeRequest extends BroadcastOperationRequest out.writeBoolean(flush); out.writeBoolean(refresh); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequestBuilder.java index ce7be147d85..e7e6bac4ed5 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/optimize/OptimizeRequestBuilder.java @@ -44,7 +44,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuildertrue. */ public OptimizeRequestBuilder setWaitForMerge(boolean waitForMerge) { - request.setWaitForMerge(waitForMerge); + request.waitForMerge(waitForMerge); return this; } @@ -53,7 +53,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilderfalse). */ public OptimizeRequestBuilder setOnlyExpungeDeletes(boolean onlyExpungeDeletes) { - request.setOnlyExpungeDeletes(onlyExpungeDeletes); + request.onlyExpungeDeletes(onlyExpungeDeletes); return this; } @@ -70,7 +70,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuildertrue. */ public OptimizeRequestBuilder setFlush(boolean flush) { - request.setFlush(flush); + request.flush(flush); return this; } @@ -78,7 +78,7 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuildertrue. */ public OptimizeRequestBuilder setRefresh(boolean refresh) { - request.setRefresh(refresh); + request.refresh(refresh); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java index 080f56a0452..6f4ab36ff99 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/optimize/ShardOptimizeRequest.java @@ -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); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java b/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java index eea3b0eb46b..47b45693fb9 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java @@ -119,15 +119,15 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction { 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; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshRequestBuilder.java index 480e27d138e..3f42db9f08d 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/refresh/RefreshRequestBuilder.java @@ -36,7 +36,7 @@ public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder failureRef = new AtomicReference(); 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(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java index 32782753faa..f2fcec278ed 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java @@ -74,15 +74,15 @@ public class UpdateSettingsRequest extends MasterNodeOperationRequest source) { - request.setSettings(source); + request.settings(source); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java index 0d4c4678178..5eb9c962eaf 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsRequest.java @@ -28,7 +28,7 @@ import java.io.IOException; /** * A request to get indices level stats. Allow to enable different stats to be returned. *

- *

By default, the {@link #setDocs(boolean)}, {@link #setStore(boolean)}, {@link #setIndexing(boolean)} + *

By default, the {@link #docs(boolean)}, {@link #store(boolean)}, {@link #indexing(boolean)} * are enabled. Other stats can be enabled as well. *

*

All the stats to be returned can be cleared using {@link #clear()}, at which point, specific @@ -85,19 +85,19 @@ public class IndicesStatsRequest extends BroadcastOperationRequestfalse. */ - 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 false. */ - public IndicesStatusRequest setSnapshot(boolean snapshot) { + public IndicesStatusRequest snapshot(boolean snapshot) { this.snapshot = snapshot; return this; } - public boolean isSnapshot() { + public boolean snapshot() { return this.snapshot; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusRequestBuilder.java b/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusRequestBuilder.java index 6758142f90a..58393ce3648 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/status/IndicesStatusRequestBuilder.java @@ -37,7 +37,7 @@ public class IndicesStatusRequestBuilder extends BroadcastOperationRequestBuilde * Should the status include recovery information. Defaults to false. */ 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 false. */ public IndicesStatusRequestBuilder setSnapshot(boolean snapshot) { - request.setSnapshot(snapshot); + request.snapshot(snapshot); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java b/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java index 959425a090b..dc76ebdc771 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java @@ -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 diff --git a/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateRequest.java index 0712d0d133b..388fa0d5828 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateRequest.java @@ -62,7 +62,7 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest10s. */ - public TimeValue getTimeout() { + TimeValue timeout() { return timeout; } @@ -78,7 +78,7 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest10s. */ - public DeleteIndexTemplateRequest setTimeout(TimeValue timeout) { + public DeleteIndexTemplateRequest timeout(TimeValue timeout) { this.timeout = timeout; return this; } @@ -87,8 +87,8 @@ public class DeleteIndexTemplateRequest extends MasterNodeOperationRequest10s. */ - 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 MasterNodeOperationRequest10s. */ public DeleteIndexTemplateRequestBuilder setTimeout(TimeValue timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } @@ -52,7 +52,7 @@ public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationReques * to 10s. */ public DeleteIndexTemplateRequestBuilder setTimeout(String timeout) { - request.setTimeout(timeout); + request.timeout(timeout); return this; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateAction.java b/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateAction.java index 5f1b6fe68bb..77e2a69a886 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateAction.java @@ -79,7 +79,7 @@ public class TransportDeleteIndexTemplateAction extends TransportMasterNodeOpera final AtomicReference failureRef = new AtomicReference(); 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())); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequest.java index 40465402b0c..d0e88eed943 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequest.java @@ -96,7 +96,7 @@ public class PutIndexTemplateRequest extends MasterNodeOperationRequest responseRef = new AtomicReference(); final AtomicReference failureRef = new AtomicReference(); 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()) diff --git a/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ShardValidateQueryRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ShardValidateQueryRequest.java index 512e97df5f4..bd3c22cc303 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ShardValidateQueryRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ShardValidateQueryRequest.java @@ -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; } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/validate/query/TransportValidateQueryAction.java b/src/main/java/org/elasticsearch/action/admin/indices/validate/query/TransportValidateQueryAction.java index 98ce8448901..337aac847b6 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/validate/query/TransportValidateQueryAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/validate/query/TransportValidateQueryAction.java @@ -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> routingMap = clusterState.metaData().resolveSearchRouting(Integer.toString(ThreadLocalRandom.current().nextInt(1000)), request.getIndices()); - return clusterService.operationRouting().searchShards(clusterState, request.getIndices(), concreteIndices, routingMap, "_local"); + Map> 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); } } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ValidateQueryRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ValidateQueryRequest.java index 3651734c2ae..6c5cd7df20f 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ValidateQueryRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ValidateQueryRequest.java @@ -42,8 +42,8 @@ import java.util.Map; /** * A request to validate a specific query. *

- *

The request requires the query source to be set either using {@link #setQuery(org.elasticsearch.index.query.QueryBuilder)}, - * or {@link #setQuery(byte[])}. + *

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 { @@ -84,7 +84,7 @@ public class ValidateQueryRequest extends BroadcastOperationRequest listener) { ((IndicesAdminClient) client).deleteWarmer(request, listener); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/warmer/delete/TransportDeleteWarmerAction.java b/src/main/java/org/elasticsearch/action/admin/indices/warmer/delete/TransportDeleteWarmerAction.java index 4abbda032dc..3ea1cb30b13 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/warmer/delete/TransportDeleteWarmerAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/warmer/delete/TransportDeleteWarmerAction.java @@ -77,13 +77,13 @@ public class TransportDeleteWarmerAction extends TransportMasterNodeOperationAct @Override protected void doExecute(DeleteWarmerRequest request, ActionListener 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 failureRef = new AtomicReference(); 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 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()); } } diff --git a/src/main/java/org/elasticsearch/action/admin/indices/warmer/put/PutWarmerRequest.java b/src/main/java/org/elasticsearch/action/admin/indices/warmer/put/PutWarmerRequest.java index 20950fea53d..3824431b53b 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/warmer/put/PutWarmerRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/warmer/put/PutWarmerRequest.java @@ -56,19 +56,19 @@ public class PutWarmerRequest extends MasterNodeOperationRequest { public PutWarmerRequestBuilder(IndicesAdminClient indicesClient, String name) { - super((InternalIndicesAdminClient) indicesClient, new PutWarmerRequest().setName(name)); + super((InternalIndicesAdminClient) indicesClient, new PutWarmerRequest().name(name)); } public PutWarmerRequestBuilder(IndicesAdminClient indicesClient) { @@ -43,7 +43,7 @@ public class PutWarmerRequestBuilder extends MasterNodeOperationRequestBuilder

listener) { ((IndicesAdminClient) client).putWarmer(request, listener); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/admin/indices/warmer/put/TransportPutWarmerAction.java b/src/main/java/org/elasticsearch/action/admin/indices/warmer/put/TransportPutWarmerAction.java index 4b8ade30b92..da30cd0dfbf 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/warmer/put/TransportPutWarmerAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/warmer/put/TransportPutWarmerAction.java @@ -81,7 +81,7 @@ public class TransportPutWarmerAction extends TransportMasterNodeOperationAction @Override protected ClusterBlockException checkBlock(PutWarmerRequest request, ClusterState state) { - String[] concreteIndices = clusterService.state().metaData().concreteIndices(request.getSearchRequest().getIndices()); + String[] concreteIndices = clusterService.state().metaData().concreteIndices(request.searchRequest().indices()); return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, concreteIndices); } @@ -89,7 +89,7 @@ public class TransportPutWarmerAction extends TransportMasterNodeOperationAction protected PutWarmerResponse masterOperation(final PutWarmerRequest request, ClusterState state) throws ElasticSearchException { // first execute the search request, see that its ok... - SearchResponse searchResponse = searchAction.execute(request.getSearchRequest()).actionGet(); + SearchResponse searchResponse = searchAction.execute(request.searchRequest()).actionGet(); // check no shards errors //TODO: better failure to raise... if (searchResponse.getFailedShards() > 0) { @@ -101,18 +101,18 @@ public class TransportPutWarmerAction extends TransportMasterNodeOperationAction final AtomicReference failureRef = new AtomicReference(); final CountDownLatch latch = new CountDownLatch(1); - clusterService.submitStateUpdateTask("put_warmer [" + request.getName() + "]", new ProcessedClusterStateUpdateTask() { + clusterService.submitStateUpdateTask("put_warmer [" + request.name() + "]", new ProcessedClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { MetaData metaData = currentState.metaData(); - String[] concreteIndices = metaData.concreteIndices(request.getSearchRequest().getIndices()); + String[] concreteIndices = metaData.concreteIndices(request.searchRequest().indices()); BytesReference source = null; - if (request.getSearchRequest().getSource() != null && request.getSearchRequest().getSource().length() > 0) { - source = request.getSearchRequest().getSource(); - } else if (request.getSearchRequest().getExtraSource() != null && request.getSearchRequest().getExtraSource().length() > 0) { - source = request.getSearchRequest().getExtraSource(); + if (request.searchRequest().source() != null && request.searchRequest().source().length() > 0) { + source = request.searchRequest().source(); + } else if (request.searchRequest().extraSource() != null && request.searchRequest().extraSource().length() > 0) { + source = request.searchRequest().extraSource(); } // now replace it on the metadata @@ -125,24 +125,24 @@ public class TransportPutWarmerAction extends TransportMasterNodeOperationAction } IndexWarmersMetaData warmers = indexMetaData.custom(IndexWarmersMetaData.TYPE); if (warmers == null) { - logger.info("[{}] putting warmer [{}]", index, request.getName()); - warmers = new IndexWarmersMetaData(new IndexWarmersMetaData.Entry(request.getName(), request.getSearchRequest().getTypes(), source)); + logger.info("[{}] putting warmer [{}]", index, request.name()); + warmers = new IndexWarmersMetaData(new IndexWarmersMetaData.Entry(request.name(), request.searchRequest().types(), source)); } else { boolean found = false; List entries = new ArrayList(warmers.entries().size() + 1); for (IndexWarmersMetaData.Entry entry : warmers.entries()) { - if (entry.name().equals(request.getName())) { + if (entry.name().equals(request.name())) { found = true; - entries.add(new IndexWarmersMetaData.Entry(request.getName(), request.getSearchRequest().getTypes(), source)); + entries.add(new IndexWarmersMetaData.Entry(request.name(), request.searchRequest().types(), source)); } else { entries.add(entry); } } if (!found) { - logger.info("[{}] put warmer [{}]", index, request.getName()); - entries.add(new IndexWarmersMetaData.Entry(request.getName(), request.getSearchRequest().getTypes(), source)); + logger.info("[{}] put warmer [{}]", index, request.name()); + entries.add(new IndexWarmersMetaData.Entry(request.name(), request.searchRequest().types(), source)); } else { - logger.info("[{}] update warmer [{}]", index, request.getName()); + logger.info("[{}] update warmer [{}]", index, request.name()); } warmers = new IndexWarmersMetaData(entries.toArray(new IndexWarmersMetaData.Entry[entries.size()])); } @@ -175,4 +175,4 @@ public class TransportPutWarmerAction extends TransportMasterNodeOperationAction return new PutWarmerResponse(true); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/bulk/BulkItemRequest.java b/src/main/java/org/elasticsearch/action/bulk/BulkItemRequest.java index 80319dfb494..24233054c34 100644 --- a/src/main/java/org/elasticsearch/action/bulk/BulkItemRequest.java +++ b/src/main/java/org/elasticsearch/action/bulk/BulkItemRequest.java @@ -46,11 +46,11 @@ public class BulkItemRequest implements Streamable { this.request = request; } - public int getId() { + public int id() { return id; } - public ActionRequest getRequest() { + public ActionRequest request() { return request; } diff --git a/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java b/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java index 5fe449b5543..1293a699d58 100644 --- a/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java +++ b/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java @@ -121,7 +121,7 @@ public class BulkRequest extends ActionRequest { BulkRequest internalAdd(IndexRequest request, @Nullable Object payload) { requests.add(request); addPayload(payload); - sizeInBytes += request.getSource().length() + REQUEST_OVERHEAD; + sizeInBytes += request.source().length() + REQUEST_OVERHEAD; return this; } @@ -285,7 +285,7 @@ public class BulkRequest extends ActionRequest { } if ("delete".equals(action)) { - add(new DeleteRequest(index, type, id).setParent(parent).setVersion(version).setVersionType(versionType).setRouting(routing), payload); + add(new DeleteRequest(index, type, id).parent(parent).version(version).versionType(versionType).routing(routing), payload); } else { nextMarker = findNextMarker(marker, from, data, length); if (nextMarker == -1) { @@ -296,20 +296,20 @@ public class BulkRequest extends ActionRequest { // of index request. All index requests are still unsafe if applicable. if ("index".equals(action)) { if (opType == null) { - internalAdd(new IndexRequest(index, type, id).setRouting(routing).setParent(parent).setTimestamp(timestamp).setTtl(ttl).setVersion(version).setVersionType(versionType) - .setSource(data.slice(from, nextMarker - from), contentUnsafe) - .setPercolate(percolate), payload); + internalAdd(new IndexRequest(index, type, id).routing(routing).parent(parent).timestamp(timestamp).ttl(ttl).version(version).versionType(versionType) + .source(data.slice(from, nextMarker - from), contentUnsafe) + .percolate(percolate), payload); } else { - internalAdd(new IndexRequest(index, type, id).setRouting(routing).setParent(parent).setTimestamp(timestamp).setTtl(ttl).setVersion(version).setVersionType(versionType) - .setCreate("create".equals(opType)) - .setSource(data.slice(from, nextMarker - from), contentUnsafe) - .setPercolate(percolate), payload); + internalAdd(new IndexRequest(index, type, id).routing(routing).parent(parent).timestamp(timestamp).ttl(ttl).version(version).versionType(versionType) + .create("create".equals(opType)) + .source(data.slice(from, nextMarker - from), contentUnsafe) + .percolate(percolate), payload); } } else if ("create".equals(action)) { - internalAdd(new IndexRequest(index, type, id).setRouting(routing).setParent(parent).setTimestamp(timestamp).setTtl(ttl).setVersion(version).setVersionType(versionType) - .setCreate(true) - .setSource(data.slice(from, nextMarker - from), contentUnsafe) - .setPercolate(percolate), payload); + internalAdd(new IndexRequest(index, type, id).routing(routing).parent(parent).timestamp(timestamp).ttl(ttl).version(version).versionType(versionType) + .create(true) + .source(data.slice(from, nextMarker - from), contentUnsafe) + .percolate(percolate), payload); } // move pointers from = nextMarker + 1; diff --git a/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java b/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java index 76302b89779..afa983ff891 100644 --- a/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java +++ b/src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java @@ -46,15 +46,15 @@ public class BulkShardRequest extends ShardReplicationOperationRequest() { + createIndexAction.execute(new CreateIndexRequest(index).cause("auto(bulk api)"), new ActionListener() { @Override public void onResponse(CreateIndexResponse result) { if (counter.decrementAndGet() == 0) { @@ -148,18 +148,18 @@ public class TransportBulkAction extends TransportAction list = requestsByShard.get(shardId); if (list == null) { list = Lists.newArrayList(); @@ -180,10 +180,10 @@ public class TransportBulkAction extends TransportAction list = requestsByShard.get(shardIt.shardId()); if (list == null) { @@ -193,7 +193,7 @@ public class TransportBulkAction extends TransportAction list = requestsByShard.get(shardId); if (list == null) { list = Lists.newArrayList(); @@ -214,8 +214,8 @@ public class TransportBulkAction extends TransportAction requests = entry.getValue(); BulkShardRequest bulkShardRequest = new BulkShardRequest(shardId.index().name(), shardId.id(), bulkRequest.refresh(), requests.toArray(new BulkItemRequest[requests.size()])); - bulkShardRequest.setReplicationType(bulkRequest.replicationType()); - bulkShardRequest.setConsistencyLevel(bulkRequest.consistencyLevel()); + bulkShardRequest.replicationType(bulkRequest.replicationType()); + bulkShardRequest.consistencyLevel(bulkRequest.consistencyLevel()); shardBulkAction.execute(bulkShardRequest, new ActionListener() { @Override public void onResponse(BulkShardResponse bulkShardResponse) { @@ -235,14 +235,14 @@ public class TransportBulkAction extends TransportAction() { @Override public void onResponse(BulkResponse result) { diff --git a/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java b/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java index bb344a5c10f..bbf1ac8ec5c 100644 --- a/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java +++ b/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java @@ -115,126 +115,126 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation @Override protected ClusterBlockException checkRequestBlock(ClusterState state, BulkShardRequest request) { - return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.getIndex()); + return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.index()); } @Override protected ShardIterator shards(ClusterState clusterState, BulkShardRequest request) { - return clusterState.routingTable().index(request.getIndex()).shard(request.getShardId()).shardsIt(); + return clusterState.routingTable().index(request.index()).shard(request.shardId()).shardsIt(); } @Override protected PrimaryResponse shardOperationOnPrimary(ClusterState clusterState, PrimaryOperationRequest shardRequest) { final BulkShardRequest request = shardRequest.request; - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); Engine.IndexingOperation[] ops = null; Set> mappingsToUpdate = null; - BulkItemResponse[] responses = new BulkItemResponse[request.getItems().length]; - long[] versions = new long[request.getItems().length]; - for (int i = 0; i < request.getItems().length; i++) { - BulkItemRequest item = request.getItems()[i]; - if (item.getRequest() instanceof IndexRequest) { - IndexRequest indexRequest = (IndexRequest) item.getRequest(); + BulkItemResponse[] responses = new BulkItemResponse[request.items().length]; + long[] versions = new long[request.items().length]; + for (int i = 0; i < request.items().length; i++) { + BulkItemRequest item = request.items()[i]; + if (item.request() instanceof IndexRequest) { + IndexRequest indexRequest = (IndexRequest) item.request(); try { // validate, if routing is required, that we got routing - MappingMetaData mappingMd = clusterState.metaData().index(request.getIndex()).mappingOrDefault(indexRequest.getType()); + MappingMetaData mappingMd = clusterState.metaData().index(request.index()).mappingOrDefault(indexRequest.type()); if (mappingMd != null && mappingMd.routing().required()) { - if (indexRequest.getRouting() == null) { - throw new RoutingMissingException(indexRequest.getIndex(), indexRequest.getType(), indexRequest.getId()); + if (indexRequest.routing() == null) { + throw new RoutingMissingException(indexRequest.index(), indexRequest.type(), indexRequest.id()); } } - SourceToParse sourceToParse = SourceToParse.source(indexRequest.getSource()).type(indexRequest.getType()).id(indexRequest.getId()) - .routing(indexRequest.getRouting()).parent(indexRequest.getParent()).timestamp(indexRequest.getTimestamp()).ttl(indexRequest.getTtl()); + SourceToParse sourceToParse = SourceToParse.source(indexRequest.source()).type(indexRequest.type()).id(indexRequest.id()) + .routing(indexRequest.routing()).parent(indexRequest.parent()).timestamp(indexRequest.timestamp()).ttl(indexRequest.ttl()); long version; Engine.IndexingOperation op; - if (indexRequest.getOpType() == IndexRequest.OpType.INDEX) { - Engine.Index index = indexShard.prepareIndex(sourceToParse).version(indexRequest.getVersion()).versionType(indexRequest.getVersionType()).origin(Engine.Operation.Origin.PRIMARY); + if (indexRequest.opType() == IndexRequest.OpType.INDEX) { + Engine.Index index = indexShard.prepareIndex(sourceToParse).version(indexRequest.version()).versionType(indexRequest.versionType()).origin(Engine.Operation.Origin.PRIMARY); indexShard.index(index); version = index.version(); op = index; } else { - Engine.Create create = indexShard.prepareCreate(sourceToParse).version(indexRequest.getVersion()).versionType(indexRequest.getVersionType()).origin(Engine.Operation.Origin.PRIMARY); + Engine.Create create = indexShard.prepareCreate(sourceToParse).version(indexRequest.version()).versionType(indexRequest.versionType()).origin(Engine.Operation.Origin.PRIMARY); indexShard.create(create); version = create.version(); op = create; } - versions[i] = indexRequest.getVersion(); + versions[i] = indexRequest.version(); // update the version on request so it will happen on the replicas - indexRequest.setVersion(version); + indexRequest.version(version); // update mapping on master if needed, we won't update changes to the same type, since once its changed, it won't have mappers added if (op.parsedDoc().mappingsModified()) { if (mappingsToUpdate == null) { mappingsToUpdate = Sets.newHashSet(); } - mappingsToUpdate.add(Tuple.tuple(indexRequest.getIndex(), indexRequest.getType())); + mappingsToUpdate.add(Tuple.tuple(indexRequest.index(), indexRequest.type())); } // if we are going to percolate, then we need to keep this op for the postPrimary operation - if (Strings.hasLength(indexRequest.getPercolate())) { + if (Strings.hasLength(indexRequest.percolate())) { if (ops == null) { - ops = new Engine.IndexingOperation[request.getItems().length]; + ops = new Engine.IndexingOperation[request.items().length]; } ops[i] = op; } // add the response - responses[i] = new BulkItemResponse(item.getId(), indexRequest.getOpType().lowercase(), - new IndexResponse(indexRequest.getIndex(), indexRequest.getType(), indexRequest.getId(), version)); + responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().lowercase(), + new IndexResponse(indexRequest.index(), indexRequest.type(), indexRequest.id(), version)); } catch (Exception e) { // rethrow the failure if we are going to retry on primary and let parent failure to handle it if (retryPrimaryException(e)) { // restore updated versions... for (int j = 0; j < i; j++) { - applyVersion(request.getItems()[j], versions[j]); + applyVersion(request.items()[j], versions[j]); } throw (ElasticSearchException) e; } if (e instanceof ElasticSearchException && ((ElasticSearchException) e).status() == RestStatus.CONFLICT) { - logger.trace("[{}][{}] failed to execute bulk item (index) {}", e, shardRequest.request.getIndex(), shardRequest.shardId, indexRequest); + logger.trace("[{}][{}] failed to execute bulk item (index) {}", e, shardRequest.request.index(), shardRequest.shardId, indexRequest); } else { - logger.debug("[{}][{}] failed to execute bulk item (index) {}", e, shardRequest.request.getIndex(), shardRequest.shardId, indexRequest); + logger.debug("[{}][{}] failed to execute bulk item (index) {}", e, shardRequest.request.index(), shardRequest.shardId, indexRequest); } - responses[i] = new BulkItemResponse(item.getId(), indexRequest.getOpType().lowercase(), - new BulkItemResponse.Failure(indexRequest.getIndex(), indexRequest.getType(), indexRequest.getId(), ExceptionsHelper.detailedMessage(e))); + responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().lowercase(), + new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), indexRequest.id(), ExceptionsHelper.detailedMessage(e))); // nullify the request so it won't execute on the replicas - request.getItems()[i] = null; + request.items()[i] = null; } - } else if (item.getRequest() instanceof DeleteRequest) { - DeleteRequest deleteRequest = (DeleteRequest) item.getRequest(); + } else if (item.request() instanceof DeleteRequest) { + DeleteRequest deleteRequest = (DeleteRequest) item.request(); try { - Engine.Delete delete = indexShard.prepareDelete(deleteRequest.getType(), deleteRequest.getId(), deleteRequest.getVersion()).versionType(deleteRequest.getVersionType()).origin(Engine.Operation.Origin.PRIMARY); + Engine.Delete delete = indexShard.prepareDelete(deleteRequest.type(), deleteRequest.id(), deleteRequest.version()).versionType(deleteRequest.versionType()).origin(Engine.Operation.Origin.PRIMARY); indexShard.delete(delete); // update the request with teh version so it will go to the replicas - deleteRequest.setVersion(delete.version()); + deleteRequest.version(delete.version()); // add the response - responses[i] = new BulkItemResponse(item.getId(), "delete", - new DeleteResponse(deleteRequest.getIndex(), deleteRequest.getType(), deleteRequest.getId(), delete.version(), delete.notFound())); + responses[i] = new BulkItemResponse(item.id(), "delete", + new DeleteResponse(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), delete.version(), delete.notFound())); } catch (Exception e) { // rethrow the failure if we are going to retry on primary and let parent failure to handle it if (retryPrimaryException(e)) { // restore updated versions... for (int j = 0; j < i; j++) { - applyVersion(request.getItems()[j], versions[j]); + applyVersion(request.items()[j], versions[j]); } throw (ElasticSearchException) e; } if (e instanceof ElasticSearchException && ((ElasticSearchException) e).status() == RestStatus.CONFLICT) { - logger.trace("[{}][{}] failed to execute bulk item (delete) {}", e, shardRequest.request.getIndex(), shardRequest.shardId, deleteRequest); + logger.trace("[{}][{}] failed to execute bulk item (delete) {}", e, shardRequest.request.index(), shardRequest.shardId, deleteRequest); } else { - logger.debug("[{}][{}] failed to execute bulk item (delete) {}", e, shardRequest.request.getIndex(), shardRequest.shardId, deleteRequest); + logger.debug("[{}][{}] failed to execute bulk item (delete) {}", e, shardRequest.request.index(), shardRequest.shardId, deleteRequest); } - responses[i] = new BulkItemResponse(item.getId(), "delete", - new BulkItemResponse.Failure(deleteRequest.getIndex(), deleteRequest.getType(), deleteRequest.getId(), ExceptionsHelper.detailedMessage(e))); + responses[i] = new BulkItemResponse(item.id(), "delete", + new BulkItemResponse.Failure(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), ExceptionsHelper.detailedMessage(e))); // nullify the request so it won't execute on the replicas - request.getItems()[i] = null; + request.items()[i] = null; } } } @@ -245,26 +245,26 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation } } - if (request.isRefresh()) { + if (request.refresh()) { try { indexShard.refresh(new Engine.Refresh(false)); } catch (Exception e) { // ignore } } - BulkShardResponse response = new BulkShardResponse(new ShardId(request.getIndex(), request.getShardId()), responses); + BulkShardResponse response = new BulkShardResponse(new ShardId(request.index(), request.shardId()), responses); return new PrimaryResponse(shardRequest.request, response, ops); } @Override protected void postPrimaryOperation(BulkShardRequest request, PrimaryResponse response) { - IndexService indexService = indicesService.indexServiceSafe(request.getIndex()); + IndexService indexService = indicesService.indexServiceSafe(request.index()); Engine.IndexingOperation[] ops = (Engine.IndexingOperation[]) response.payload(); if (ops == null) { return; } for (int i = 0; i < ops.length; i++) { - BulkItemRequest itemRequest = request.getItems()[i]; + BulkItemRequest itemRequest = request.items()[i]; BulkItemResponse itemResponse = response.response().getResponses()[i]; if (itemResponse.isFailed()) { // failure, continue @@ -274,16 +274,16 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation if (op == null) { continue; // failed / no matches requested } - if (itemRequest.getRequest() instanceof IndexRequest) { - IndexRequest indexRequest = (IndexRequest) itemRequest.getRequest(); - if (!Strings.hasLength(indexRequest.getPercolate())) { + if (itemRequest.request() instanceof IndexRequest) { + IndexRequest indexRequest = (IndexRequest) itemRequest.request(); + if (!Strings.hasLength(indexRequest.percolate())) { continue; } try { - PercolatorExecutor.Response percolate = indexService.percolateService().percolate(new PercolatorExecutor.DocAndSourceQueryRequest(op.parsedDoc(), indexRequest.getPercolate())); + PercolatorExecutor.Response percolate = indexService.percolateService().percolate(new PercolatorExecutor.DocAndSourceQueryRequest(op.parsedDoc(), indexRequest.percolate())); ((IndexResponse) itemResponse.getResponse()).setMatches(percolate.matches()); } catch (Exception e) { - logger.warn("failed to percolate [{}]", e, itemRequest.getRequest()); + logger.warn("failed to percolate [{}]", e, itemRequest.request()); } } } @@ -291,33 +291,33 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation @Override protected void shardOperationOnReplica(ReplicaOperationRequest shardRequest) { - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); final BulkShardRequest request = shardRequest.request; - for (int i = 0; i < request.getItems().length; i++) { - BulkItemRequest item = request.getItems()[i]; + for (int i = 0; i < request.items().length; i++) { + BulkItemRequest item = request.items()[i]; if (item == null) { continue; } - if (item.getRequest() instanceof IndexRequest) { - IndexRequest indexRequest = (IndexRequest) item.getRequest(); + if (item.request() instanceof IndexRequest) { + IndexRequest indexRequest = (IndexRequest) item.request(); try { - SourceToParse sourceToParse = SourceToParse.source(indexRequest.getSource()).type(indexRequest.getType()).id(indexRequest.getId()) - .routing(indexRequest.getRouting()).parent(indexRequest.getParent()).timestamp(indexRequest.getTimestamp()).ttl(indexRequest.getTtl()); + SourceToParse sourceToParse = SourceToParse.source(indexRequest.source()).type(indexRequest.type()).id(indexRequest.id()) + .routing(indexRequest.routing()).parent(indexRequest.parent()).timestamp(indexRequest.timestamp()).ttl(indexRequest.ttl()); - if (indexRequest.getOpType() == IndexRequest.OpType.INDEX) { - Engine.Index index = indexShard.prepareIndex(sourceToParse).version(indexRequest.getVersion()).origin(Engine.Operation.Origin.REPLICA); + if (indexRequest.opType() == IndexRequest.OpType.INDEX) { + Engine.Index index = indexShard.prepareIndex(sourceToParse).version(indexRequest.version()).origin(Engine.Operation.Origin.REPLICA); indexShard.index(index); } else { - Engine.Create create = indexShard.prepareCreate(sourceToParse).version(indexRequest.getVersion()).origin(Engine.Operation.Origin.REPLICA); + Engine.Create create = indexShard.prepareCreate(sourceToParse).version(indexRequest.version()).origin(Engine.Operation.Origin.REPLICA); indexShard.create(create); } } catch (Exception e) { // ignore, we are on backup } - } else if (item.getRequest() instanceof DeleteRequest) { - DeleteRequest deleteRequest = (DeleteRequest) item.getRequest(); + } else if (item.request() instanceof DeleteRequest) { + DeleteRequest deleteRequest = (DeleteRequest) item.request(); try { - Engine.Delete delete = indexShard.prepareDelete(deleteRequest.getType(), deleteRequest.getId(), deleteRequest.getVersion()).origin(Engine.Operation.Origin.REPLICA); + Engine.Delete delete = indexShard.prepareDelete(deleteRequest.type(), deleteRequest.id(), deleteRequest.version()).origin(Engine.Operation.Origin.REPLICA); indexShard.delete(delete); } catch (Exception e) { // ignore, we are on backup @@ -325,7 +325,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation } } - if (request.isRefresh()) { + if (request.refresh()) { try { indexShard.refresh(new Engine.Refresh(false)); } catch (Exception e) { @@ -364,10 +364,10 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation } private void applyVersion(BulkItemRequest item, long version) { - if (item.getRequest() instanceof IndexRequest) { - ((IndexRequest) item.getRequest()).setVersion(version); - } else if (item.getRequest() instanceof DeleteRequest) { - ((DeleteRequest) item.getRequest()).setVersion(version); + if (item.request() instanceof IndexRequest) { + ((IndexRequest) item.request()).version(version); + } else if (item.request() instanceof DeleteRequest) { + ((DeleteRequest) item.request()).version(version); } else { // log? } diff --git a/src/main/java/org/elasticsearch/action/count/CountRequest.java b/src/main/java/org/elasticsearch/action/count/CountRequest.java index ded18bb7c56..c85ef0612c3 100644 --- a/src/main/java/org/elasticsearch/action/count/CountRequest.java +++ b/src/main/java/org/elasticsearch/action/count/CountRequest.java @@ -44,8 +44,8 @@ import java.util.Map; * A request to count the number of documents matching a specific query. Best created with * {@link org.elasticsearch.client.Requests#countRequest(String...)}. *

- *

The request requires the query source to be set either using {@link #setQuery(org.elasticsearch.index.query.QueryBuilder)}, - * or {@link #setQuery(byte[])}. + *

The request requires the query source to be set either using {@link #query(org.elasticsearch.index.query.QueryBuilder)}, + * or {@link #query(byte[])}. * * @see CountResponse * @see org.elasticsearch.client.Client#count(CountRequest) @@ -95,7 +95,7 @@ public class CountRequest extends BroadcastOperationRequest { /** * The minimum score of the documents to include in the count. */ - public float getMinScore() { + float minScore() { return minScore; } @@ -103,7 +103,7 @@ public class CountRequest extends BroadcastOperationRequest { * The minimum score of the documents to include in the count. Defaults to -1 which means all * documents will be included in the count. */ - public CountRequest setMinScore(float minScore) { + public CountRequest minScore(float minScore) { this.minScore = minScore; return this; } @@ -111,7 +111,7 @@ public class CountRequest extends BroadcastOperationRequest { /** * The query source to execute. */ - public BytesReference getQuerySource() { + BytesReference querySource() { return querySource; } @@ -121,7 +121,7 @@ public class CountRequest extends BroadcastOperationRequest { * @see org.elasticsearch.index.query.QueryBuilders */ @Required - public CountRequest setQuery(QueryBuilder queryBuilder) { + public CountRequest query(QueryBuilder queryBuilder) { this.querySource = queryBuilder.buildAsBytes(); this.querySourceUnsafe = false; return this; @@ -131,29 +131,29 @@ public class CountRequest extends BroadcastOperationRequest { * The query source to execute in the form of a map. */ @Required - public CountRequest setQuery(Map querySource) { + public CountRequest 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 CountRequest setQuery(XContentBuilder builder) { + public CountRequest query(XContentBuilder builder) { this.querySource = builder.bytes(); this.querySourceUnsafe = false; return this; } /** - * The query source to execute. It is preferable to use either {@link #setQuery(byte[])} - * or {@link #setQuery(org.elasticsearch.index.query.QueryBuilder)}. + * The query source to execute. It is preferable to use either {@link #query(byte[])} + * or {@link #query(org.elasticsearch.index.query.QueryBuilder)}. */ @Required - public CountRequest setQuery(String querySource) { + public CountRequest query(String querySource) { this.querySource = new BytesArray(querySource); this.querySourceUnsafe = false; return this; @@ -163,20 +163,20 @@ public class CountRequest extends BroadcastOperationRequest { * The query source to execute. */ @Required - public CountRequest setQuery(byte[] querySource) { - return setQuery(querySource, 0, querySource.length, false); + public CountRequest query(byte[] querySource) { + return query(querySource, 0, querySource.length, false); } /** * The query source to execute. */ @Required - public CountRequest setQuery(byte[] querySource, int offset, int length, boolean unsafe) { - return setQuery(new BytesArray(querySource, offset, length), unsafe); + public CountRequest query(byte[] querySource, int offset, int length, boolean unsafe) { + return query(new BytesArray(querySource, offset, length), unsafe); } @Required - public CountRequest setQuery(BytesReference querySource, boolean unsafe) { + public CountRequest query(BytesReference querySource, boolean unsafe) { this.querySource = querySource; this.querySourceUnsafe = unsafe; return this; @@ -185,14 +185,14 @@ public class CountRequest extends BroadcastOperationRequest { /** * 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 CountRequest setTypes(String... types) { + public CountRequest types(String... types) { this.types = types; return this; } @@ -200,14 +200,14 @@ public class CountRequest extends BroadcastOperationRequest { /** * A comma separated list of routing values to control the shards the search will be executed on. */ - public String getRouting() { + public String routing() { return this.routing; } /** * A comma separated list of routing values to control the shards the search will be executed on. */ - public CountRequest setRouting(String routing) { + public CountRequest routing(String routing) { this.routing = routing; return this; } @@ -215,7 +215,7 @@ public class CountRequest extends BroadcastOperationRequest { /** * The routing values to control the shards that the search will be executed on. */ - public CountRequest setRouting(String... routings) { + public CountRequest routing(String... routings) { this.routing = Strings.arrayToCommaDelimitedString(routings); return this; } diff --git a/src/main/java/org/elasticsearch/action/count/CountRequestBuilder.java b/src/main/java/org/elasticsearch/action/count/CountRequestBuilder.java index 4515b7a8d03..83271b1177b 100644 --- a/src/main/java/org/elasticsearch/action/count/CountRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/count/CountRequestBuilder.java @@ -39,7 +39,7 @@ public class CountRequestBuilder extends BroadcastOperationRequestBuilder> routingMap = clusterState.metaData().resolveSearchRouting(request.getRouting(), request.getIndices()); - return clusterService.operationRouting().searchShards(clusterState, request.getIndices(), concreteIndices, routingMap, null); + Map> routingMap = clusterState.metaData().resolveSearchRouting(request.routing(), request.indices()); + return clusterService.operationRouting().searchShards(clusterState, request.indices(), concreteIndices, routingMap, null); } @Override @@ -143,25 +143,25 @@ public class TransportCountAction extends TransportBroadcastOperationAction 0) { try { - QueryParseContext.setTypes(request.getTypes()); + QueryParseContext.setTypes(request.types()); context.parsedQuery(indexService.queryParserService().parse(querySource)); } finally { QueryParseContext.removeTypes(); @@ -170,7 +170,7 @@ public class TransportCountAction extends TransportBroadcastOperationAction - *

The operation requires the {@link #getIndex()}, {@link #setType(String)} and {@link #setId(String)} to + *

The operation requires the {@link #index()}, {@link #type(String)} and {@link #id(String)} to * be set. * * @see DeleteResponse @@ -53,7 +53,7 @@ public class DeleteRequest extends ShardReplicationOperationRequesttrue. Defaults * to false. */ - public DeleteRequest setRefresh(boolean refresh) { + public DeleteRequest refresh(boolean refresh) { this.refresh = refresh; return this; } - public boolean isRefresh() { + public boolean refresh() { return this.refresh; } @@ -180,21 +180,21 @@ public class DeleteRequest extends ShardReplicationOperationRequestfalse. */ public DeleteRequestBuilder setRefresh(boolean refresh) { - request.setRefresh(refresh); + request.refresh(refresh); return this; } @@ -90,7 +90,7 @@ public class DeleteRequestBuilder extends ShardReplicationOperationRequestBuilde * version exists and no changes happened on the doc since then. */ public DeleteRequestBuilder setVersion(long version) { - request.setVersion(version); + request.version(version); return this; } @@ -98,7 +98,7 @@ public class DeleteRequestBuilder extends ShardReplicationOperationRequestBuilde * Sets the type of versioning to use. Defaults to {@link VersionType#INTERNAL}. */ public DeleteRequestBuilder setVersionType(VersionType versionType) { - request.setVersionType(versionType); + request.versionType(versionType); return this; } @@ -106,7 +106,7 @@ public class DeleteRequestBuilder extends ShardReplicationOperationRequestBuilde * Set the replication type for this operation. */ public DeleteRequestBuilder setReplicationType(ReplicationType replicationType) { - request.setReplicationType(replicationType); + request.replicationType(replicationType); return this; } @@ -114,7 +114,7 @@ public class DeleteRequestBuilder extends ShardReplicationOperationRequestBuilde * Sets the consistency level. Defaults to {@link org.elasticsearch.action.WriteConsistencyLevel#DEFAULT}. */ public DeleteRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel) { - request.setConsistencyLevel(consistencyLevel); + request.consistencyLevel(consistencyLevel); return this; } diff --git a/src/main/java/org/elasticsearch/action/delete/TransportDeleteAction.java b/src/main/java/org/elasticsearch/action/delete/TransportDeleteAction.java index 4bb5c883b61..c6483ce3e91 100644 --- a/src/main/java/org/elasticsearch/action/delete/TransportDeleteAction.java +++ b/src/main/java/org/elasticsearch/action/delete/TransportDeleteAction.java @@ -74,9 +74,9 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct @Override protected void doExecute(final DeleteRequest request, final ActionListener listener) { - if (autoCreateIndex.shouldAutoCreate(request.getIndex(), clusterService.state())) { + if (autoCreateIndex.shouldAutoCreate(request.index(), clusterService.state())) { request.beforeLocalFork(); - createIndexAction.execute(new CreateIndexRequest(request.getIndex()).setCause("auto(delete api)").setMasterNodeTimeout(request.getTimeout()), new ActionListener() { + createIndexAction.execute(new CreateIndexRequest(request.index()).cause("auto(delete api)").masterNodeTimeout(request.timeout()), new ActionListener() { @Override public void onResponse(CreateIndexResponse result) { innerExecute(request, listener); @@ -99,13 +99,13 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct @Override protected boolean resolveRequest(final ClusterState state, final DeleteRequest request, final ActionListener listener) { - request.setRouting(state.metaData().resolveIndexRouting(request.getRouting(), request.getIndex())); - request.setIndex(state.metaData().concreteIndex(request.getIndex())); - if (state.metaData().hasIndex(request.getIndex())) { + request.routing(state.metaData().resolveIndexRouting(request.routing(), request.index())); + request.index(state.metaData().concreteIndex(request.index())); + if (state.metaData().hasIndex(request.index())) { // check if routing is required, if so, do a broadcast delete - MappingMetaData mappingMd = state.metaData().index(request.getIndex()).mappingOrDefault(request.getType()); + MappingMetaData mappingMd = state.metaData().index(request.index()).mappingOrDefault(request.type()); if (mappingMd != null && mappingMd.routing().required()) { - if (request.getRouting() == null) { + if (request.routing() == null) { indexDeleteAction.execute(new IndexDeleteRequest(request), new ActionListener() { @Override public void onResponse(IndexDeleteResponse indexDeleteResponse) { @@ -119,7 +119,7 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct break; } } - listener.onResponse(new DeleteResponse(request.getIndex(), request.getType(), request.getId(), version, !found)); + listener.onResponse(new DeleteResponse(request.index(), request.type(), request.id(), version, !found)); } @Override @@ -170,21 +170,21 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct @Override protected ClusterBlockException checkRequestBlock(ClusterState state, DeleteRequest request) { - return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.getIndex()); + return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.index()); } @Override protected PrimaryResponse shardOperationOnPrimary(ClusterState clusterState, PrimaryOperationRequest shardRequest) { DeleteRequest request = shardRequest.request; - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); - Engine.Delete delete = indexShard.prepareDelete(request.getType(), request.getId(), request.getVersion()) - .versionType(request.getVersionType()) + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); + Engine.Delete delete = indexShard.prepareDelete(request.type(), request.id(), request.version()) + .versionType(request.versionType()) .origin(Engine.Operation.Origin.PRIMARY); indexShard.delete(delete); // update the request with teh version so it will go to the replicas - request.setVersion(delete.version()); + request.version(delete.version()); - if (request.isRefresh()) { + if (request.refresh()) { try { indexShard.refresh(new Engine.Refresh(false)); } catch (Exception e) { @@ -192,20 +192,20 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct } } - DeleteResponse response = new DeleteResponse(request.getIndex(), request.getType(), request.getId(), delete.version(), delete.notFound()); + DeleteResponse response = new DeleteResponse(request.index(), request.type(), request.id(), delete.version(), delete.notFound()); return new PrimaryResponse(shardRequest.request, response, null); } @Override protected void shardOperationOnReplica(ReplicaOperationRequest shardRequest) { DeleteRequest request = shardRequest.request; - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); - Engine.Delete delete = indexShard.prepareDelete(request.getType(), request.getId(), request.getVersion()) + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); + Engine.Delete delete = indexShard.prepareDelete(request.type(), request.id(), request.version()) .origin(Engine.Operation.Origin.REPLICA); indexShard.delete(delete); - if (request.isRefresh()) { + if (request.refresh()) { try { indexShard.refresh(new Engine.Refresh(false)); } catch (Exception e) { @@ -218,6 +218,6 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct @Override protected ShardIterator shards(ClusterState clusterState, DeleteRequest request) { return clusterService.operationRouting() - .deleteShards(clusterService.state(), request.getIndex(), request.getType(), request.getId(), request.getRouting()); + .deleteShards(clusterService.state(), request.index(), request.type(), request.id(), request.routing()); } } diff --git a/src/main/java/org/elasticsearch/action/delete/index/IndexDeleteRequest.java b/src/main/java/org/elasticsearch/action/delete/index/IndexDeleteRequest.java index 4fcdd2751b9..ba2779eebf0 100644 --- a/src/main/java/org/elasticsearch/action/delete/index/IndexDeleteRequest.java +++ b/src/main/java/org/elasticsearch/action/delete/index/IndexDeleteRequest.java @@ -40,29 +40,29 @@ public class IndexDeleteRequest extends IndexReplicationOperationRequest shardOperationOnPrimary(ClusterState clusterState, PrimaryOperationRequest shardRequest) { ShardDeleteRequest request = shardRequest.request; - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); - Engine.Delete delete = indexShard.prepareDelete(request.getType(), request.getId(), request.getVersion()) + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); + Engine.Delete delete = indexShard.prepareDelete(request.type(), request.id(), request.version()) .origin(Engine.Operation.Origin.PRIMARY); indexShard.delete(delete); // update the version to happen on the replicas - request.setVersion(delete.version()); + request.version(delete.version()); - if (request.isRefresh()) { + if (request.refresh()) { try { indexShard.refresh(new Engine.Refresh(false)); } catch (Exception e) { @@ -114,12 +114,12 @@ public class TransportShardDeleteAction extends TransportShardReplicationOperati @Override protected void shardOperationOnReplica(ReplicaOperationRequest shardRequest) { ShardDeleteRequest request = shardRequest.request; - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); - Engine.Delete delete = indexShard.prepareDelete(request.getType(), request.getId(), request.getVersion()) + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); + Engine.Delete delete = indexShard.prepareDelete(request.type(), request.id(), request.version()) .origin(Engine.Operation.Origin.REPLICA); indexShard.delete(delete); - if (request.isRefresh()) { + if (request.refresh()) { try { indexShard.refresh(new Engine.Refresh(false)); } catch (Exception e) { @@ -131,12 +131,12 @@ public class TransportShardDeleteAction extends TransportShardReplicationOperati @Override protected ShardIterator shards(ClusterState clusterState, ShardDeleteRequest request) { - GroupShardsIterator group = clusterService.operationRouting().broadcastDeleteShards(clusterService.state(), request.getIndex()); + GroupShardsIterator group = clusterService.operationRouting().broadcastDeleteShards(clusterService.state(), request.index()); for (ShardIterator shardIt : group) { - if (shardIt.shardId().id() == request.getShardId()) { + if (shardIt.shardId().id() == request.shardId()) { return shardIt; } } - throw new ElasticSearchIllegalStateException("No shards iterator found for shard [" + request.getShardId() + "]"); + throw new ElasticSearchIllegalStateException("No shards iterator found for shard [" + request.shardId() + "]"); } } diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java b/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java index fb375ef516c..91bdac0e325 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryRequest.java @@ -47,8 +47,8 @@ import static org.elasticsearch.action.ValidateActions.addValidationError; * A request to delete all documents that matching a specific query. Best created with * {@link org.elasticsearch.client.Requests#deleteByQueryRequest(String...)}. *

- *

The request requires the query source to be set either using {@link #setQuery(org.elasticsearch.index.query.QueryBuilder)}, - * or {@link #setQuery(byte[])}. + *

The request requires the query source to be set either using {@link #query(org.elasticsearch.index.query.QueryBuilder)}, + * or {@link #query(byte[])}. * * @see DeleteByQueryResponse * @see org.elasticsearch.client.Requests#deleteByQueryRequest(String...) @@ -88,7 +88,7 @@ public class DeleteByQueryRequest extends IndicesReplicationOperationRequest querySource) { - request.setQuery(querySource); + request.query(querySource); return this; } @@ -96,7 +96,7 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ * The query source to execute in the form of a builder. */ public DeleteByQueryRequestBuilder setQuery(XContentBuilder builder) { - request.setQuery(builder); + request.query(builder); return this; } @@ -104,7 +104,7 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ * The query source to execute. */ public DeleteByQueryRequestBuilder setQuery(byte[] querySource) { - request.setQuery(querySource); + request.query(querySource); return this; } @@ -112,7 +112,7 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ * The query source to execute. */ public DeleteByQueryRequestBuilder setQuery(BytesReference querySource) { - request.setQuery(querySource, false); + request.query(querySource, false); return this; } @@ -120,7 +120,7 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ * The query source to execute. */ public DeleteByQueryRequestBuilder setQuery(BytesReference querySource, boolean unsafe) { - request.setQuery(querySource, unsafe); + request.query(querySource, unsafe); return this; } @@ -128,7 +128,7 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ * The query source to execute. */ public DeleteByQueryRequestBuilder setQuery(byte[] querySource, int offset, int length, boolean unsafe) { - request.setQuery(querySource, offset, length, unsafe); + request.query(querySource, offset, length, unsafe); return this; } @@ -136,7 +136,7 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ * The replication type to use with this operation. */ public DeleteByQueryRequestBuilder setReplicationType(ReplicationType replicationType) { - request.setReplicationType(replicationType); + request.replicationType(replicationType); return this; } @@ -144,12 +144,12 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ * The replication type to use with this operation. */ public DeleteByQueryRequestBuilder setReplicationType(String replicationType) { - request.setReplicationType(replicationType); + request.replicationType(replicationType); return this; } public DeleteByQueryRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel) { - request.setConsistencyLevel(consistencyLevel); + request.consistencyLevel(consistencyLevel); return this; } diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java b/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java index 1b34279f9cf..b63ef92c3c9 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryRequest.java @@ -48,11 +48,11 @@ public class IndexDeleteByQueryRequest extends IndexReplicationOperationRequest< IndexDeleteByQueryRequest(DeleteByQueryRequest request, String index, @Nullable Set routing, @Nullable String[] filteringAliases) { this.index = index; - this.timeout = request.getTimeout(); - this.querySource = request.getQuerySource(); - this.types = request.getTypes(); - this.replicationType = request.getReplicationType(); - this.consistencyLevel = request.getConsistencyLevel(); + this.timeout = request.timeout(); + this.querySource = request.querySource(); + this.types = request.types(); + this.replicationType = request.replicationType(); + this.consistencyLevel = request.consistencyLevel(); this.routing = routing; this.filteringAliases = filteringAliases; } @@ -60,7 +60,7 @@ public class IndexDeleteByQueryRequest extends IndexReplicationOperationRequest< IndexDeleteByQueryRequest() { } - public BytesReference getQuerySource() { + BytesReference querySource() { return querySource; } @@ -73,19 +73,19 @@ public class IndexDeleteByQueryRequest extends IndexReplicationOperationRequest< return validationException; } - public Set getRouting() { + Set routing() { return this.routing; } - public String[] getTypes() { + String[] types() { return this.types; } - public String[] getFilteringAliases() { + String[] filteringAliases() { return filteringAliases; } - public IndexDeleteByQueryRequest setTimeout(TimeValue timeout) { + public IndexDeleteByQueryRequest timeout(TimeValue timeout) { this.timeout = timeout; return this; } @@ -140,4 +140,4 @@ public class IndexDeleteByQueryRequest extends IndexReplicationOperationRequest< out.writeVInt(0); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java b/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java index d82de59e778..a31dcfcae34 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/ShardDeleteByQueryRequest.java @@ -50,15 +50,15 @@ public class ShardDeleteByQueryRequest extends ShardReplicationOperationRequest< ShardDeleteByQueryRequest(IndexDeleteByQueryRequest request, int shardId) { super(request); - this.index = request.getIndex(); - this.querySource = request.getQuerySource(); - this.types = request.getTypes(); + this.index = request.index(); + this.querySource = request.querySource(); + this.types = request.types(); this.shardId = shardId; - setReplicationType(request.getReplicationType()); - setConsistencyLevel(request.getConsistencyLevel()); - timeout = request.getTimeout(); - this.routing = request.getRouting(); - filteringAliases = request.getFilteringAliases(); + replicationType(request.replicationType()); + consistencyLevel(request.consistencyLevel()); + timeout = request.timeout(); + this.routing = request.routing(); + filteringAliases = request.filteringAliases(); } ShardDeleteByQueryRequest() { @@ -73,23 +73,23 @@ public class ShardDeleteByQueryRequest extends ShardReplicationOperationRequest< return validationException; } - public int getShardId() { + public int shardId() { return this.shardId; } - public BytesReference getQuerySource() { + BytesReference querySource() { return querySource; } - public String[] getTypes() { + public String[] types() { return this.types; } - public Set getRouting() { + public Set routing() { return this.routing; } - public String[] getFilteringAliases() { + public String[] filteringAliases() { return filteringAliases; } @@ -149,4 +149,4 @@ public class ShardDeleteByQueryRequest extends ShardReplicationOperationRequest< } return "delete_by_query {[" + index + "]" + Arrays.toString(types) + ", query [" + sSource + "]}"; } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java b/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java index b37fd5de08f..e202f1e4efd 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java @@ -46,7 +46,7 @@ public class TransportDeleteByQueryAction extends TransportIndicesReplicationOpe @Override protected Map> resolveRouting(ClusterState clusterState, DeleteByQueryRequest request) throws ElasticSearchException { - return clusterState.metaData().resolveSearchRouting(request.getRouting(), request.getIndices()); + return clusterState.metaData().resolveSearchRouting(request.routing(), request.indices()); } @Override @@ -88,7 +88,7 @@ public class TransportDeleteByQueryAction extends TransportIndicesReplicationOpe @Override protected IndexDeleteByQueryRequest newIndexRequestInstance(DeleteByQueryRequest request, String index, Set routing) { - String[] filteringAliases = clusterService.state().metaData().filteringAliases(index, request.getIndices()); + String[] filteringAliases = clusterService.state().metaData().filteringAliases(index, request.indices()); return new IndexDeleteByQueryRequest(request, index, routing, filteringAliases); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java b/src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java index 5a3e9efb71c..4b357891d5e 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java @@ -59,7 +59,7 @@ public class TransportIndexDeleteByQueryAction extends TransportIndexReplication successfulShards++; } } - return new IndexDeleteByQueryResponse(request.getIndex(), successfulShards, failedShards); + return new IndexDeleteByQueryResponse(request.index(), successfulShards, failedShards); } @Override @@ -79,16 +79,16 @@ public class TransportIndexDeleteByQueryAction extends TransportIndexReplication @Override protected ClusterBlockException checkRequestBlock(ClusterState state, IndexDeleteByQueryRequest request) { - return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.getIndex()); + return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.index()); } @Override protected GroupShardsIterator shards(IndexDeleteByQueryRequest request) { - return clusterService.operationRouting().deleteByQueryShards(clusterService.state(), request.getIndex(), request.getRouting()); + return clusterService.operationRouting().deleteByQueryShards(clusterService.state(), request.index(), request.routing()); } @Override protected ShardDeleteByQueryRequest newShardRequestInstance(IndexDeleteByQueryRequest request, int shardId) { return new ShardDeleteByQueryRequest(request, shardId); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java b/src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java index 3cccf64eabb..7f2cd83497c 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java @@ -85,14 +85,14 @@ public class TransportShardDeleteByQueryAction extends TransportShardReplication @Override protected ClusterBlockException checkRequestBlock(ClusterState state, ShardDeleteByQueryRequest request) { - return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.getIndex()); + return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.index()); } @Override protected PrimaryResponse shardOperationOnPrimary(ClusterState clusterState, PrimaryOperationRequest shardRequest) { ShardDeleteByQueryRequest request = shardRequest.request; - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); - Engine.DeleteByQuery deleteByQuery = indexShard.prepareDeleteByQuery(request.getQuerySource(), request.getFilteringAliases(), request.getTypes()); + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); + Engine.DeleteByQuery deleteByQuery = indexShard.prepareDeleteByQuery(request.querySource(), request.filteringAliases(), request.types()); indexShard.deleteByQuery(deleteByQuery); return new PrimaryResponse(shardRequest.request, new ShardDeleteByQueryResponse(), null); } @@ -101,19 +101,19 @@ public class TransportShardDeleteByQueryAction extends TransportShardReplication @Override protected void shardOperationOnReplica(ReplicaOperationRequest shardRequest) { ShardDeleteByQueryRequest request = shardRequest.request; - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); - Engine.DeleteByQuery deleteByQuery = indexShard.prepareDeleteByQuery(request.getQuerySource(), request.getFilteringAliases(), request.getTypes()); + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); + Engine.DeleteByQuery deleteByQuery = indexShard.prepareDeleteByQuery(request.querySource(), request.filteringAliases(), request.types()); indexShard.deleteByQuery(deleteByQuery); } @Override protected ShardIterator shards(ClusterState clusterState, ShardDeleteByQueryRequest request) { - GroupShardsIterator group = clusterService.operationRouting().deleteByQueryShards(clusterService.state(), request.getIndex(), request.getRouting()); + GroupShardsIterator group = clusterService.operationRouting().deleteByQueryShards(clusterService.state(), request.index(), request.routing()); for (ShardIterator shardIt : group) { - if (shardIt.shardId().id() == request.getShardId()) { + if (shardIt.shardId().id() == request.shardId()) { return shardIt; } } - throw new ElasticSearchIllegalStateException("No shards iterator found for shard [" + request.getShardId() + "]"); + throw new ElasticSearchIllegalStateException("No shards iterator found for shard [" + request.shardId() + "]"); } } diff --git a/src/main/java/org/elasticsearch/action/explain/ExplainRequest.java b/src/main/java/org/elasticsearch/action/explain/ExplainRequest.java index aa3dc7d4cb0..5222899957b 100644 --- a/src/main/java/org/elasticsearch/action/explain/ExplainRequest.java +++ b/src/main/java/org/elasticsearch/action/explain/ExplainRequest.java @@ -57,29 +57,29 @@ public class ExplainRequest extends SingleShardOperationRequest this.id = id; } - public String getType() { + public String type() { return type; } - public ExplainRequest setType(String type) { + public ExplainRequest type(String type) { this.type = type; return this; } - public String getId() { + public String id() { return id; } - public ExplainRequest setId(String id) { + public ExplainRequest id(String id) { this.id = id; return this; } - public String getRouting() { + public String routing() { return routing; } - public ExplainRequest setRouting(String routing) { + public ExplainRequest routing(String routing) { this.routing = routing; return this; } @@ -87,60 +87,59 @@ public class ExplainRequest extends SingleShardOperationRequest /** * Simple sets the routing. Since the parent is only used to get to the right shard. */ - public ExplainRequest setParent(String parent) { + public ExplainRequest parent(String parent) { this.routing = parent; return this; } - public String getPreference() { + public String preference() { return preference; } - public ExplainRequest setPreference(String preference) { + public ExplainRequest preference(String preference) { this.preference = preference; return this; } - public BytesReference getSource() { + public BytesReference source() { return source; } - public boolean isSourceUnsafe() { + public boolean sourceUnsafe() { return sourceUnsafe; } - public ExplainRequest setSource(ExplainSourceBuilder sourceBuilder) { + public ExplainRequest source(ExplainSourceBuilder sourceBuilder) { this.source = sourceBuilder.buildAsBytes(contentType); this.sourceUnsafe = false; return this; } - public ExplainRequest setSource(BytesReference source, boolean unsafe) { + public ExplainRequest source(BytesReference source, boolean unsafe) { this.source = source; this.sourceUnsafe = unsafe; return this; } - public String[] getFields() { + public String[] fields() { return fields; } - public ExplainRequest setFields(String[] fields) { + public ExplainRequest fields(String[] fields) { this.fields = fields; return this; } - public String[] getFilteringAlias() { + public String[] filteringAlias() { return filteringAlias; } - // TODO Should we change it to ExplainRequest setFilteringAlias(String[] filteringAlias)? - public void setFilteringAlias(String[] filteringAlias) { - if (filteringAlias == null) { - return; + public ExplainRequest filteringAlias(String[] filteringAlias) { + if (filteringAlias != null) { + this.filteringAlias = filteringAlias; } - this.filteringAlias = filteringAlias; + return this; } @Override diff --git a/src/main/java/org/elasticsearch/action/explain/ExplainRequestBuilder.java b/src/main/java/org/elasticsearch/action/explain/ExplainRequestBuilder.java index 6282ec5edfb..69d9a979574 100644 --- a/src/main/java/org/elasticsearch/action/explain/ExplainRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/explain/ExplainRequestBuilder.java @@ -38,14 +38,14 @@ public class ExplainRequestBuilder extends SingleShardOperationRequestBuilder listener) { if (sourceBuilder != null) { - request.setSource(sourceBuilder); + request.source(sourceBuilder); } ((Client) client).explain(request, listener); diff --git a/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java b/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java index 2d96710788a..2f5a77dc6e3 100644 --- a/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java +++ b/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java @@ -80,15 +80,15 @@ public class TransportExplainAction extends TransportShardSingleOperationAction< @Override protected void resolveRequest(ClusterState state, ExplainRequest request) { - String concreteIndex = state.metaData().concreteIndex(request.getIndex()); - request.setFilteringAlias(state.metaData().filteringAliases(concreteIndex, request.getIndex())); - request.setIndex(state.metaData().concreteIndex(request.getIndex())); + String concreteIndex = state.metaData().concreteIndex(request.index()); + request.filteringAlias(state.metaData().filteringAliases(concreteIndex, request.index())); + request.index(state.metaData().concreteIndex(request.index())); } protected ExplainResponse shardOperation(ExplainRequest request, int shardId) throws ElasticSearchException { - IndexService indexService = indicesService.indexService(request.getIndex()); + IndexService indexService = indicesService.indexService(request.index()); IndexShard indexShard = indexService.shardSafe(shardId); - Term uidTerm = new Term(UidFieldMapper.NAME, Uid.createUidAsBytes(request.getType(), request.getId())); + Term uidTerm = new Term(UidFieldMapper.NAME, Uid.createUidAsBytes(request.type(), request.id())); Engine.GetResult result = indexShard.get(new Engine.Get(false, uidTerm)); if (!result.exists()) { return new ExplainResponse(false); @@ -96,8 +96,8 @@ public class TransportExplainAction extends TransportShardSingleOperationAction< SearchContext context = new SearchContext( 0, - new ShardSearchRequest().types(new String[]{request.getType()}) - .filteringAliases(request.getFilteringAlias()), + new ShardSearchRequest().types(new String[]{request.type()}) + .filteringAliases(request.filteringAlias()), null, result.searcher(), indexService, indexShard, scriptService ); @@ -115,14 +115,14 @@ public class TransportExplainAction extends TransportShardSingleOperationAction< } else { explanation = context.searcher().explain(context.query(), topLevelDocId); } - if (request.getFields() != null) { - if (request.getFields().length == 1 && "_source".equals(request.getFields()[0])) { - request.setFields(null); // Load the _source field + if (request.fields() != null) { + if (request.fields().length == 1 && "_source".equals(request.fields()[0])) { + request.fields(null); // Load the _source field } // Advantage is that we're not opening a second searcher to retrieve the _source. Also // because we are working in the same searcher in engineGetResult we can be sure that a // doc isn't deleted between the initial get and this call. - GetResult getResult = indexShard.getService().get(result, request.getId(), request.getType(), request.getFields()); + GetResult getResult = indexShard.getService().get(result, request.id(), request.type(), request.fields()); return new ExplainResponse(true, explanation, getResult); } else { return new ExplainResponse(true, explanation); @@ -137,7 +137,7 @@ public class TransportExplainAction extends TransportShardSingleOperationAction< private ParsedQuery parseQuery(ExplainRequest request, IndexService indexService) { try { - XContentParser parser = XContentHelper.createParser(request.getSource()); + XContentParser parser = XContentHelper.createParser(request.source()); for (XContentParser.Token token = parser.nextToken(); token != XContentParser.Token.END_OBJECT; token = parser.nextToken()) { if (token == XContentParser.Token.FIELD_NAME) { String fieldName = parser.currentName(); @@ -170,12 +170,12 @@ public class TransportExplainAction extends TransportShardSingleOperationAction< } protected ClusterBlockException checkRequestBlock(ClusterState state, ExplainRequest request) { - return state.blocks().indexBlockedException(ClusterBlockLevel.READ, request.getIndex()); + return state.blocks().indexBlockedException(ClusterBlockLevel.READ, request.index()); } protected ShardIterator shards(ClusterState state, ExplainRequest request) throws ElasticSearchException { return clusterService.operationRouting().getShards( - clusterService.state(), request.getIndex(), request.getType(), request.getId(), request.getRouting(), request.getPreference() + clusterService.state(), request.index(), request.type(), request.id(), request.routing(), request.preference() ); } } diff --git a/src/main/java/org/elasticsearch/action/get/GetRequest.java b/src/main/java/org/elasticsearch/action/get/GetRequest.java index 30abde4bc44..f51166e960a 100644 --- a/src/main/java/org/elasticsearch/action/get/GetRequest.java +++ b/src/main/java/org/elasticsearch/action/get/GetRequest.java @@ -33,7 +33,7 @@ import java.io.IOException; * A request to get a document (its source) from an index based on its type (optional) and id. Best created using * {@link org.elasticsearch.client.Requests#getRequest(String)}. *

- *

The operation requires the {@link #getIndex()}, {@link #setType(String)} and {@link #setId(String)} + *

The operation requires the {@link #index()}, {@link #type(String)} and {@link #id(String)} * to be set. * * @see org.elasticsearch.action.get.GetResponse @@ -58,7 +58,7 @@ public class GetRequest extends SingleShardOperationRequest { } /** - * Constructs a new get request against the specified index. The {@link #setType(String)} and {@link #setId(String)} + * Constructs a new get request against the specified index. The {@link #type(String)} and {@link #id(String)} * must be set. */ public GetRequest(String index) { @@ -94,7 +94,7 @@ public class GetRequest extends SingleShardOperationRequest { /** * Sets the type of the document to fetch. */ - public GetRequest setType(@Nullable String type) { + public GetRequest type(@Nullable String type) { if (type == null) { type = "_all"; } @@ -106,7 +106,7 @@ public class GetRequest extends SingleShardOperationRequest { * Sets the id of the document to fetch. */ @Required - public GetRequest setId(String id) { + public GetRequest id(String id) { this.id = id; return this; } @@ -115,7 +115,7 @@ public class GetRequest extends SingleShardOperationRequest { * Sets the parent id of this document. Will simply set the routing to this value, as it is only * used for routing with delete requests. */ - public GetRequest setParent(String parent) { + public GetRequest parent(String parent) { if (routing == null) { routing = parent; } @@ -126,7 +126,7 @@ public class GetRequest extends SingleShardOperationRequest { * Controls the shard routing of the request. Using this value to hash the shard * and not the id. */ - public GetRequest setRouting(String routing) { + public GetRequest routing(String routing) { this.routing = routing; return this; } @@ -136,24 +136,24 @@ public class GetRequest extends SingleShardOperationRequest { * _local to prefer local shards, _primary to execute only on primary shards, or * a custom value, which guarantees that the same order will be used across different requests. */ - public GetRequest setPreference(String preference) { + public GetRequest preference(String preference) { this.preference = preference; return this; } - public String getType() { + public String type() { return type; } - public String getId() { + public String id() { return id; } - public String getRouting() { + public String routing() { return this.routing; } - public String getPreference() { + public String preference() { return this.preference; } @@ -161,7 +161,7 @@ public class GetRequest extends SingleShardOperationRequest { * Explicitly specify the fields that will be returned. By default, the _source * field will be returned. */ - public GetRequest setFields(String... fields) { + public GetRequest fields(String... fields) { this.fields = fields; return this; } @@ -170,7 +170,7 @@ public class GetRequest extends SingleShardOperationRequest { * Explicitly specify the fields that will be returned. By default, the _source * field will be returned. */ - public String[] getFields() { + public String[] fields() { return this.fields; } @@ -179,20 +179,20 @@ public class GetRequest extends SingleShardOperationRequest { * return the latest value. Note, heavy get should not set this to true. Defaults * to false. */ - public GetRequest setRefresh(boolean refresh) { + public GetRequest refresh(boolean refresh) { this.refresh = refresh; return this; } - public boolean isRefresh() { + public boolean refresh() { return this.refresh; } - public boolean isRealtime() { + public boolean realtime() { return this.realtime == null ? true : this.realtime; } - public GetRequest setRealtime(Boolean realtime) { + public GetRequest realtime(Boolean realtime) { this.realtime = realtime; return this; } diff --git a/src/main/java/org/elasticsearch/action/get/GetRequestBuilder.java b/src/main/java/org/elasticsearch/action/get/GetRequestBuilder.java index 23e3a6e72be..39993db9443 100644 --- a/src/main/java/org/elasticsearch/action/get/GetRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/get/GetRequestBuilder.java @@ -43,7 +43,7 @@ public class GetRequestBuilder extends SingleShardOperationRequestBuilderfalse. */ public GetRequestBuilder setRefresh(boolean refresh) { - request.setRefresh(refresh); + request.refresh(refresh); return this; } public GetRequestBuilder setRealtime(Boolean realtime) { - request.setRealtime(realtime); + request.realtime(realtime); return this; } diff --git a/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java b/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java index 2bac9d1ee54..b087dc976dc 100644 --- a/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java +++ b/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java @@ -65,41 +65,41 @@ public class MultiGetRequest extends ActionRequest { this.id = id; } - public String getIndex() { + public String index() { return this.index; } - public Item setIndex(String index) { + public Item index(String index) { this.index = index; return this; } - public String getType() { + public String type() { return this.type; } - public String getId() { + public String id() { return this.id; } /** * The routing associated with this document. */ - public Item setRouting(String routing) { + public Item routing(String routing) { this.routing = routing; return this; } - public String getRouting() { + public String routing() { return this.routing; } - public Item setFields(String... fields) { + public Item fields(String... fields) { this.fields = fields; return this; } - public String[] getFields() { + public String[] fields() { return this.fields; } @@ -181,10 +181,10 @@ public class MultiGetRequest extends ActionRequest { } else { for (int i = 0; i < items.size(); i++) { Item item = items.get(i); - if (item.getIndex() == null) { + if (item.index() == null) { validationException = ValidateActions.addValidationError("index is missing for doc " + i, validationException); } - if (item.getId() == null) { + if (item.id() == null) { validationException = ValidateActions.addValidationError("id is missing for doc " + i, validationException); } } @@ -197,29 +197,29 @@ public class MultiGetRequest extends ActionRequest { * _local to prefer local shards, _primary to execute only on primary shards, or * a custom value, which guarantees that the same order will be used across different requests. */ - public MultiGetRequest setPreference(String preference) { + public MultiGetRequest preference(String preference) { this.preference = preference; return this; } - public String getPreference() { + public String preference() { return this.preference; } - public boolean isRealtime() { + public boolean realtime() { return this.realtime == null ? true : this.realtime; } - public MultiGetRequest setRealtime(Boolean realtime) { + public MultiGetRequest realtime(Boolean realtime) { this.realtime = realtime; return this; } - public boolean isRefresh() { + public boolean refresh() { return this.refresh; } - public MultiGetRequest setRefresh(boolean refresh) { + public MultiGetRequest refresh(boolean refresh) { this.refresh = refresh; return this; } @@ -275,14 +275,14 @@ public class MultiGetRequest extends ActionRequest { } else { aFields = defaultFields; } - add(new Item(index, type, id).setRouting(routing).setFields(aFields)); + add(new Item(index, type, id).routing(routing).fields(aFields)); } } else if ("ids".equals(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (!token.isValue()) { throw new ElasticSearchIllegalArgumentException("ids array element should only contain ids"); } - add(new Item(defaultIndex, defaultType, parser.text()).setFields(defaultFields)); + add(new Item(defaultIndex, defaultType, parser.text()).fields(defaultFields)); } } } diff --git a/src/main/java/org/elasticsearch/action/get/MultiGetRequestBuilder.java b/src/main/java/org/elasticsearch/action/get/MultiGetRequestBuilder.java index 9e858eb2d53..0d79537ac8e 100644 --- a/src/main/java/org/elasticsearch/action/get/MultiGetRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/get/MultiGetRequestBuilder.java @@ -64,7 +64,7 @@ public class MultiGetRequestBuilder extends ActionRequestBuilderfalse. */ public MultiGetRequestBuilder setRefresh(boolean refresh) { - request.setRefresh(refresh); + request.refresh(refresh); return this; } public MultiGetRequestBuilder setRealtime(Boolean realtime) { - request.setRealtime(realtime); + request.realtime(realtime); return this; } diff --git a/src/main/java/org/elasticsearch/action/get/MultiGetShardRequest.java b/src/main/java/org/elasticsearch/action/get/MultiGetShardRequest.java index 4c246e2e48e..a46c464867e 100644 --- a/src/main/java/org/elasticsearch/action/get/MultiGetShardRequest.java +++ b/src/main/java/org/elasticsearch/action/get/MultiGetShardRequest.java @@ -63,29 +63,29 @@ public class MultiGetShardRequest extends SingleShardOperationRequest_local to prefer local shards, _primary to execute only on primary shards, or * a custom value, which guarantees that the same order will be used across different requests. */ - public MultiGetShardRequest setPreference(String preference) { + public MultiGetShardRequest preference(String preference) { this.preference = preference; return this; } - public String getPreference() { + public String preference() { return this.preference; } - public boolean isRealtime() { + public boolean realtime() { return this.realtime == null ? true : this.realtime; } - public MultiGetShardRequest setRealtime(Boolean realtime) { + public MultiGetShardRequest realtime(Boolean realtime) { this.realtime = realtime; return this; } - public boolean isRefresh() { + public boolean refresh() { return this.refresh; } - public MultiGetShardRequest setRefresh(boolean refresh) { + public MultiGetShardRequest refresh(boolean refresh) { this.refresh = refresh; return this; } @@ -168,4 +168,4 @@ public class MultiGetShardRequest extends SingleShardOperationRequest shardRequests = new HashMap(); for (int i = 0; i < request.items.size(); i++) { MultiGetRequest.Item item = request.items.get(i); - item.setRouting(clusterState.metaData().resolveIndexRouting(item.getRouting(), item.getIndex())); - item.setIndex(clusterState.metaData().concreteIndex(item.getIndex())); + item.routing(clusterState.metaData().resolveIndexRouting(item.routing(), item.index())); + item.index(clusterState.metaData().concreteIndex(item.index())); ShardId shardId = clusterService.operationRouting() - .getShards(clusterState, item.getIndex(), item.getType(), item.getId(), item.getRouting(), null).shardId(); + .getShards(clusterState, item.index(), item.type(), item.id(), item.routing(), null).shardId(); MultiGetShardRequest shardRequest = shardRequests.get(shardId); if (shardRequest == null) { shardRequest = new MultiGetShardRequest(shardId.index().name(), shardId.id()); - shardRequest.setPreference(request.preference); - shardRequest.setRealtime(request.realtime); - shardRequest.setRefresh(request.refresh); + shardRequest.preference(request.preference); + shardRequest.realtime(request.realtime); + shardRequest.refresh(request.refresh); shardRequests.put(shardId, shardRequest); } - shardRequest.add(i, item.getType(), item.getId(), item.getFields()); + shardRequest.add(i, item.type(), item.id(), item.fields()); } final MultiGetItemResponse[] responses = new MultiGetItemResponse[request.items.size()]; @@ -101,7 +101,7 @@ public class TransportMultiGetAction extends TransportAction() { @Override public void onResponse(MultiGetResponse response) { @@ -153,4 +153,4 @@ public class TransportMultiGetAction extends TransportAction - *

The index requires the {@link #getIndex()}, {@link #setType(String)}, {@link #setId(String)} and - * {@link #setSource(byte[])} to be set. + *

The index requires the {@link #index()}, {@link #type(String)}, {@link #id(String)} and + * {@link #source(byte[])} to be set. *

- *

The source (content to index) can be set in its bytes form using ({@link #setSource(byte[])}), - * its string form ({@link #setSource(String)}) or using a {@link org.elasticsearch.common.xcontent.XContentBuilder} - * ({@link #setSource(org.elasticsearch.common.xcontent.XContentBuilder)}). + *

The source (content to index) can be set in its bytes form using ({@link #source(byte[])}), + * its string form ({@link #source(String)}) or using a {@link org.elasticsearch.common.xcontent.XContentBuilder} + * ({@link #source(org.elasticsearch.common.xcontent.XContentBuilder)}). *

- *

If the {@link #setId(String)} is not set, it will be automatically generated. + *

If the {@link #id(String)} is not set, it will be automatically generated. * * @see IndexResponse * @see org.elasticsearch.client.Requests#indexRequest(String) @@ -140,8 +140,8 @@ public class IndexRequest extends ShardReplicationOperationRequest } /** - * Constructs a new index request against the specific index. The {@link #setType(String)} - * {@link #setSource(byte[])} must be set. + * Constructs a new index request against the specific index. The {@link #type(String)} + * {@link #source(byte[])} must be set. */ public IndexRequest(String index) { this.index = index; @@ -149,7 +149,7 @@ public class IndexRequest extends ShardReplicationOperationRequest /** * Constructs a new index request against the specific index and type. The - * {@link #setSource(byte[])} must be set. + * {@link #source(byte[])} must be set. */ public IndexRequest(String index, String type) { this.index = index; @@ -187,13 +187,13 @@ public class IndexRequest extends ShardReplicationOperationRequest @Override public void beforeLocalFork() { // only fork if copy over if source is unsafe - getSafeSource(); + safeSource(); } /** * Sets the content type that will be used when generating a document from user provided objects (like Map). */ - public IndexRequest setContentType(XContentType contentType) { + public IndexRequest contentType(XContentType contentType) { this.contentType = contentType; return this; } @@ -201,7 +201,7 @@ public class IndexRequest extends ShardReplicationOperationRequest /** * The type of the indexed document. */ - public String getType() { + public String type() { return type; } @@ -209,7 +209,7 @@ public class IndexRequest extends ShardReplicationOperationRequest * Sets the type of the indexed document. */ @Required - public IndexRequest setType(String type) { + public IndexRequest type(String type) { this.type = type; return this; } @@ -217,14 +217,14 @@ public class IndexRequest extends ShardReplicationOperationRequest /** * The id of the indexed document. If not set, will be automatically generated. */ - public String getId() { + public String id() { return id; } /** * Sets the id of the indexed document. If not set, will be automatically generated. */ - public IndexRequest setId(String id) { + public IndexRequest id(String id) { this.id = id; return this; } @@ -233,7 +233,7 @@ public class IndexRequest extends ShardReplicationOperationRequest * Controls the shard routing of the request. Using this value to hash the shard * and not the id. */ - public IndexRequest setRouting(String routing) { + public IndexRequest routing(String routing) { if (routing != null && routing.length() == 0) { this.routing = null; } else { @@ -246,7 +246,7 @@ public class IndexRequest extends ShardReplicationOperationRequest * Controls the shard routing of the request. Using this value to hash the shard * and not the id. */ - public String getRouting() { + public String routing() { return this.routing; } @@ -254,7 +254,7 @@ public class IndexRequest extends ShardReplicationOperationRequest * Sets the parent id of this document. If routing is not set, automatically set it as the * routing as well. */ - public IndexRequest setParent(String parent) { + public IndexRequest parent(String parent) { this.parent = parent; if (routing == null) { routing = parent; @@ -262,19 +262,19 @@ public class IndexRequest extends ShardReplicationOperationRequest return this; } - public String getParent() { + public String parent() { return this.parent; } /** * Sets the timestamp either as millis since the epoch, or, in the configured date format. */ - public IndexRequest setTimestamp(String timestamp) { + public IndexRequest timestamp(String timestamp) { this.timestamp = timestamp; return this; } - public String getTimestamp() { + public String timestamp() { return this.timestamp; } @@ -282,7 +282,7 @@ public class IndexRequest extends ShardReplicationOperationRequest * Sets the relative ttl value. It musts be > 0 as it makes little sense otherwise. Setting it * to null will reset to have no ttl. */ - public IndexRequest setTtl(Long ttl) throws ElasticSearchGenerationException { + public IndexRequest ttl(Long ttl) throws ElasticSearchGenerationException { if (ttl == null) { this.ttl = -1; return this; @@ -294,18 +294,18 @@ public class IndexRequest extends ShardReplicationOperationRequest return this; } - public long getTtl() { + public long ttl() { return this.ttl; } /** * The source of the document to index, recopied to a new array if it is unsage. */ - public BytesReference getSource() { + public BytesReference source() { return source; } - public BytesReference getSafeSource() { + public BytesReference safeSource() { if (sourceUnsafe) { source = source.copyBytesArray(); sourceUnsafe = false; @@ -313,7 +313,7 @@ public class IndexRequest extends ShardReplicationOperationRequest return source; } - public Map getSourceAsMap() { + public Map sourceAsMap() { return XContentHelper.convertToMap(source, false).v2(); } @@ -323,8 +323,8 @@ public class IndexRequest extends ShardReplicationOperationRequest * @param source The map to index */ @Required - public IndexRequest setSource(Map source) throws ElasticSearchGenerationException { - return setSource(source, contentType); + public IndexRequest source(Map source) throws ElasticSearchGenerationException { + return source(source, contentType); } /** @@ -333,11 +333,11 @@ public class IndexRequest extends ShardReplicationOperationRequest * @param source The map to index */ @Required - public IndexRequest setSource(Map source, XContentType contentType) throws ElasticSearchGenerationException { + public IndexRequest source(Map source, XContentType contentType) throws ElasticSearchGenerationException { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.map(source); - return setSource(builder); + return source(builder); } catch (IOException e) { throw new ElasticSearchGenerationException("Failed to generate [" + source + "]", e); } @@ -346,11 +346,11 @@ public class IndexRequest extends ShardReplicationOperationRequest /** * Sets the document source to index. *

- *

Note, its preferable to either set it using {@link #setSource(org.elasticsearch.common.xcontent.XContentBuilder)} - * or using the {@link #setSource(byte[])}. + *

Note, its preferable to either set it using {@link #source(org.elasticsearch.common.xcontent.XContentBuilder)} + * or using the {@link #source(byte[])}. */ @Required - public IndexRequest setSource(String source) { + public IndexRequest source(String source) { this.source = new BytesArray(source.getBytes(Charsets.UTF_8)); this.sourceUnsafe = false; return this; @@ -360,51 +360,51 @@ public class IndexRequest extends ShardReplicationOperationRequest * Sets the content source to index. */ @Required - public IndexRequest setSource(XContentBuilder sourceBuilder) { + public IndexRequest source(XContentBuilder sourceBuilder) { source = sourceBuilder.bytes(); sourceUnsafe = false; return this; } @Required - public IndexRequest setSource(String field1, Object value1) { + public IndexRequest source(String field1, Object value1) { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.startObject().field(field1, value1).endObject(); - return setSource(builder); + return source(builder); } catch (IOException e) { throw new ElasticSearchGenerationException("Failed to generate", e); } } @Required - public IndexRequest setSource(String field1, Object value1, String field2, Object value2) { + public IndexRequest source(String field1, Object value1, String field2, Object value2) { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.startObject().field(field1, value1).field(field2, value2).endObject(); - return setSource(builder); + return source(builder); } catch (IOException e) { throw new ElasticSearchGenerationException("Failed to generate", e); } } @Required - public IndexRequest setSource(String field1, Object value1, String field2, Object value2, String field3, Object value3) { + public IndexRequest source(String field1, Object value1, String field2, Object value2, String field3, Object value3) { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.startObject().field(field1, value1).field(field2, value2).field(field3, value3).endObject(); - return setSource(builder); + return source(builder); } catch (IOException e) { throw new ElasticSearchGenerationException("Failed to generate", e); } } @Required - public IndexRequest setSource(String field1, Object value1, String field2, Object value2, String field3, Object value3, String field4, Object value4) { + public IndexRequest source(String field1, Object value1, String field2, Object value2, String field3, Object value3, String field4, Object value4) { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.startObject().field(field1, value1).field(field2, value2).field(field3, value3).field(field4, value4).endObject(); - return setSource(builder); + return source(builder); } catch (IOException e) { throw new ElasticSearchGenerationException("Failed to generate", e); } @@ -413,7 +413,7 @@ public class IndexRequest extends ShardReplicationOperationRequest /** * Sets the document to index in bytes form. */ - public IndexRequest setSource(BytesReference source, boolean unsafe) { + public IndexRequest source(BytesReference source, boolean unsafe) { this.source = source; this.sourceUnsafe = unsafe; return this; @@ -422,8 +422,8 @@ public class IndexRequest extends ShardReplicationOperationRequest /** * Sets the document to index in bytes form. */ - public IndexRequest setSource(byte[] source) { - return setSource(source, 0, source.length); + public IndexRequest source(byte[] source) { + return source(source, 0, source.length); } /** @@ -435,8 +435,8 @@ public class IndexRequest extends ShardReplicationOperationRequest * @param length The length of the data */ @Required - public IndexRequest setSource(byte[] source, int offset, int length) { - return setSource(source, offset, length, false); + public IndexRequest source(byte[] source, int offset, int length) { + return source(source, offset, length, false); } /** @@ -448,7 +448,7 @@ public class IndexRequest extends ShardReplicationOperationRequest * @param unsafe Is the byte array safe to be used form a different thread */ @Required - public IndexRequest setSource(byte[] source, int offset, int length, boolean unsafe) { + public IndexRequest source(byte[] source, int offset, int length, boolean unsafe) { this.source = new BytesArray(source, offset, length); this.sourceUnsafe = unsafe; return this; @@ -457,20 +457,20 @@ public class IndexRequest extends ShardReplicationOperationRequest /** * Sets the type of operation to perform. */ - public IndexRequest setOpType(OpType opType) { + public IndexRequest opType(OpType opType) { this.opType = opType; return this; } /** - * Sets a string representation of the {@link #setOpType(org.elasticsearch.action.index.IndexRequest.OpType)}. Can + * Sets a string representation of the {@link #opType(org.elasticsearch.action.index.IndexRequest.OpType)}. Can * be either "index" or "create". */ - public IndexRequest setOpType(String opType) throws ElasticSearchIllegalArgumentException { + public IndexRequest opType(String opType) throws ElasticSearchIllegalArgumentException { if ("create".equals(opType)) { - return setOpType(OpType.CREATE); + return opType(OpType.CREATE); } else if ("index".equals(opType)) { - return setOpType(OpType.INDEX); + return opType(OpType.INDEX); } else { throw new ElasticSearchIllegalArgumentException("No index opType matching [" + opType + "]"); } @@ -479,18 +479,18 @@ public class IndexRequest extends ShardReplicationOperationRequest /** * Set to true to force this index to use {@link OpType#CREATE}. */ - public IndexRequest setCreate(boolean create) { + public IndexRequest create(boolean create) { if (create) { - return setOpType(OpType.CREATE); + return opType(OpType.CREATE); } else { - return setOpType(OpType.INDEX); + return opType(OpType.INDEX); } } /** * The type of operation to perform. */ - public OpType getOpType() { + public OpType opType() { return this.opType; } @@ -499,12 +499,12 @@ public class IndexRequest extends ShardReplicationOperationRequest * be searchable. Note, heavy indexing should not set this to true. Defaults * to false. */ - public IndexRequest setRefresh(boolean refresh) { + public IndexRequest refresh(boolean refresh) { this.refresh = refresh; return this; } - public boolean isRefresh() { + public boolean refresh() { return this.refresh; } @@ -512,24 +512,24 @@ public class IndexRequest extends ShardReplicationOperationRequest * Sets the version, which will cause the index operation to only be performed if a matching * version exists and no changes happened on the doc since then. */ - public IndexRequest setVersion(long version) { + public IndexRequest version(long version) { this.version = version; return this; } - public long getVersion() { + public long version() { return this.version; } /** * Sets the versioning type. Defaults to {@link VersionType#INTERNAL}. */ - public IndexRequest setVersionType(VersionType versionType) { + public IndexRequest versionType(VersionType versionType) { this.versionType = versionType; return this; } - public VersionType getVersionType() { + public VersionType versionType() { return this.versionType; } @@ -538,18 +538,18 @@ public class IndexRequest extends ShardReplicationOperationRequest * to use to reduce the percolated queries that are going to run against this doc. Can be * set to * to indicate that all percolate queries should be run. */ - public IndexRequest setPercolate(String percolate) { + public IndexRequest percolate(String percolate) { this.percolate = percolate; return this; } - public String getPercolate() { + public String percolate() { return this.percolate; } public void process(MetaData metaData, String aliasOrIndex, @Nullable MappingMetaData mappingMd, boolean allowIdGeneration) throws ElasticSearchException { // resolve the routing if needed - setRouting(metaData.resolveIndexRouting(routing, aliasOrIndex)); + routing(metaData.resolveIndexRouting(routing, aliasOrIndex)); // resolve timestamp if provided externally if (timestamp != null) { timestamp = MappingMetaData.Timestamp.parseStringTimestamp(timestamp, @@ -592,9 +592,9 @@ public class IndexRequest extends ShardReplicationOperationRequest // generate id if not already provided and id generation is allowed if (allowIdGeneration) { if (id == null) { - setId(UUID.randomBase64UUID()); + id(UUID.randomBase64UUID()); // since we generate the id, change it to CREATE - setOpType(IndexRequest.OpType.CREATE); + opType(IndexRequest.OpType.CREATE); } } @@ -650,4 +650,4 @@ public class IndexRequest extends ShardReplicationOperationRequest } return "index {[" + index + "][" + type + "][" + id + "], source[" + sSource + "]}"; } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/index/IndexRequestBuilder.java b/src/main/java/org/elasticsearch/action/index/IndexRequestBuilder.java index ff467fd6472..9311187e87d 100644 --- a/src/main/java/org/elasticsearch/action/index/IndexRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/index/IndexRequestBuilder.java @@ -50,7 +50,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the type to index the document to. */ public IndexRequestBuilder setType(String type) { - request.setType(type); + request.type(type); return this; } @@ -59,7 +59,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * generated. */ public IndexRequestBuilder setId(String id) { - request.setId(id); + request.id(id); return this; } @@ -68,7 +68,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * and not the id. */ public IndexRequestBuilder setRouting(String routing) { - request.setRouting(routing); + request.routing(routing); return this; } @@ -77,7 +77,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * routing as well. */ public IndexRequestBuilder setParent(String parent) { - request.setParent(parent); + request.parent(parent); return this; } @@ -85,7 +85,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the source. */ public IndexRequestBuilder setSource(BytesReference source, boolean unsafe) { - request.setSource(source, unsafe); + request.source(source, unsafe); return this; } @@ -93,7 +93,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the source. */ public IndexRequestBuilder setSource(BytesReference source) { - request.setSource(source, false); + request.source(source, false); return this; } @@ -103,7 +103,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * @param source The map to index */ public IndexRequestBuilder setSource(Map source) { - request.setSource(source); + request.source(source); return this; } @@ -113,7 +113,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * @param source The map to index */ public IndexRequestBuilder setSource(Map source, XContentType contentType) { - request.setSource(source, contentType); + request.source(source, contentType); return this; } @@ -124,7 +124,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * or using the {@link #setSource(byte[])}. */ public IndexRequestBuilder setSource(String source) { - request.setSource(source); + request.source(source); return this; } @@ -132,7 +132,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the content source to index. */ public IndexRequestBuilder setSource(XContentBuilder sourceBuilder) { - request.setSource(sourceBuilder); + request.source(sourceBuilder); return this; } @@ -140,7 +140,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the document to index in bytes form. */ public IndexRequestBuilder setSource(byte[] source) { - request.setSource(source); + request.source(source); return this; } @@ -153,7 +153,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * @param length The length of the data */ public IndexRequestBuilder setSource(byte[] source, int offset, int length) { - request.setSource(source, offset, length); + request.source(source, offset, length); return this; } @@ -166,7 +166,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * @param unsafe Is the byte array safe to be used form a different thread */ public IndexRequestBuilder setSource(byte[] source, int offset, int length, boolean unsafe) { - request.setSource(source, offset, length, unsafe); + request.source(source, offset, length, unsafe); return this; } @@ -174,7 +174,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Constructs a simple document with a field and a value. */ public IndexRequestBuilder setSource(String field1, Object value1) { - request.setSource(field1, value1); + request.source(field1, value1); return this; } @@ -182,7 +182,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Constructs a simple document with a field and value pairs. */ public IndexRequestBuilder setSource(String field1, Object value1, String field2, Object value2) { - request.setSource(field1, value1, field2, value2); + request.source(field1, value1, field2, value2); return this; } @@ -190,7 +190,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Constructs a simple document with a field and value pairs. */ public IndexRequestBuilder setSource(String field1, Object value1, String field2, Object value2, String field3, Object value3) { - request.setSource(field1, value1, field2, value2, field3, value3); + request.source(field1, value1, field2, value2, field3, value3); return this; } @@ -198,7 +198,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Constructs a simple document with a field and value pairs. */ public IndexRequestBuilder setSource(String field1, Object value1, String field2, Object value2, String field3, Object value3, String field4, Object value4) { - request.setSource(field1, value1, field2, value2, field3, value3, field4, value4); + request.source(field1, value1, field2, value2, field3, value3, field4, value4); return this; } @@ -206,7 +206,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * The content type that will be used to generate a document from user provided objects (like Map). */ public IndexRequestBuilder setContentType(XContentType contentType) { - request.setContentType(contentType); + request.contentType(contentType); return this; } @@ -214,7 +214,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the type of operation to perform. */ public IndexRequestBuilder setOpType(IndexRequest.OpType opType) { - request.setOpType(opType); + request.opType(opType); return this; } @@ -223,7 +223,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * be either "index" or "create". */ public IndexRequestBuilder setOpType(String opType) { - request.setOpType(opType); + request.opType(opType); return this; } @@ -231,7 +231,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Set to true to force this index to use {@link org.elasticsearch.action.index.IndexRequest.OpType#CREATE}. */ public IndexRequestBuilder setCreate(boolean create) { - request.setCreate(create); + request.create(create); return this; } @@ -241,7 +241,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * to false. */ public IndexRequestBuilder setRefresh(boolean refresh) { - request.setRefresh(refresh); + request.refresh(refresh); return this; } @@ -249,7 +249,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Set the replication type for this operation. */ public IndexRequestBuilder setReplicationType(ReplicationType replicationType) { - request.setReplicationType(replicationType); + request.replicationType(replicationType); return this; } @@ -257,7 +257,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the consistency level. Defaults to {@link org.elasticsearch.action.WriteConsistencyLevel#DEFAULT}. */ public IndexRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel) { - request.setConsistencyLevel(consistencyLevel); + request.consistencyLevel(consistencyLevel); return this; } @@ -265,7 +265,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Set the replication type for this operation. */ public IndexRequestBuilder setReplicationType(String replicationType) { - request.setReplicationType(replicationType); + request.replicationType(replicationType); return this; } @@ -274,7 +274,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * version exists and no changes happened on the doc since then. */ public IndexRequestBuilder setVersion(long version) { - request.setVersion(version); + request.version(version); return this; } @@ -282,7 +282,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the versioning type. Defaults to {@link VersionType#INTERNAL}. */ public IndexRequestBuilder setVersionType(VersionType versionType) { - request.setVersionType(versionType); + request.versionType(versionType); return this; } @@ -292,7 +292,7 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * set to * to indicate that all percolate queries should be run. */ public IndexRequestBuilder setPercolate(String percolate) { - request.setPercolate(percolate); + request.percolate(percolate); return this; } @@ -300,13 +300,13 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder * Sets the timestamp either as millis since the epoch, or, in the configured date format. */ public IndexRequestBuilder setTimestamp(String timestamp) { - request.setTimestamp(timestamp); + request.timestamp(timestamp); return this; } // Sets the relative ttl value. It musts be > 0 as it makes little sense otherwise. public IndexRequestBuilder setTTL(long ttl) { - request.setTtl(ttl); + request.ttl(ttl); return this; } diff --git a/src/main/java/org/elasticsearch/action/index/TransportIndexAction.java b/src/main/java/org/elasticsearch/action/index/TransportIndexAction.java index 817cfbcada6..a08470b675a 100644 --- a/src/main/java/org/elasticsearch/action/index/TransportIndexAction.java +++ b/src/main/java/org/elasticsearch/action/index/TransportIndexAction.java @@ -92,9 +92,9 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi @Override protected void doExecute(final IndexRequest request, final ActionListener listener) { // if we don't have a master, we don't have metadata, that's fine, let it find a master using create index API - if (autoCreateIndex.shouldAutoCreate(request.getIndex(), clusterService.state())) { + if (autoCreateIndex.shouldAutoCreate(request.index(), clusterService.state())) { request.beforeLocalFork(); // we fork on another thread... - createIndexAction.execute(new CreateIndexRequest(request.getIndex()).setCause("auto(index api)").setMasterNodeTimeout(request.getTimeout()), new ActionListener() { + createIndexAction.execute(new CreateIndexRequest(request.index()).cause("auto(index api)").masterNodeTimeout(request.timeout()), new ActionListener() { @Override public void onResponse(CreateIndexResponse result) { innerExecute(request, listener); @@ -122,11 +122,11 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi @Override protected boolean resolveRequest(ClusterState state, IndexRequest request, ActionListener indexResponseActionListener) { MetaData metaData = clusterService.state().metaData(); - String aliasOrIndex = request.getIndex(); - request.setIndex(metaData.concreteIndex(request.getIndex())); + String aliasOrIndex = request.index(); + request.index(metaData.concreteIndex(request.index())); MappingMetaData mappingMd = null; - if (metaData.hasIndex(request.getIndex())) { - mappingMd = metaData.index(request.getIndex()).mappingOrDefault(request.getType()); + if (metaData.hasIndex(request.index())) { + mappingMd = metaData.index(request.index()).mappingOrDefault(request.type()); } request.process(metaData, aliasOrIndex, mappingMd, allowIdGeneration); return true; @@ -173,13 +173,13 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi @Override protected ClusterBlockException checkRequestBlock(ClusterState state, IndexRequest request) { - return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.getIndex()); + return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.index()); } @Override protected ShardIterator shards(ClusterState clusterState, IndexRequest request) { return clusterService.operationRouting() - .indexShards(clusterService.state(), request.getIndex(), request.getType(), request.getId(), request.getRouting()); + .indexShards(clusterService.state(), request.index(), request.type(), request.id(), request.routing()); } @Override @@ -187,36 +187,36 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi final IndexRequest request = shardRequest.request; // validate, if routing is required, that we got routing - MappingMetaData mappingMd = clusterState.metaData().index(request.getIndex()).mappingOrDefault(request.getType()); + MappingMetaData mappingMd = clusterState.metaData().index(request.index()).mappingOrDefault(request.type()); if (mappingMd != null && mappingMd.routing().required()) { - if (request.getRouting() == null) { - throw new RoutingMissingException(request.getIndex(), request.getType(), request.getId()); + if (request.routing() == null) { + throw new RoutingMissingException(request.index(), request.type(), request.id()); } } - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); - SourceToParse sourceToParse = SourceToParse.source(request.getSource()).type(request.getType()).id(request.getId()) - .routing(request.getRouting()).parent(request.getParent()).timestamp(request.getTimestamp()).ttl(request.getTtl()); + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); + SourceToParse sourceToParse = SourceToParse.source(request.source()).type(request.type()).id(request.id()) + .routing(request.routing()).parent(request.parent()).timestamp(request.timestamp()).ttl(request.ttl()); long version; Engine.IndexingOperation op; - if (request.getOpType() == IndexRequest.OpType.INDEX) { + if (request.opType() == IndexRequest.OpType.INDEX) { Engine.Index index = indexShard.prepareIndex(sourceToParse) - .version(request.getVersion()) - .versionType(request.getVersionType()) + .version(request.version()) + .versionType(request.versionType()) .origin(Engine.Operation.Origin.PRIMARY); indexShard.index(index); version = index.version(); op = index; } else { Engine.Create create = indexShard.prepareCreate(sourceToParse) - .version(request.getVersion()) - .versionType(request.getVersionType()) + .version(request.version()) + .versionType(request.versionType()) .origin(Engine.Operation.Origin.PRIMARY); indexShard.create(create); version = create.version(); op = create; } - if (request.isRefresh()) { + if (request.refresh()) { try { indexShard.refresh(new Engine.Refresh(false)); } catch (Exception e) { @@ -227,21 +227,21 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi updateMappingOnMaster(request); } // update the version on the request, so it will be used for the replicas - request.setVersion(version); + request.version(version); - IndexResponse response = new IndexResponse(request.getIndex(), request.getType(), request.getId(), version); + IndexResponse response = new IndexResponse(request.index(), request.type(), request.id(), version); return new PrimaryResponse(shardRequest.request, response, op); } @Override protected void postPrimaryOperation(IndexRequest request, PrimaryResponse response) { Engine.IndexingOperation op = (Engine.IndexingOperation) response.payload(); - if (!Strings.hasLength(request.getPercolate())) { + if (!Strings.hasLength(request.percolate())) { return; } - IndexService indexService = indicesService.indexServiceSafe(request.getIndex()); + IndexService indexService = indicesService.indexServiceSafe(request.index()); try { - PercolatorExecutor.Response percolate = indexService.percolateService().percolate(new PercolatorExecutor.DocAndSourceQueryRequest(op.parsedDoc(), request.getPercolate())); + PercolatorExecutor.Response percolate = indexService.percolateService().percolate(new PercolatorExecutor.DocAndSourceQueryRequest(op.parsedDoc(), request.percolate())); response.response().setMatches(percolate.matches()); } catch (Exception e) { logger.warn("failed to percolate [{}]", e, request); @@ -250,22 +250,22 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi @Override protected void shardOperationOnReplica(ReplicaOperationRequest shardRequest) { - IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.getIndex()).shardSafe(shardRequest.shardId); + IndexShard indexShard = indicesService.indexServiceSafe(shardRequest.request.index()).shardSafe(shardRequest.shardId); IndexRequest request = shardRequest.request; - SourceToParse sourceToParse = SourceToParse.source(request.getSource()).type(request.getType()).id(request.getId()) - .routing(request.getRouting()).parent(request.getParent()).timestamp(request.getTimestamp()).ttl(request.getTtl()); - if (request.getOpType() == IndexRequest.OpType.INDEX) { + SourceToParse sourceToParse = SourceToParse.source(request.source()).type(request.type()).id(request.id()) + .routing(request.routing()).parent(request.parent()).timestamp(request.timestamp()).ttl(request.ttl()); + if (request.opType() == IndexRequest.OpType.INDEX) { Engine.Index index = indexShard.prepareIndex(sourceToParse) - .version(request.getVersion()) + .version(request.version()) .origin(Engine.Operation.Origin.REPLICA); indexShard.index(index); } else { Engine.Create create = indexShard.prepareCreate(sourceToParse) - .version(request.getVersion()) + .version(request.version()) .origin(Engine.Operation.Origin.REPLICA); indexShard.create(create); } - if (request.isRefresh()) { + if (request.refresh()) { try { indexShard.refresh(new Engine.Refresh(false)); } catch (Exception e) { @@ -277,14 +277,14 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi private void updateMappingOnMaster(final IndexRequest request) { final CountDownLatch latch = new CountDownLatch(1); try { - MapperService mapperService = indicesService.indexServiceSafe(request.getIndex()).mapperService(); - final DocumentMapper documentMapper = mapperService.documentMapper(request.getType()); + MapperService mapperService = indicesService.indexServiceSafe(request.index()).mapperService(); + final DocumentMapper documentMapper = mapperService.documentMapper(request.type()); if (documentMapper == null) { // should not happen return; } documentMapper.refreshSource(); - mappingUpdatedAction.execute(new MappingUpdatedAction.MappingUpdatedRequest(request.getIndex(), request.getType(), documentMapper.mappingSource()), new ActionListener() { + mappingUpdatedAction.execute(new MappingUpdatedAction.MappingUpdatedRequest(request.index(), request.type(), documentMapper.mappingSource()), new ActionListener() { @Override public void onResponse(MappingUpdatedAction.MappingUpdatedResponse mappingUpdatedResponse) { // all is well @@ -295,7 +295,7 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi public void onFailure(Throwable e) { latch.countDown(); try { - logger.warn("Failed to update master on updated mapping for index [" + request.getIndex() + "], type [" + request.getType() + "] and source [" + documentMapper.mappingSource().string() + "]", e); + logger.warn("Failed to update master on updated mapping for index [" + request.index() + "], type [" + request.type() + "] and source [" + documentMapper.mappingSource().string() + "]", e); } catch (IOException e1) { // ignore } @@ -303,7 +303,7 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi }); } catch (Exception e) { latch.countDown(); - logger.warn("Failed to update master on updated mapping for index [" + request.getIndex() + "], type [" + request.getType() + "]", e); + logger.warn("Failed to update master on updated mapping for index [" + request.index() + "], type [" + request.type() + "]", e); } if (waitForMappingChange) { diff --git a/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java b/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java index 92a77073654..65c914e60e5 100644 --- a/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java +++ b/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequest.java @@ -47,7 +47,7 @@ import static org.elasticsearch.search.Scroll.readScroll; * A more like this request allowing to search for documents that a "like" the provided document. The document * to check against to fetched based on the index, type and id provided. Best created with {@link org.elasticsearch.client.Requests#moreLikeThisRequest(String)}. *

- *

Note, the {@link #getIndex()}, {@link #setType(String)} and {@link #setId(String)} are required. + *

Note, the {@link #index()}, {@link #type(String)} and {@link #id(String)} are required. * * @see org.elasticsearch.client.Client#moreLikeThis(MoreLikeThisRequest) * @see org.elasticsearch.client.Requests#moreLikeThisRequest(String) @@ -93,7 +93,7 @@ public class MoreLikeThisRequest extends ActionRequest { /** * Constructs a new more like this request for a document that will be fetch from the provided index. - * Use {@link #setType(String)} and {@link #setId(String)} to specify the document to load. + * Use {@link #type(String)} and {@link #id(String)} to specify the document to load. */ public MoreLikeThisRequest(String index) { this.index = index; @@ -102,18 +102,18 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The index to load the document from which the "like" query will run with. */ - public String getIndex() { + public String index() { return index; } /** * The type of document to load from which the "like" query will run with. */ - public String getType() { + public String type() { return type; } - public void setIndex(String index) { + void index(String index) { this.index = index; } @@ -121,7 +121,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The type of document to load from which the "like" query will execute with. */ @Required - public MoreLikeThisRequest setType(String type) { + public MoreLikeThisRequest type(String type) { this.type = type; return this; } @@ -129,7 +129,7 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The id of document to load from which the "like" query will execute with. */ - public String getId() { + public String id() { return id; } @@ -137,7 +137,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The id of document to load from which the "like" query will execute with. */ @Required - public MoreLikeThisRequest setId(String id) { + public MoreLikeThisRequest id(String id) { this.id = id; return this; } @@ -145,11 +145,11 @@ public class MoreLikeThisRequest extends ActionRequest { /** * @return The routing for this request. This used for the `get` part of the mlt request. */ - public String getRouting() { + public String routing() { return routing; } - public void setRouting(String routing) { + public void routing(String routing) { this.routing = routing; } @@ -157,7 +157,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The fields of the document to use in order to find documents "like" this one. Defaults to run * against all the document fields. */ - public String[] getFields() { + public String[] fields() { return this.fields; } @@ -165,7 +165,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The fields of the document to use in order to find documents "like" this one. Defaults to run * against all the document fields. */ - public MoreLikeThisRequest setFields(String... fields) { + public MoreLikeThisRequest fields(String... fields) { this.fields = fields; return this; } @@ -173,7 +173,7 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The percent of the terms to match for each field. Defaults to 0.3f. */ - public MoreLikeThisRequest setPercentTermsToMatch(float percentTermsToMatch) { + public MoreLikeThisRequest percentTermsToMatch(float percentTermsToMatch) { this.percentTermsToMatch = percentTermsToMatch; return this; } @@ -181,14 +181,14 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The percent of the terms to match for each field. Defaults to 0.3f. */ - public float getPercentTermsToMatch() { + public float percentTermsToMatch() { return this.percentTermsToMatch; } /** * The frequency below which terms will be ignored in the source doc. Defaults to 2. */ - public MoreLikeThisRequest setMinTermFreq(int minTermFreq) { + public MoreLikeThisRequest minTermFreq(int minTermFreq) { this.minTermFreq = minTermFreq; return this; } @@ -196,14 +196,14 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The frequency below which terms will be ignored in the source doc. Defaults to 2. */ - public int getMinTermFreq() { + public int minTermFreq() { return this.minTermFreq; } /** * The maximum number of query terms that will be included in any generated query. Defaults to 25. */ - public MoreLikeThisRequest setMaxQueryTerms(int maxQueryTerms) { + public MoreLikeThisRequest maxQueryTerms(int maxQueryTerms) { this.maxQueryTerms = maxQueryTerms; return this; } @@ -211,7 +211,7 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The maximum number of query terms that will be included in any generated query. Defaults to 25. */ - public int getMaxQueryTerms() { + public int maxQueryTerms() { return this.maxQueryTerms; } @@ -223,7 +223,7 @@ public class MoreLikeThisRequest extends ActionRequest { *

*

Defaults to no stop words. */ - public MoreLikeThisRequest setStopWords(String... stopWords) { + public MoreLikeThisRequest stopWords(String... stopWords) { this.stopWords = stopWords; return this; } @@ -236,7 +236,7 @@ public class MoreLikeThisRequest extends ActionRequest { *

*

Defaults to no stop words. */ - public String[] getStopWords() { + public String[] stopWords() { return this.stopWords; } @@ -244,7 +244,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The frequency at which words will be ignored which do not occur in at least this * many docs. Defaults to 5. */ - public MoreLikeThisRequest setMinDocFreq(int minDocFreq) { + public MoreLikeThisRequest minDocFreq(int minDocFreq) { this.minDocFreq = minDocFreq; return this; } @@ -253,7 +253,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The frequency at which words will be ignored which do not occur in at least this * many docs. Defaults to 5. */ - public int getMinDocFreq() { + public int minDocFreq() { return this.minDocFreq; } @@ -261,7 +261,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The maximum frequency in which words may still appear. Words that appear * in more than this many docs will be ignored. Defaults to unbounded. */ - public MoreLikeThisRequest setMaxDocFreq(int maxDocFreq) { + public MoreLikeThisRequest maxDocFreq(int maxDocFreq) { this.maxDocFreq = maxDocFreq; return this; } @@ -270,14 +270,14 @@ public class MoreLikeThisRequest extends ActionRequest { * The maximum frequency in which words may still appear. Words that appear * in more than this many docs will be ignored. Defaults to unbounded. */ - public int getMaxDocFreq() { + public int maxDocFreq() { return this.maxDocFreq; } /** * The minimum word length below which words will be ignored. Defaults to 0. */ - public MoreLikeThisRequest setMinWordLen(int minWordLen) { + public MoreLikeThisRequest minWordLen(int minWordLen) { this.minWordLen = minWordLen; return this; } @@ -285,14 +285,14 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The minimum word length below which words will be ignored. Defaults to 0. */ - public int getMinWordLen() { + public int minWordLen() { return this.minWordLen; } /** * The maximum word length above which words will be ignored. Defaults to unbounded. */ - public MoreLikeThisRequest setMaxWordLen(int maxWordLen) { + public MoreLikeThisRequest maxWordLen(int maxWordLen) { this.maxWordLen = maxWordLen; return this; } @@ -300,14 +300,14 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The maximum word length above which words will be ignored. Defaults to unbounded. */ - public int getMaxWordLen() { + public int maxWordLen() { return this.maxWordLen; } /** * The boost factor to use when boosting terms. Defaults to 1. */ - public MoreLikeThisRequest setBoostTerms(float boostTerms) { + public MoreLikeThisRequest boostTerms(float boostTerms) { this.boostTerms = boostTerms; return this; } @@ -315,7 +315,7 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The boost factor to use when boosting terms. Defaults to 1. */ - public float getBoostTerms() { + public float boostTerms() { return this.boostTerms; } @@ -330,7 +330,7 @@ public class MoreLikeThisRequest extends ActionRequest { * An optional search source request allowing to control the search request for the * more like this documents. */ - public MoreLikeThisRequest setSearchSource(SearchSourceBuilder sourceBuilder) { + public MoreLikeThisRequest searchSource(SearchSourceBuilder sourceBuilder) { this.searchSource = sourceBuilder.buildAsBytes(Requests.CONTENT_TYPE); this.searchSourceUnsafe = false; return this; @@ -340,23 +340,23 @@ public class MoreLikeThisRequest extends ActionRequest { * An optional search source request allowing to control the search request for the * more like this documents. */ - public MoreLikeThisRequest setSearchSource(String searchSource) { + public MoreLikeThisRequest searchSource(String searchSource) { this.searchSource = new BytesArray(searchSource); this.searchSourceUnsafe = false; return this; } - public MoreLikeThisRequest setSearchSource(Map searchSource) { + public MoreLikeThisRequest searchSource(Map searchSource) { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.map(searchSource); - return setSearchSource(builder); + return searchSource(builder); } catch (IOException e) { throw new ElasticSearchGenerationException("Failed to generate [" + searchSource + "]", e); } } - public MoreLikeThisRequest setSearchSource(XContentBuilder builder) { + public MoreLikeThisRequest searchSource(XContentBuilder builder) { this.searchSource = builder.bytes(); this.searchSourceUnsafe = false; return this; @@ -366,23 +366,23 @@ public class MoreLikeThisRequest extends ActionRequest { * An optional search source request allowing to control the search request for the * more like this documents. */ - public MoreLikeThisRequest setSearchSource(byte[] searchSource) { - return setSearchSource(searchSource, 0, searchSource.length, false); + public MoreLikeThisRequest searchSource(byte[] searchSource) { + return searchSource(searchSource, 0, searchSource.length, false); } /** * An optional search source request allowing to control the search request for the * more like this documents. */ - public MoreLikeThisRequest setSearchSource(byte[] searchSource, int offset, int length, boolean unsafe) { - return setSearchSource(new BytesArray(searchSource, offset, length), unsafe); + public MoreLikeThisRequest searchSource(byte[] searchSource, int offset, int length, boolean unsafe) { + return searchSource(new BytesArray(searchSource, offset, length), unsafe); } /** * An optional search source request allowing to control the search request for the * more like this documents. */ - public MoreLikeThisRequest setSearchSource(BytesReference searchSource, boolean unsafe) { + public MoreLikeThisRequest searchSource(BytesReference searchSource, boolean unsafe) { this.searchSource = searchSource; this.searchSourceUnsafe = unsafe; return this; @@ -392,18 +392,18 @@ public class MoreLikeThisRequest extends ActionRequest { * An optional search source request allowing to control the search request for the * more like this documents. */ - public BytesReference getSearchSource() { + public BytesReference searchSource() { return this.searchSource; } - public boolean isSearchSourceUnsafe() { + public boolean searchSourceUnsafe() { return searchSourceUnsafe; } /** * The search type of the mlt search query. */ - public MoreLikeThisRequest setSearchType(SearchType searchType) { + public MoreLikeThisRequest searchType(SearchType searchType) { this.searchType = searchType; return this; } @@ -411,14 +411,14 @@ public class MoreLikeThisRequest extends ActionRequest { /** * The search type of the mlt search query. */ - public MoreLikeThisRequest setSearchType(String searchType) throws ElasticSearchIllegalArgumentException { - return setSearchType(SearchType.fromString(searchType)); + public MoreLikeThisRequest searchType(String searchType) throws ElasticSearchIllegalArgumentException { + return searchType(SearchType.fromString(searchType)); } /** * The search type of the mlt search query. */ - public SearchType getSearchType() { + public SearchType searchType() { return this.searchType; } @@ -426,7 +426,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The indices the resulting mlt query will run against. If not set, will run * against the index the document was fetched from. */ - public MoreLikeThisRequest setSearchIndices(String... searchIndices) { + public MoreLikeThisRequest searchIndices(String... searchIndices) { this.searchIndices = searchIndices; return this; } @@ -435,7 +435,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The indices the resulting mlt query will run against. If not set, will run * against the index the document was fetched from. */ - public String[] getSearchIndices() { + public String[] searchIndices() { return this.searchIndices; } @@ -443,7 +443,7 @@ public class MoreLikeThisRequest extends ActionRequest { * The types the resulting mlt query will run against. If not set, will run * against the type of the document fetched. */ - public MoreLikeThisRequest setSearchTypes(String... searchTypes) { + public MoreLikeThisRequest searchTypes(String... searchTypes) { this.searchTypes = searchTypes; return this; } @@ -452,14 +452,14 @@ public class MoreLikeThisRequest extends ActionRequest { * The types the resulting mlt query will run against. If not set, will run * against the type of the document fetched. */ - public String[] getSearchTypes() { + public String[] searchTypes() { return this.searchTypes; } /** * Optional search query hint. */ - public MoreLikeThisRequest setSearchQueryHint(String searchQueryHint) { + public MoreLikeThisRequest searchQueryHint(String searchQueryHint) { this.searchQueryHint = searchQueryHint; return this; } @@ -467,7 +467,7 @@ public class MoreLikeThisRequest extends ActionRequest { /** * Optional search query hint. */ - public String getSearchQueryHint() { + public String searchQueryHint() { return this.searchQueryHint; } @@ -475,7 +475,7 @@ public class MoreLikeThisRequest extends ActionRequest { * An optional search scroll request to be able to continue and scroll the search * operation. */ - public MoreLikeThisRequest setSearchScroll(Scroll searchScroll) { + public MoreLikeThisRequest searchScroll(Scroll searchScroll) { this.searchScroll = searchScroll; return this; } @@ -484,31 +484,31 @@ public class MoreLikeThisRequest extends ActionRequest { * An optional search scroll request to be able to continue and scroll the search * operation. */ - public Scroll getSearchScroll() { + public Scroll searchScroll() { return this.searchScroll; } /** * The number of documents to return, defaults to 10. */ - public MoreLikeThisRequest setSearchSize(int size) { + public MoreLikeThisRequest searchSize(int size) { this.searchSize = size; return this; } - public int getSearchSize() { + public int searchSize() { return this.searchSize; } /** * From which search result set to return. */ - public MoreLikeThisRequest setSearchFrom(int from) { + public MoreLikeThisRequest searchFrom(int from) { this.searchFrom = from; return this; } - public int getSearchFrom() { + public int searchFrom() { return this.searchFrom; } diff --git a/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequestBuilder.java b/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequestBuilder.java index 1c40184b707..22d08f68e90 100644 --- a/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/mlt/MoreLikeThisRequestBuilder.java @@ -41,7 +41,7 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilder0.3f. */ public MoreLikeThisRequestBuilder setPercentTermsToMatch(float percentTermsToMatch) { - request.setPercentTermsToMatch(percentTermsToMatch); + request.percentTermsToMatch(percentTermsToMatch); return this; } @@ -73,7 +73,7 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilder2. */ public MoreLikeThisRequestBuilder setMinTermFreq(int minTermFreq) { - request.setMinTermFreq(minTermFreq); + request.minTermFreq(minTermFreq); return this; } @@ -81,7 +81,7 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilder25. */ public MoreLikeThisRequestBuilder maxQueryTerms(int maxQueryTerms) { - request.setMaxQueryTerms(maxQueryTerms); + request.maxQueryTerms(maxQueryTerms); return this; } @@ -94,7 +94,7 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilderDefaults to no stop words. */ public MoreLikeThisRequestBuilder setStopWords(String... stopWords) { - request.setStopWords(stopWords); + request.stopWords(stopWords); return this; } @@ -103,7 +103,7 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilder5. */ public MoreLikeThisRequestBuilder setMinDocFreq(int minDocFreq) { - request.setMinDocFreq(minDocFreq); + request.minDocFreq(minDocFreq); return this; } @@ -112,7 +112,7 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilder0. */ public MoreLikeThisRequestBuilder setMinWordLen(int minWordLen) { - request.setMinWordLen(minWordLen); + request.minWordLen(minWordLen); return this; } @@ -128,7 +128,7 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilder1. */ public MoreLikeThisRequestBuilder setBoostTerms(float boostTerms) { - request.setBoostTerms(boostTerms); + request.boostTerms(boostTerms); return this; } @@ -145,7 +145,7 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilder getFields = newHashSet(); - if (request.getFields() != null) { - Collections.addAll(getFields, request.getFields()); + if (request.fields() != null) { + Collections.addAll(getFields, request.fields()); } // add the source, in case we need to parse it to get fields getFields.add(SourceFieldMapper.NAME); GetRequest getRequest = getRequest(concreteIndex) - .setFields(getFields.toArray(new String[getFields.size()])) - .setType(request.getType()) - .setId(request.getId()) - .setRouting(request.getRouting()) - .setListenerThreaded(true) - .setOperationThreaded(true); + .fields(getFields.toArray(new String[getFields.size()])) + .type(request.type()) + .id(request.id()) + .routing(request.routing()) + .listenerThreaded(true) + .operationThreaded(true); request.beforeLocalFork(); getAction.execute(getRequest, new ActionListener() { @@ -136,13 +136,13 @@ public class TransportMoreLikeThisAction extends TransportAction fields = newHashSet(); - if (request.getFields() != null) { - for (String field : request.getFields()) { + if (request.fields() != null) { + for (String field : request.fields()) { FieldMappers fieldMappers = docMapper.mappers().smartName(field); if (fieldMappers != null) { fields.add(fieldMappers.mapper().names().indexName()); @@ -180,36 +180,36 @@ public class TransportMoreLikeThisAction extends TransportAction() { @Override @@ -234,10 +234,10 @@ public class TransportMoreLikeThisAction extends TransportAction listener, ClusterState clusterState) { - ShardIterator shardIterator = clusterService.operationRouting().getShards(clusterState, request.getIndex(), request.getType(), request.getId(), null, null); + ShardIterator shardIterator = clusterService.operationRouting().getShards(clusterState, request.index(), request.type(), request.id(), null, null); ShardRouting shardRouting = shardIterator.firstOrNull(); if (shardRouting == null) { - throw new ElasticSearchException("No shards for index " + request.getIndex()); + throw new ElasticSearchException("No shards for index " + request.index()); } String nodeId = shardRouting.currentNodeId(); DiscoveryNode discoveryNode = clusterState.nodes().get(nodeId); @@ -269,7 +269,7 @@ public class TransportMoreLikeThisAction extends TransportAction() { @Override public void onResponse(SearchResponse result) { diff --git a/src/main/java/org/elasticsearch/action/percolate/PercolateRequest.java b/src/main/java/org/elasticsearch/action/percolate/PercolateRequest.java index 8d97be765fb..45ae1d8594b 100644 --- a/src/main/java/org/elasticsearch/action/percolate/PercolateRequest.java +++ b/src/main/java/org/elasticsearch/action/percolate/PercolateRequest.java @@ -62,21 +62,21 @@ public class PercolateRequest extends SingleCustomOperationRequest source) { - request.setSource(source); + request.source(source); return this; } @@ -74,7 +74,7 @@ public class PercolateRequestBuilder extends SingleCustomOperationRequestBuilder * @param source The map to index */ public PercolateRequestBuilder setSource(Map source, XContentType contentType) { - request.setSource(source, contentType); + request.source(source, contentType); return this; } @@ -85,7 +85,7 @@ public class PercolateRequestBuilder extends SingleCustomOperationRequestBuilder * or using the {@link #setSource(byte[])}. */ public PercolateRequestBuilder setSource(String source) { - request.setSource(source); + request.source(source); return this; } @@ -93,7 +93,7 @@ public class PercolateRequestBuilder extends SingleCustomOperationRequestBuilder * Sets the content source to index. */ public PercolateRequestBuilder setSource(XContentBuilder sourceBuilder) { - request.setSource(sourceBuilder); + request.source(sourceBuilder); return this; } @@ -101,7 +101,7 @@ public class PercolateRequestBuilder extends SingleCustomOperationRequestBuilder * Sets the document to index in bytes form. */ public PercolateRequestBuilder setSource(BytesReference source) { - request.setSource(source, false); + request.source(source, false); return this; } @@ -109,7 +109,7 @@ public class PercolateRequestBuilder extends SingleCustomOperationRequestBuilder * Sets the document to index in bytes form. */ public PercolateRequestBuilder setSource(BytesReference source, boolean unsafe) { - request.setSource(source, unsafe); + request.source(source, unsafe); return this; } @@ -117,7 +117,7 @@ public class PercolateRequestBuilder extends SingleCustomOperationRequestBuilder * Sets the document to index in bytes form. */ public PercolateRequestBuilder setSource(byte[] source) { - request.setSource(source); + request.source(source); return this; } @@ -130,7 +130,7 @@ public class PercolateRequestBuilder extends SingleCustomOperationRequestBuilder * @param length The length of the data */ public PercolateRequestBuilder setSource(byte[] source, int offset, int length) { - request.setSource(source, offset, length); + request.source(source, offset, length); return this; } @@ -143,7 +143,7 @@ public class PercolateRequestBuilder extends SingleCustomOperationRequestBuilder * @param unsafe Is the byte array safe to be used form a different thread */ public PercolateRequestBuilder setSource(byte[] source, int offset, int length, boolean unsafe) { - request.setSource(source, offset, length, unsafe); + request.source(source, offset, length, unsafe); return this; } diff --git a/src/main/java/org/elasticsearch/action/percolate/TransportPercolateAction.java b/src/main/java/org/elasticsearch/action/percolate/TransportPercolateAction.java index 45c9c1d5b1a..f23c6f044af 100644 --- a/src/main/java/org/elasticsearch/action/percolate/TransportPercolateAction.java +++ b/src/main/java/org/elasticsearch/action/percolate/TransportPercolateAction.java @@ -76,21 +76,21 @@ public class TransportPercolateAction extends TransportSingleCustomOperationActi @Override protected ClusterBlockException checkRequestBlock(ClusterState state, PercolateRequest request) { - request.setIndex(state.metaData().concreteIndex(request.getIndex())); - return state.blocks().indexBlockedException(ClusterBlockLevel.READ, request.getIndex()); + request.index(state.metaData().concreteIndex(request.index())); + return state.blocks().indexBlockedException(ClusterBlockLevel.READ, request.index()); } @Override protected ShardsIterator shards(ClusterState clusterState, PercolateRequest request) { - return clusterState.routingTable().index(request.getIndex()).randomAllActiveShardsIt(); + return clusterState.routingTable().index(request.index()).randomAllActiveShardsIt(); } @Override protected PercolateResponse shardOperation(PercolateRequest request, int shardId) throws ElasticSearchException { - IndexService indexService = indicesService.indexServiceSafe(request.getIndex()); + IndexService indexService = indicesService.indexServiceSafe(request.index()); PercolatorService percolatorService = indexService.percolateService(); - PercolatorExecutor.Response percolate = percolatorService.percolate(new PercolatorExecutor.SourceRequest(request.getType(), request.getSource())); + PercolatorExecutor.Response percolate = percolatorService.percolate(new PercolatorExecutor.SourceRequest(request.type(), request.source())); return new PercolateResponse(percolate.matches()); } } diff --git a/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java b/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java index 6d5d826e7d5..78dceea660e 100644 --- a/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java +++ b/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java @@ -91,12 +91,12 @@ public class MultiSearchRequest extends ActionRequest { SearchRequest searchRequest = new SearchRequest(indices); if (ignoreIndices != null) { - searchRequest.setIgnoreIndices(ignoreIndices); + searchRequest.ignoreIndices(ignoreIndices); } if (types != null && types.length > 0) { - searchRequest.setTypes(types); + searchRequest.types(types); } - searchRequest.setSearchType(searchType); + searchRequest.searchType(searchType); // now parse the action if (nextMarker - from > 0) { @@ -112,23 +112,23 @@ public class MultiSearchRequest extends ActionRequest { currentFieldName = parser.currentName(); } else if (token.isValue()) { if ("index".equals(currentFieldName) || "indices".equals(currentFieldName)) { - searchRequest.setIndices(Strings.splitStringByCommaToArray(parser.text())); + searchRequest.indices(Strings.splitStringByCommaToArray(parser.text())); } else if ("type".equals(currentFieldName) || "types".equals(currentFieldName)) { - searchRequest.setTypes(Strings.splitStringByCommaToArray(parser.text())); + searchRequest.types(Strings.splitStringByCommaToArray(parser.text())); } else if ("search_type".equals(currentFieldName) || "searchType".equals(currentFieldName)) { - searchRequest.setSearchType(parser.text()); + searchRequest.searchType(parser.text()); } else if ("preference".equals(currentFieldName)) { - searchRequest.setPreference(parser.text()); + searchRequest.preference(parser.text()); } else if ("routing".equals(currentFieldName)) { - searchRequest.setRouting(parser.text()); + searchRequest.routing(parser.text()); } else if ("ignore_indices".equals(currentFieldName) || "ignoreIndices".equals(currentFieldName)) { - searchRequest.setIgnoreIndices(IgnoreIndices.fromString(parser.text())); + searchRequest.ignoreIndices(IgnoreIndices.fromString(parser.text())); } } else if (token == XContentParser.Token.START_ARRAY) { if ("index".equals(currentFieldName) || "indices".equals(currentFieldName)) { - searchRequest.setIndices(parseArray(parser)); + searchRequest.indices(parseArray(parser)); } else if ("type".equals(currentFieldName) || "types".equals(currentFieldName)) { - searchRequest.setTypes(parseArray(parser)); + searchRequest.types(parseArray(parser)); } else { throw new ElasticSearchParseException(currentFieldName + " doesn't support arrays"); } @@ -148,7 +148,7 @@ public class MultiSearchRequest extends ActionRequest { break; } - searchRequest.setSource(data.slice(from, nextMarker - from), contentUnsafe); + searchRequest.source(data.slice(from, nextMarker - from), contentUnsafe); // move pointers from = nextMarker + 1; @@ -176,7 +176,7 @@ public class MultiSearchRequest extends ActionRequest { return -1; } - public List getRequests() { + public List requests() { return this.requests; } @@ -199,11 +199,11 @@ public class MultiSearchRequest extends ActionRequest { return validationException; } - public IgnoreIndices getIgnoreIndices() { + public IgnoreIndices ignoreIndices() { return ignoreIndices; } - public MultiSearchRequest setIgnoreIndices(IgnoreIndices ignoreIndices) { + public MultiSearchRequest ignoreIndices(IgnoreIndices ignoreIndices) { this.ignoreIndices = ignoreIndices; return this; } diff --git a/src/main/java/org/elasticsearch/action/search/MultiSearchRequestBuilder.java b/src/main/java/org/elasticsearch/action/search/MultiSearchRequestBuilder.java index 0847e917ed7..f0a3ce42d9d 100644 --- a/src/main/java/org/elasticsearch/action/search/MultiSearchRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/search/MultiSearchRequestBuilder.java @@ -42,8 +42,8 @@ public class MultiSearchRequestBuilder extends ActionRequestBuilder - *

Note, the search {@link #setSource(org.elasticsearch.search.builder.SearchSourceBuilder)} + *

Note, the search {@link #source(org.elasticsearch.search.builder.SearchSourceBuilder)} * is required. The search source is the different search options, including facets and such. *

- *

There is an option to specify an addition search source using the {@link #setExtraSource(org.elasticsearch.search.builder.SearchSourceBuilder)}. + *

There is an option to specify an addition search source using the {@link #extraSource(org.elasticsearch.search.builder.SearchSourceBuilder)}. * * @see org.elasticsearch.client.Requests#searchRequest(String...) * @see org.elasticsearch.client.Client#search(SearchRequest) @@ -134,7 +134,7 @@ public class SearchRequest extends ActionRequest { /** * Sets the indices the search will be executed on. */ - public SearchRequest setIndices(String... indices) { + public SearchRequest indices(String... indices) { this.indices = indices; return this; } @@ -142,14 +142,14 @@ public class SearchRequest extends ActionRequest { /** * Controls the the search operation threading model. */ - public SearchOperationThreading getOperationThreading() { + public SearchOperationThreading operationThreading() { return this.operationThreading; } /** * Controls the the search operation threading model. */ - public SearchRequest setOperationThreading(SearchOperationThreading operationThreading) { + public SearchRequest operationThreading(SearchOperationThreading operationThreading) { this.operationThreading = operationThreading; return this; } @@ -158,15 +158,15 @@ public class SearchRequest extends ActionRequest { * Sets the string representation of the operation threading model. Can be one of * "no_threads", "single_thread" and "thread_per_shard". */ - public SearchRequest setOperationThreading(String operationThreading) { - return setOperationThreading(SearchOperationThreading.fromString(operationThreading, this.operationThreading)); + public SearchRequest operationThreading(String operationThreading) { + return operationThreading(SearchOperationThreading.fromString(operationThreading, this.operationThreading)); } - public IgnoreIndices getIgnoreIndices() { + public IgnoreIndices ignoreIndices() { return ignoreIndices; } - public SearchRequest setIgnoreIndices(IgnoreIndices ignoreIndices) { + public SearchRequest ignoreIndices(IgnoreIndices ignoreIndices) { this.ignoreIndices = ignoreIndices; return this; } @@ -175,7 +175,7 @@ public class SearchRequest extends ActionRequest { * The document types to execute the search against. Defaults to be executed against * all types. */ - public String[] getTypes() { + public String[] types() { return types; } @@ -183,7 +183,7 @@ public class SearchRequest extends ActionRequest { * The document types to execute the search against. Defaults to be executed against * all types. */ - public SearchRequest setTypes(String... types) { + public SearchRequest types(String... types) { this.types = types; return this; } @@ -191,14 +191,14 @@ public class SearchRequest extends ActionRequest { /** * A comma separated list of routing values to control the shards the search will be executed on. */ - public String getRouting() { + public String routing() { return this.routing; } /** * A comma separated list of routing values to control the shards the search will be executed on. */ - public SearchRequest setRouting(String routing) { + public SearchRequest routing(String routing) { this.routing = routing; return this; } @@ -206,7 +206,7 @@ public class SearchRequest extends ActionRequest { /** * The routing values to control the shards that the search will be executed on. */ - public SearchRequest setRouting(String... routings) { + public SearchRequest routing(String... routings) { this.routing = Strings.arrayToCommaDelimitedString(routings); return this; } @@ -216,19 +216,19 @@ public class SearchRequest extends ActionRequest { * _local to prefer local shards, _primary to execute only on primary shards, or * a custom value, which guarantees that the same order will be used across different requests. */ - public SearchRequest setPreference(String preference) { + public SearchRequest preference(String preference) { this.preference = preference; return this; } - public String getPreference() { + public String preference() { return this.preference; } /** * The search type to execute, defaults to {@link SearchType#DEFAULT}. */ - public SearchRequest setSearchType(SearchType searchType) { + public SearchRequest searchType(SearchType searchType) { this.searchType = searchType; return this; } @@ -238,24 +238,24 @@ public class SearchRequest extends ActionRequest { * one of "dfs_query_then_fetch"/"dfsQueryThenFetch", "dfs_query_and_fetch"/"dfsQueryAndFetch", * "query_then_fetch"/"queryThenFetch", and "query_and_fetch"/"queryAndFetch". */ - public SearchRequest setSearchType(String searchType) throws ElasticSearchIllegalArgumentException { - return setSearchType(SearchType.fromString(searchType)); + public SearchRequest searchType(String searchType) throws ElasticSearchIllegalArgumentException { + return searchType(SearchType.fromString(searchType)); } /** * The source of the search request. */ - public SearchRequest setSource(SearchSourceBuilder sourceBuilder) { + public SearchRequest source(SearchSourceBuilder sourceBuilder) { this.source = sourceBuilder.buildAsBytes(contentType); this.sourceUnsafe = false; return this; } /** - * The source of the search request. Consider using either {@link #setSource(byte[])} or - * {@link #setSource(org.elasticsearch.search.builder.SearchSourceBuilder)}. + * The source of the search request. Consider using either {@link #source(byte[])} or + * {@link #source(org.elasticsearch.search.builder.SearchSourceBuilder)}. */ - public SearchRequest setSource(String source) { + public SearchRequest source(String source) { this.source = new BytesArray(source); this.sourceUnsafe = false; return this; @@ -264,17 +264,17 @@ public class SearchRequest extends ActionRequest { /** * The source of the search request in the form of a map. */ - public SearchRequest setSource(Map source) { + public SearchRequest source(Map source) { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.map(source); - return setSource(builder); + return source(builder); } catch (IOException e) { throw new ElasticSearchGenerationException("Failed to generate [" + source + "]", e); } } - public SearchRequest setSource(XContentBuilder builder) { + public SearchRequest source(XContentBuilder builder) { this.source = builder.bytes(); this.sourceUnsafe = false; return this; @@ -283,29 +283,29 @@ public class SearchRequest extends ActionRequest { /** * The search source to execute. */ - public SearchRequest setSource(byte[] source) { - return setSource(source, 0, source.length, false); + public SearchRequest source(byte[] source) { + return source(source, 0, source.length, false); } /** * The search source to execute. */ - public SearchRequest setSource(byte[] source, int offset, int length) { - return setSource(source, offset, length, false); + public SearchRequest source(byte[] source, int offset, int length) { + return source(source, offset, length, false); } /** * The search source to execute. */ - public SearchRequest setSource(byte[] source, int offset, int length, boolean unsafe) { - return setSource(new BytesArray(source, offset, length), unsafe); + public SearchRequest source(byte[] source, int offset, int length, boolean unsafe) { + return source(new BytesArray(source, offset, length), unsafe); } /** * The search source to execute. */ - public SearchRequest setSource(BytesReference source, boolean unsafe) { + public SearchRequest source(BytesReference source, boolean unsafe) { this.source = source; this.sourceUnsafe = unsafe; return this; @@ -314,14 +314,14 @@ public class SearchRequest extends ActionRequest { /** * The search source to execute. */ - public BytesReference getSource() { + public BytesReference source() { return source; } /** * Allows to provide additional source that will be used as well. */ - public SearchRequest setExtraSource(SearchSourceBuilder sourceBuilder) { + public SearchRequest extraSource(SearchSourceBuilder sourceBuilder) { if (sourceBuilder == null) { extraSource = null; return this; @@ -331,17 +331,17 @@ public class SearchRequest extends ActionRequest { return this; } - public SearchRequest setExtraSource(Map extraSource) { + public SearchRequest extraSource(Map extraSource) { try { XContentBuilder builder = XContentFactory.contentBuilder(contentType); builder.map(extraSource); - return setExtraSource(builder); + return extraSource(builder); } catch (IOException e) { throw new ElasticSearchGenerationException("Failed to generate [" + source + "]", e); } } - public SearchRequest setExtraSource(XContentBuilder builder) { + public SearchRequest extraSource(XContentBuilder builder) { this.extraSource = builder.bytes(); this.extraSourceUnsafe = false; return this; @@ -350,7 +350,7 @@ public class SearchRequest extends ActionRequest { /** * Allows to provide additional source that will use used as well. */ - public SearchRequest setExtraSource(String source) { + public SearchRequest extraSource(String source) { this.extraSource = new BytesArray(source); this.extraSourceUnsafe = false; return this; @@ -359,28 +359,28 @@ public class SearchRequest extends ActionRequest { /** * Allows to provide additional source that will be used as well. */ - public SearchRequest setExtraSource(byte[] source) { - return setExtraSource(source, 0, source.length, false); + public SearchRequest extraSource(byte[] source) { + return extraSource(source, 0, source.length, false); } /** * Allows to provide additional source that will be used as well. */ - public SearchRequest setExtraSource(byte[] source, int offset, int length) { - return setExtraSource(source, offset, length, false); + public SearchRequest extraSource(byte[] source, int offset, int length) { + return extraSource(source, offset, length, false); } /** * Allows to provide additional source that will be used as well. */ - public SearchRequest setExtraSource(byte[] source, int offset, int length, boolean unsafe) { - return setExtraSource(new BytesArray(source, offset, length), unsafe); + public SearchRequest extraSource(byte[] source, int offset, int length, boolean unsafe) { + return extraSource(new BytesArray(source, offset, length), unsafe); } /** * Allows to provide additional source that will be used as well. */ - public SearchRequest setExtraSource(BytesReference source, boolean unsafe) { + public SearchRequest extraSource(BytesReference source, boolean unsafe) { this.extraSource = source; this.extraSourceUnsafe = unsafe; return this; @@ -389,35 +389,35 @@ public class SearchRequest extends ActionRequest { /** * Additional search source to execute. */ - public BytesReference getExtraSource() { + public BytesReference extraSource() { return this.extraSource; } /** * The tye of search to execute. */ - public SearchType getSearchType() { + public SearchType searchType() { return searchType; } /** * The indices */ - public String[] getIndices() { + public String[] indices() { return indices; } /** * If set, will enable scrolling of the search request. */ - public Scroll getScroll() { + public Scroll scroll() { return scroll; } /** * If set, will enable scrolling of the search request. */ - public SearchRequest setScroll(Scroll scroll) { + public SearchRequest scroll(Scroll scroll) { this.scroll = scroll; return this; } @@ -425,15 +425,15 @@ public class SearchRequest extends ActionRequest { /** * If set, will enable scrolling of the search request for the specified timeout. */ - public SearchRequest setScroll(TimeValue keepAlive) { - return setScroll(new Scroll(keepAlive)); + public SearchRequest scroll(TimeValue keepAlive) { + return scroll(new Scroll(keepAlive)); } /** * If set, will enable scrolling of the search request for the specified timeout. */ - public SearchRequest setScroll(String keepAlive) { - return setScroll(new Scroll(TimeValue.parseTimeValue(keepAlive, null))); + public SearchRequest scroll(String keepAlive) { + return scroll(new Scroll(TimeValue.parseTimeValue(keepAlive, null))); } @Override diff --git a/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java b/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java index fc211b50125..7f740b1dad6 100644 --- a/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java @@ -57,7 +57,7 @@ public class SearchRequestBuilder extends ActionRequestBuilder listener) { if (sourceBuilder != null) { - request.setSource(sourceBuilder()); + request.source(sourceBuilder()); } ((Client) client).search(request, listener); } diff --git a/src/main/java/org/elasticsearch/action/search/SearchResponse.java b/src/main/java/org/elasticsearch/action/search/SearchResponse.java index 168e6127da5..9add9ce92dc 100644 --- a/src/main/java/org/elasticsearch/action/search/SearchResponse.java +++ b/src/main/java/org/elasticsearch/action/search/SearchResponse.java @@ -153,7 +153,7 @@ public class SearchResponse extends ActionResponse implements ToXContent { } /** - * If scrolling was enabled ({@link SearchRequest#setScroll(org.elasticsearch.search.Scroll)}, the + * If scrolling was enabled ({@link SearchRequest#scroll(org.elasticsearch.search.Scroll)}, the * scroll id that can be used to continue scrolling. */ public String getScrollId() { diff --git a/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java b/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java index dfeaf3fa82e..4457a4d210e 100644 --- a/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java +++ b/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java @@ -61,14 +61,14 @@ public class SearchScrollRequest extends ActionRequest { /** * Controls the the search operation threading model. */ - public SearchOperationThreading getOperationThreading() { + public SearchOperationThreading operationThreading() { return this.operationThreading; } /** * Controls the the search operation threading model. */ - public SearchScrollRequest setOperationThreading(SearchOperationThreading operationThreading) { + public SearchScrollRequest operationThreading(SearchOperationThreading operationThreading) { this.operationThreading = operationThreading; return this; } @@ -76,11 +76,11 @@ public class SearchScrollRequest extends ActionRequest { /** * The scroll id used to scroll the search. */ - public String getScrollId() { + public String scrollId() { return scrollId; } - public SearchScrollRequest setScrollId(String scrollId) { + public SearchScrollRequest scrollId(String scrollId) { this.scrollId = scrollId; return this; } @@ -88,14 +88,14 @@ public class SearchScrollRequest extends ActionRequest { /** * If set, will enable scrolling of the search request. */ - public Scroll getScroll() { + public Scroll scroll() { return scroll; } /** * If set, will enable scrolling of the search request. */ - public SearchScrollRequest setScroll(Scroll scroll) { + public SearchScrollRequest scroll(Scroll scroll) { this.scroll = scroll; return this; } @@ -103,15 +103,15 @@ public class SearchScrollRequest extends ActionRequest { /** * If set, will enable scrolling of the search request for the specified timeout. */ - public SearchScrollRequest setScroll(TimeValue keepAlive) { - return setScroll(new Scroll(keepAlive)); + public SearchScrollRequest scroll(TimeValue keepAlive) { + return scroll(new Scroll(keepAlive)); } /** * If set, will enable scrolling of the search request for the specified timeout. */ - public SearchScrollRequest setScroll(String keepAlive) { - return setScroll(new Scroll(TimeValue.parseTimeValue(keepAlive, null))); + public SearchScrollRequest scroll(String keepAlive) { + return scroll(new Scroll(TimeValue.parseTimeValue(keepAlive, null))); } @Override diff --git a/src/main/java/org/elasticsearch/action/search/SearchScrollRequestBuilder.java b/src/main/java/org/elasticsearch/action/search/SearchScrollRequestBuilder.java index f3d5a469823..7f4fdef1098 100644 --- a/src/main/java/org/elasticsearch/action/search/SearchScrollRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/search/SearchScrollRequestBuilder.java @@ -43,7 +43,7 @@ public class SearchScrollRequestBuilder extends ActionRequestBuilder() { + searchAction.execute(request.requests().get(i), new ActionListener() { @Override public void onResponse(SearchResponse searchResponse) { synchronized (responses) { @@ -98,7 +98,7 @@ public class TransportMultiSearchAction extends TransportAction() { @Override public void onResponse(MultiSearchResponse response) { diff --git a/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java b/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java index 2cd943c29ec..95ccb989855 100644 --- a/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java +++ b/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java @@ -84,15 +84,15 @@ public class TransportSearchAction extends TransportAction listener) { // optimize search type for cases where there is only one shard group to search on - if (optimizeSingleShard && searchRequest.getSearchType() != SCAN && searchRequest.getSearchType() != COUNT) { + if (optimizeSingleShard && searchRequest.searchType() != SCAN && searchRequest.searchType() != COUNT) { try { ClusterState clusterState = clusterService.state(); - String[] concreteIndices = clusterState.metaData().concreteIndices(searchRequest.getIndices(), searchRequest.getIgnoreIndices(), true); - Map> routingMap = clusterState.metaData().resolveSearchRouting(searchRequest.getRouting(), searchRequest.getIndices()); - int shardCount = clusterService.operationRouting().searchShardsCount(clusterState, searchRequest.getIndices(), concreteIndices, routingMap, searchRequest.getPreference()); + String[] concreteIndices = clusterState.metaData().concreteIndices(searchRequest.indices(), searchRequest.ignoreIndices(), true); + Map> routingMap = clusterState.metaData().resolveSearchRouting(searchRequest.routing(), searchRequest.indices()); + int shardCount = clusterService.operationRouting().searchShardsCount(clusterState, searchRequest.indices(), concreteIndices, routingMap, searchRequest.preference()); if (shardCount == 1) { // if we only have one group, then we always want Q_A_F, no need for DFS, and no need to do THEN since we hit one shard - searchRequest.setSearchType(QUERY_AND_FETCH); + searchRequest.searchType(QUERY_AND_FETCH); } } catch (IndexMissingException e) { // ignore this, we will notify the search response if its really the case @@ -102,17 +102,17 @@ public class TransportSearchAction extends TransportAction() { @Override diff --git a/src/main/java/org/elasticsearch/action/search/TransportSearchScrollAction.java b/src/main/java/org/elasticsearch/action/search/TransportSearchScrollAction.java index 5b513dd1f4b..23272f0bb91 100644 --- a/src/main/java/org/elasticsearch/action/search/TransportSearchScrollAction.java +++ b/src/main/java/org/elasticsearch/action/search/TransportSearchScrollAction.java @@ -63,7 +63,7 @@ public class TransportSearchScrollAction extends TransportAction listener) { try { - ParsedScrollId scrollId = parseScrollId(request.getScrollId()); + ParsedScrollId scrollId = parseScrollId(request.scrollId()); if (scrollId.getType().equals(QUERY_THEN_FETCH_TYPE)) { queryThenFetchAction.execute(request, scrollId, listener); } else if (scrollId.getType().equals(QUERY_AND_FETCH_TYPE)) { @@ -88,7 +88,7 @@ public class TransportSearchScrollAction extends TransportAction() { @Override public void onResponse(SearchResponse result) { @@ -115,4 +115,4 @@ public class TransportSearchScrollAction extends TransportActionof()); String scrollId = null; - if (request.getScroll() != null) { - scrollId = buildScrollId(request.getSearchType(), queryFetchResults.values(), null); + if (request.scroll() != null) { + scrollId = buildScrollId(request.searchType(), queryFetchResults.values(), null); } listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures())); searchCache.releaseQueryResults(queryFetchResults); @@ -97,4 +97,4 @@ public class TransportSearchCountAction extends TransportSearchTypeAction { } private static ShardDoc[] EMPTY_DOCS = new ShardDoc[0]; -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryAndFetchAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryAndFetchAction.java index 9d3896d8967..35ef050a47d 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryAndFetchAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryAndFetchAction.java @@ -102,7 +102,7 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc } } if (localOperations > 0) { - if (request.getOperationThreading() == SearchOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == SearchOperationThreading.SINGLE_THREAD) { threadPool.executor(ThreadPool.Names.SEARCH).execute(new Runnable() { @Override public void run() { @@ -116,7 +116,7 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc } }); } else { - boolean localAsync = request.getOperationThreading() == SearchOperationThreading.THREAD_PER_SHARD; + boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final DfsSearchResult dfsResult : dfsResults) { final DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { @@ -181,10 +181,10 @@ public class TransportSearchDfsQueryAndFetchAction extends TransportSearchTypeAc sortedShardList = searchPhaseController.sortDocs(queryFetchResults.values()); final InternalSearchResponse internalResponse = searchPhaseController.merge(sortedShardList, queryFetchResults, queryFetchResults); String scrollId = null; - if (request.getScroll() != null) { - scrollId = buildScrollId(request.getSearchType(), dfsResults, null); + if (request.scroll() != null) { + scrollId = buildScrollId(request.searchType(), dfsResults, null); } listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures())); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java index 6916019a154..ff43951f0d1 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchDfsQueryThenFetchAction.java @@ -109,7 +109,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA } if (localOperations > 0) { - if (request.getOperationThreading() == SearchOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == SearchOperationThreading.SINGLE_THREAD) { threadPool.executor(ThreadPool.Names.SEARCH).execute(new Runnable() { @Override public void run() { @@ -123,7 +123,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA } }); } else { - boolean localAsync = request.getOperationThreading() == SearchOperationThreading.THREAD_PER_SHARD; + boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final DfsSearchResult dfsResult : dfsResults) { final DiscoveryNode node = nodes.get(dfsResult.shardTarget().nodeId()); if (node.id().equals(nodes.localNodeId())) { @@ -200,7 +200,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA } if (localOperations > 0) { - if (request.getOperationThreading() == SearchOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == SearchOperationThreading.SINGLE_THREAD) { threadPool.executor(ThreadPool.Names.SEARCH).execute(new Runnable() { @Override public void run() { @@ -214,7 +214,7 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA } }); } else { - boolean localAsync = request.getOperationThreading() == SearchOperationThreading.THREAD_PER_SHARD; + boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Map.Entry entry : docIdsToLoad.entrySet()) { final DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { @@ -280,8 +280,8 @@ public class TransportSearchDfsQueryThenFetchAction extends TransportSearchTypeA void innerFinishHim() throws Exception { final InternalSearchResponse internalResponse = searchPhaseController.merge(sortedShardList, queryResults, fetchResults); String scrollId = null; - if (request.getScroll() != null) { - scrollId = TransportSearchHelper.buildScrollId(request.getSearchType(), dfsResults, null); + if (request.scroll() != null) { + scrollId = TransportSearchHelper.buildScrollId(request.searchType(), dfsResults, null); } listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures())); } diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java index 78f1562ecd1..32781d9f0d8 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryAndFetchAction.java @@ -85,11 +85,11 @@ public class TransportSearchQueryAndFetchAction extends TransportSearchTypeActio sortedShardList = searchPhaseController.sortDocs(queryFetchResults.values()); final InternalSearchResponse internalResponse = searchPhaseController.merge(sortedShardList, queryFetchResults, queryFetchResults); String scrollId = null; - if (request.getScroll() != null) { - scrollId = buildScrollId(request.getSearchType(), queryFetchResults.values(), null); + if (request.scroll() != null) { + scrollId = buildScrollId(request.searchType(), queryFetchResults.values(), null); } listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures())); searchCache.releaseQueryFetchResults(queryFetchResults); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java index f3cd35e2b25..84ef653a7c9 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchQueryThenFetchAction.java @@ -110,7 +110,7 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi } if (localOperations > 0) { - if (request.getOperationThreading() == SearchOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == SearchOperationThreading.SINGLE_THREAD) { threadPool.executor(ThreadPool.Names.SEARCH).execute(new Runnable() { @Override public void run() { @@ -124,7 +124,7 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi } }); } else { - boolean localAsync = request.getOperationThreading() == SearchOperationThreading.THREAD_PER_SHARD; + boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Map.Entry entry : docIdsToLoad.entrySet()) { final DiscoveryNode node = nodes.get(entry.getKey().nodeId()); if (node.id().equals(nodes.localNodeId())) { @@ -189,10 +189,10 @@ public class TransportSearchQueryThenFetchAction extends TransportSearchTypeActi void innerFinishHim() throws Exception { InternalSearchResponse internalResponse = searchPhaseController.merge(sortedShardList, queryResults, fetchResults); String scrollId = null; - if (request.getScroll() != null) { - scrollId = TransportSearchHelper.buildScrollId(request.getSearchType(), queryResults.values(), null); + if (request.scroll() != null) { + scrollId = TransportSearchHelper.buildScrollId(request.searchType(), queryResults.values(), null); } listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures())); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchScanAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchScanAction.java index d3ff5f74602..a6722b9d4ad 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchScanAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchScanAction.java @@ -84,8 +84,8 @@ public class TransportSearchScanAction extends TransportSearchTypeAction { protected void moveToSecondPhase() throws Exception { final InternalSearchResponse internalResponse = searchPhaseController.merge(EMPTY_DOCS, queryResults, ImmutableMap.of()); String scrollId = null; - if (request.getScroll() != null) { - scrollId = buildScrollId(request.getSearchType(), queryResults.values(), ImmutableMap.of("total_hits", Long.toString(internalResponse.hits().totalHits()))); + if (request.scroll() != null) { + scrollId = buildScrollId(request.searchType(), queryResults.values(), ImmutableMap.of("total_hits", Long.toString(internalResponse.hits().totalHits()))); } listener.onResponse(new SearchResponse(internalResponse, scrollId, expectedSuccessfulOps, successulOps.get(), buildTookInMillis(), buildShardFailures())); searchCache.releaseQueryResults(queryResults); @@ -93,4 +93,4 @@ public class TransportSearchScanAction extends TransportSearchTypeAction { } private static ShardDoc[] EMPTY_DOCS = new ShardDoc[0]; -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java index 446111aaa24..47223775dd3 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryAndFetchAction.java @@ -148,7 +148,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent } if (localOperations > 0) { - if (request.getOperationThreading() == SearchOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == SearchOperationThreading.SINGLE_THREAD) { threadPool.executor(ThreadPool.Names.SEARCH).execute(new Runnable() { @Override public void run() { @@ -161,7 +161,7 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent } }); } else { - boolean localAsync = request.getOperationThreading() == SearchOperationThreading.THREAD_PER_SHARD; + boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Tuple target : scrollId.getContext()) { final DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { @@ -231,12 +231,12 @@ public class TransportSearchScrollQueryAndFetchAction extends AbstractComponent ShardDoc[] sortedShardList = searchPhaseController.sortDocs(queryFetchResults.values()); final InternalSearchResponse internalResponse = searchPhaseController.merge(sortedShardList, queryFetchResults, queryFetchResults); String scrollId = null; - if (request.getScroll() != null) { - scrollId = request.getScrollId(); + if (request.scroll() != null) { + scrollId = request.scrollId(); } searchCache.releaseQueryFetchResults(queryFetchResults); listener.onResponse(new SearchResponse(internalResponse, scrollId, this.scrollId.getContext().length, successfulOps.get(), System.currentTimeMillis() - startTime, buildShardFailures())); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java index 70314c1123a..5920050dd67 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollQueryThenFetchAction.java @@ -154,7 +154,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent } if (localOperations > 0) { - if (request.getOperationThreading() == SearchOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == SearchOperationThreading.SINGLE_THREAD) { threadPool.executor(ThreadPool.Names.SEARCH).execute(new Runnable() { @Override public void run() { @@ -167,7 +167,7 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent } }); } else { - boolean localAsync = request.getOperationThreading() == SearchOperationThreading.THREAD_PER_SHARD; + boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Tuple target : scrollId.getContext()) { final DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { @@ -261,8 +261,8 @@ public class TransportSearchScrollQueryThenFetchAction extends AbstractComponent private void innerFinishHim() { InternalSearchResponse internalResponse = searchPhaseController.merge(sortedShardList, queryResults, fetchResults); String scrollId = null; - if (request.getScroll() != null) { - scrollId = request.getScrollId(); + if (request.scroll() != null) { + scrollId = request.scrollId(); } listener.onResponse(new SearchResponse(internalResponse, scrollId, this.scrollId.getContext().length, successfulOps.get(), System.currentTimeMillis() - startTime, buildShardFailures())); diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollScanAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollScanAction.java index d389b2d4934..41c6029be39 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollScanAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchScrollScanAction.java @@ -129,7 +129,7 @@ public class TransportSearchScrollScanAction extends AbstractComponent { if (scrollId.getContext().length == 0) { final InternalSearchResponse internalResponse = new InternalSearchResponse(new InternalSearchHits(InternalSearchHits.EMPTY, Long.parseLong(this.scrollId.getAttributes().get("total_hits")), 0.0f), null, null, false); searchCache.releaseQueryFetchResults(queryFetchResults); - listener.onResponse(new SearchResponse(internalResponse, request.getScrollId(), 0, 0, 0l, buildShardFailures())); + listener.onResponse(new SearchResponse(internalResponse, request.scrollId(), 0, 0, 0l, buildShardFailures())); return; } @@ -154,7 +154,7 @@ public class TransportSearchScrollScanAction extends AbstractComponent { } if (localOperations > 0) { - if (request.getOperationThreading() == SearchOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == SearchOperationThreading.SINGLE_THREAD) { threadPool.executor(ThreadPool.Names.SEARCH).execute(new Runnable() { @Override public void run() { @@ -167,7 +167,7 @@ public class TransportSearchScrollScanAction extends AbstractComponent { } }); } else { - boolean localAsync = request.getOperationThreading() == SearchOperationThreading.THREAD_PER_SHARD; + boolean localAsync = request.operationThreading() == SearchOperationThreading.THREAD_PER_SHARD; for (final Tuple target : scrollId.getContext()) { final DiscoveryNode node = nodes.get(target.v1()); if (node != null && nodes.localNodeId().equals(node.id())) { @@ -264,7 +264,7 @@ public class TransportSearchScrollScanAction extends AbstractComponent { } String scrollId = null; - if (request.getScroll() != null) { + if (request.scroll() != null) { // we rebuild the scroll id since we remove shards that we finished scrolling on scrollId = TransportSearchHelper.buildScrollId(this.scrollId.getType(), queryFetchResults.values(), this.scrollId.getAttributes()); // continue moving the total_hits } @@ -272,4 +272,4 @@ public class TransportSearchScrollScanAction extends AbstractComponent { System.currentTimeMillis() - startTime, buildShardFailures())); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java b/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java index d641d06b3b3..26934f71674 100644 --- a/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java +++ b/src/main/java/org/elasticsearch/action/search/type/TransportSearchTypeAction.java @@ -108,22 +108,22 @@ public abstract class TransportSearchTypeAction extends TransportAction> routingMap = clusterState.metaData().resolveSearchRouting(request.getRouting(), request.getIndices()); + Map> routingMap = clusterState.metaData().resolveSearchRouting(request.routing(), request.indices()); - shardsIts = clusterService.operationRouting().searchShards(clusterState, request.getIndices(), concreteIndices, routingMap, request.getPreference()); + shardsIts = clusterService.operationRouting().searchShards(clusterState, request.indices(), concreteIndices, routingMap, request.preference()); expectedSuccessfulOps = shardsIts.size(); // we need to add 1 for non active partition, since we count it in the total! expectedTotalOps = shardsIts.totalSizeWith1ForEmpty(); if (expectedSuccessfulOps == 0) { // not search shards to search on... - throw new SearchPhaseExecutionException("initial", "No indices / shards to search on, requested indices are " + Arrays.toString(request.getIndices()), buildShardFailures()); + throw new SearchPhaseExecutionException("initial", "No indices / shards to search on, requested indices are " + Arrays.toString(request.indices()), buildShardFailures()); } } @@ -147,7 +147,7 @@ public abstract class TransportSearchTypeAction extends TransportAction 0) { - if (request.getOperationThreading() == SearchOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == SearchOperationThreading.SINGLE_THREAD) { request.beforeLocalFork(); threadPool.executor(ThreadPool.Names.SEARCH).execute(new Runnable() { @Override @@ -163,7 +163,7 @@ public abstract class TransportSearchTypeAction extends TransportAction() { @Override public void onResult(FirstResult result) { @@ -334,7 +334,7 @@ public abstract class TransportSearchTypeAction extends TransportAction entry : queryResults.entrySet()) { if (!docIdsToLoad.containsKey(entry.getKey())) { DiscoveryNode node = nodes.get(entry.getKey().nodeId()); diff --git a/src/main/java/org/elasticsearch/action/support/TransportAction.java b/src/main/java/org/elasticsearch/action/support/TransportAction.java index 4a1d5e8bb31..4cf1c587e6d 100644 --- a/src/main/java/org/elasticsearch/action/support/TransportAction.java +++ b/src/main/java/org/elasticsearch/action/support/TransportAction.java @@ -43,13 +43,13 @@ public abstract class TransportAction future = newFuture(); // since we don't have a listener, and we release a possible lock with the future // there is no need to execute it under a listener thread - request.setListenerThreaded(false); + request.listenerThreaded(false); execute(request, future); return future; } public void execute(Request request, ActionListener listener) { - if (request.isListenerThreaded()) { + if (request.listenerThreaded()) { listener = new ThreadedActionListener(threadPool, listener); } ActionRequestValidationException validationException = request.validate(); diff --git a/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java b/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java index bcee50d88f5..d4c2dc3699b 100644 --- a/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java +++ b/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastOperationRequest.java @@ -45,12 +45,12 @@ public abstract class BroadcastOperationRequest 0) { - if (request.getOperationThreading() == BroadcastOperationThreading.SINGLE_THREAD) { + if (request.operationThreading() == BroadcastOperationThreading.SINGLE_THREAD) { request.beforeLocalFork(); threadPool.executor(executor).execute(new Runnable() { @Override @@ -191,7 +191,7 @@ public abstract class TransportBroadcastOperationAction() { @Override diff --git a/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java b/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java index 05341f384b8..9b968b33c3e 100644 --- a/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java +++ b/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java @@ -39,7 +39,7 @@ public abstract class MasterNodeOperationRequest() { @Override public void onResponse(Response response) { diff --git a/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequest.java b/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequest.java index 3756adb5423..f6a08f9512f 100644 --- a/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequest.java +++ b/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequest.java @@ -47,28 +47,28 @@ public abstract class NodesOperationRequest ext this.nodesIds = nodesIds; } - public final String[] getNodesIds() { + public final String[] nodesIds() { return nodesIds; } @SuppressWarnings("unchecked") - public final T setNodesIds(String... nodesIds) { + public final T nodesIds(String... nodesIds) { this.nodesIds = nodesIds; return (T) this; } - public TimeValue getTimeout() { + public TimeValue timeout() { return this.timeout; } @SuppressWarnings("unchecked") - public final T setTimeout(TimeValue timeout) { + public final T timeout(TimeValue timeout) { this.timeout = timeout; return (T) this; } @SuppressWarnings("unchecked") - public final T setTimeout(String timeout) { + public final T timeout(String timeout) { this.timeout = TimeValue.parseTimeValue(timeout, null); return (T) this; } diff --git a/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequestBuilder.java b/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequestBuilder.java index dca3d034837..bb5ca640189 100644 --- a/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/support/nodes/NodesOperationRequestBuilder.java @@ -34,19 +34,19 @@ public abstract class NodesOperationRequestBuilder(this.nodesIds.length); } @@ -136,8 +136,8 @@ public abstract class TransportNodesOperationAction() { @Override public void onResponse(Response response) { diff --git a/src/main/java/org/elasticsearch/action/support/replication/IndexReplicationOperationRequest.java b/src/main/java/org/elasticsearch/action/support/replication/IndexReplicationOperationRequest.java index 29cbbcca8b1..d698bd7aba1 100644 --- a/src/main/java/org/elasticsearch/action/support/replication/IndexReplicationOperationRequest.java +++ b/src/main/java/org/elasticsearch/action/support/replication/IndexReplicationOperationRequest.java @@ -42,16 +42,16 @@ public class IndexReplicationOperationRequest1m. */ @SuppressWarnings("unchecked") - public final T setTimeout(TimeValue timeout) { + public final T timeout(TimeValue timeout) { this.timeout = timeout; return (T) this; } @@ -55,12 +55,12 @@ public class IndicesReplicationOperationRequest1m. */ @SuppressWarnings("unchecked") - public T setTimeout(String timeout) { + public T timeout(String timeout) { this.timeout = TimeValue.parseTimeValue(timeout, null); return (T) this; } - public String[] getIndices() { + public String[] indices() { return this.indices; } @@ -68,12 +68,12 @@ public class IndicesReplicationOperationRequesttrue when running in embedded mode. */ @SuppressWarnings("unchecked") - public final T setOperationThreaded(boolean threadedOperation) { + public final T operationThreaded(boolean threadedOperation) { this.threadedOperation = threadedOperation; return (T) this; } @@ -84,7 +84,7 @@ public abstract class ShardReplicationOperationRequest1m. */ @SuppressWarnings("unchecked") - public final T setTimeout(TimeValue timeout) { + public final T timeout(TimeValue timeout) { this.timeout = timeout; return (T) this; } @@ -92,20 +92,20 @@ public abstract class ShardReplicationOperationRequest1m. */ - public final T setTimeout(String timeout) { - return setTimeout(TimeValue.parseTimeValue(timeout, null)); + public final T timeout(String timeout) { + return timeout(TimeValue.parseTimeValue(timeout, null)); } - public TimeValue getTimeout() { + public TimeValue timeout() { return timeout; } - public String getIndex() { + public String index() { return this.index; } @SuppressWarnings("unchecked") - public final T setIndex(String index) { + public final T index(String index) { this.index = index; return (T) this; } @@ -113,7 +113,7 @@ public abstract class ShardReplicationOperationRequest() { @Override public void onResponse(ShardResponse result) { @@ -147,7 +147,7 @@ public abstract class TransportIndexReplicationOperationAction() { @Override public void onResponse(Response result) { @@ -169,4 +169,4 @@ public abstract class TransportIndexReplicationOperationAction() { @Override public void onResponse(IndexResponse result) { @@ -148,7 +148,7 @@ public abstract class TransportIndicesReplicationOperationAction() { @Override public void onResponse(Response result) { @@ -170,4 +170,4 @@ public abstract class TransportIndicesReplicationOperationAction listener) { - request.setIndex(state.metaData().concreteIndex(request.getIndex())); + request.index(state.metaData().concreteIndex(request.index())); return true; } @@ -212,9 +212,9 @@ public abstract class TransportShardReplicationOperationAction() { @Override public void onResponse(Response result) { @@ -332,8 +332,8 @@ public abstract class TransportShardReplicationOperationAction 2) { @@ -422,7 +422,7 @@ public abstract class TransportShardReplicationOperationActiontrue */ @SuppressWarnings("unchecked") - public final T setPreferLocal(boolean preferLocal) { + public final T preferLocal(boolean preferLocal) { this.preferLocal = preferLocal; return (T) this; } @@ -72,7 +72,7 @@ public abstract class SingleCustomOperationRequesttrue */ - public boolean isPreferLocal() { + public boolean preferLocalShard() { return this.preferLocal; } diff --git a/src/main/java/org/elasticsearch/action/support/single/custom/SingleCustomOperationRequestBuilder.java b/src/main/java/org/elasticsearch/action/support/single/custom/SingleCustomOperationRequestBuilder.java index c7c3d3660b9..d0a18e043dd 100644 --- a/src/main/java/org/elasticsearch/action/support/single/custom/SingleCustomOperationRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/support/single/custom/SingleCustomOperationRequestBuilder.java @@ -37,7 +37,7 @@ public abstract class SingleCustomOperationRequestBuilder() { @Override public void onResponse(Response result) { diff --git a/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequest.java b/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequest.java index 1ce17b1a004..0bbfbac0949 100644 --- a/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequest.java +++ b/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequest.java @@ -58,17 +58,17 @@ public abstract class InstanceShardOperationRequest1m. */ @SuppressWarnings("unchecked") - public final T setTimeout(TimeValue timeout) { + public final T timeout(TimeValue timeout) { this.timeout = timeout; return (T) this; } @@ -84,8 +84,8 @@ public abstract class InstanceShardOperationRequest1m. */ - public final T setTimeout(String timeout) { - return setTimeout(TimeValue.parseTimeValue(timeout, null)); + public final T timeout(String timeout) { + return timeout(TimeValue.parseTimeValue(timeout, null)); } @Override diff --git a/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequestBuilder.java b/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequestBuilder.java index fb04c4a94b8..996b98cd5af 100644 --- a/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequestBuilder.java @@ -35,7 +35,7 @@ public abstract class InstanceShardOperationRequestBuilder listener) { - request.setIndex(state.metaData().concreteIndex(request.getIndex())); + request.index(state.metaData().concreteIndex(request.index())); return true; } @@ -239,7 +239,7 @@ public abstract class TransportInstanceSingleOperationAction() { @Override public void onResponse(Response result) { diff --git a/src/main/java/org/elasticsearch/action/support/single/shard/SingleShardOperationRequest.java b/src/main/java/org/elasticsearch/action/support/single/shard/SingleShardOperationRequest.java index c77dddc05f1..84972355061 100644 --- a/src/main/java/org/elasticsearch/action/support/single/shard/SingleShardOperationRequest.java +++ b/src/main/java/org/elasticsearch/action/support/single/shard/SingleShardOperationRequest.java @@ -52,7 +52,7 @@ public abstract class SingleShardOperationRequest() { @Override public void onResponse(Response result) { diff --git a/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java b/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java index cfee1168dd6..0149ef4b7a9 100644 --- a/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java +++ b/src/main/java/org/elasticsearch/action/update/TransportUpdateAction.java @@ -135,7 +135,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio @Override protected ClusterBlockException checkRequestBlock(ClusterState state, UpdateRequest request) { - return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.getIndex()); + return state.blocks().indexBlockedException(ClusterBlockLevel.WRITE, request.index()); } @Override @@ -150,18 +150,18 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio @Override protected boolean resolveRequest(ClusterState state, UpdateRequest request, ActionListener listener) { MetaData metaData = clusterService.state().metaData(); - String aliasOrIndex = request.getIndex(); - request.setRouting((metaData.resolveIndexRouting(request.getRouting(), aliasOrIndex))); - request.setIndex(metaData.concreteIndex(request.getIndex())); + String aliasOrIndex = request.index(); + request.routing((metaData.resolveIndexRouting(request.routing(), aliasOrIndex))); + request.index(metaData.concreteIndex(request.index())); return true; } @Override protected void doExecute(final UpdateRequest request, final ActionListener listener) { // if we don't have a master, we don't have metadata, that's fine, let it find a master using create index API - if (autoCreateIndex.shouldAutoCreate(request.getIndex(), clusterService.state())) { + if (autoCreateIndex.shouldAutoCreate(request.index(), clusterService.state())) { request.beforeLocalFork(); // we fork on another thread... - createIndexAction.execute(new CreateIndexRequest(request.getIndex()).setCause("auto(update api)").setMasterNodeTimeout(request.getTimeout()), new ActionListener() { + createIndexAction.execute(new CreateIndexRequest(request.index()).cause("auto(update api)").masterNodeTimeout(request.timeout()), new ActionListener() { @Override public void onResponse(CreateIndexResponse result) { innerExecute(request, listener); @@ -192,11 +192,11 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio @Override protected ShardIterator shards(ClusterState clusterState, UpdateRequest request) throws ElasticSearchException { - if (request.getShardId() != -1) { - return clusterState.routingTable().index(request.getIndex()).shard(request.getShardId()).primaryShardIt(); + if (request.shardId() != -1) { + return clusterState.routingTable().index(request.index()).shard(request.shardId()).primaryShardIt(); } ShardIterator shardIterator = clusterService.operationRouting() - .indexShards(clusterService.state(), request.getIndex(), request.getType(), request.getId(), request.getRouting()); + .indexShards(clusterService.state(), request.index(), request.type(), request.id(), request.routing()); ShardRouting shard; while ((shard = shardIterator.nextOrNull()) != null) { if (shard.primary()) { @@ -212,36 +212,36 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio } protected void shardOperation(final UpdateRequest request, final ActionListener listener, final int retryCount) throws ElasticSearchException { - IndexService indexService = indicesService.indexServiceSafe(request.getIndex()); - IndexShard indexShard = indexService.shardSafe(request.getShardId()); + IndexService indexService = indicesService.indexServiceSafe(request.index()); + IndexShard indexShard = indexService.shardSafe(request.shardId()); long getDate = System.currentTimeMillis(); - final GetResult getResult = indexShard.getService().get(request.getType(), request.getId(), + final GetResult getResult = indexShard.getService().get(request.type(), request.id(), new String[]{SourceFieldMapper.NAME, RoutingFieldMapper.NAME, ParentFieldMapper.NAME, TTLFieldMapper.NAME}, true); // no doc, what to do, what to do... if (!getResult.isExists()) { - if (request.getUpsertRequest() == null) { - listener.onFailure(new DocumentMissingException(new ShardId(request.getIndex(), request.getShardId()), request.getType(), request.getId())); + if (request.upsertRequest() == null) { + listener.onFailure(new DocumentMissingException(new ShardId(request.index(), request.shardId()), request.type(), request.id())); return; } - final IndexRequest indexRequest = request.getUpsertRequest(); - indexRequest.setIndex(request.getIndex()).setType(request.getType()).setId(request.getId()) + final IndexRequest indexRequest = request.upsertRequest(); + indexRequest.index(request.index()).type(request.type()).id(request.id()) // it has to be a "create!" - .setCreate(true) - .setRouting(request.getRouting()) - .setPercolate(request.getPercolate()) - .setRefresh(request.isRefresh()) - .setReplicationType(request.setReplicationType()).setConsistencyLevel(request.getConsistencyLevel()); - indexRequest.setOperationThreaded(false); + .create(true) + .routing(request.routing()) + .percolate(request.percolate()) + .refresh(request.refresh()) + .replicationType(request.replicationType()).consistencyLevel(request.consistencyLevel()); + indexRequest.operationThreaded(false); // we fetch it from the index request so we don't generate the bytes twice, its already done in the index request - final BytesReference updateSourceBytes = indexRequest.getSource(); + final BytesReference updateSourceBytes = indexRequest.source(); indexAction.execute(indexRequest, new ActionListener() { @Override public void onResponse(IndexResponse response) { UpdateResponse update = new UpdateResponse(response.getIndex(), response.getType(), response.getId(), response.getVersion()); update.setMatches(response.getMatches()); - if (request.getFields() != null && request.getFields().length > 0) { + if (request.fields() != null && request.fields().length > 0) { Tuple> sourceAndContent = XContentHelper.convertToMap(updateSourceBytes, true); update.setGetResult(extractGetResult(request, response.getVersion(), sourceAndContent.v2(), sourceAndContent.v1(), updateSourceBytes)); } else { @@ -254,7 +254,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio public void onFailure(Throwable e) { e = ExceptionsHelper.unwrapCause(e); if (e instanceof VersionConflictEngineException || e instanceof DocumentAlreadyExistsException) { - if (retryCount < request.getRetryOnConflict()) { + if (retryCount < request.retryOnConflict()) { threadPool.executor(executor()).execute(new Runnable() { @Override public void run() { @@ -272,7 +272,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio if (getResult.internalSourceRef() == null) { // no source, we can't do nothing, through a failure... - listener.onFailure(new DocumentSourceMissingException(new ShardId(request.getIndex(), request.getShardId()), request.getType(), request.getId())); + listener.onFailure(new DocumentSourceMissingException(new ShardId(request.index(), request.shardId()), request.type(), request.id())); return; } @@ -286,20 +286,20 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio String routing = getResult.getFields().containsKey(RoutingFieldMapper.NAME) ? getResult.field(RoutingFieldMapper.NAME).getValue().toString() : null; String parent = getResult.getFields().containsKey(ParentFieldMapper.NAME) ? getResult.field(ParentFieldMapper.NAME).getValue().toString() : null; - if (request.getScript() == null && request.getDoc() != null) { - IndexRequest indexRequest = request.getDoc(); + if (request.script() == null && request.doc() != null) { + IndexRequest indexRequest = request.doc(); updatedSourceAsMap = sourceAndContent.v2(); - if (indexRequest.getTtl() > 0) { - ttl = indexRequest.getTtl(); + if (indexRequest.ttl() > 0) { + ttl = indexRequest.ttl(); } - timestamp = indexRequest.getTimestamp(); - if (indexRequest.getRouting() != null) { - routing = indexRequest.getRouting(); + timestamp = indexRequest.timestamp(); + if (indexRequest.routing() != null) { + routing = indexRequest.routing(); } - if (indexRequest.getParent() != null) { - parent = indexRequest.getParent(); + if (indexRequest.parent() != null) { + parent = indexRequest.parent(); } - XContentHelper.update(updatedSourceAsMap, indexRequest.getSourceAsMap()); + XContentHelper.update(updatedSourceAsMap, indexRequest.sourceAsMap()); } else { Map ctx = new HashMap(2); ctx.put("_source", sourceAndContent.v2()); @@ -340,15 +340,15 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio // TODO: external version type, does it make sense here? does not seem like it... if (operation == null || "index".equals(operation)) { - final IndexRequest indexRequest = Requests.indexRequest(request.getIndex()).setType(request.getType()).setId(request.getId()).setRouting(routing).setParent(parent) - .setSource(updatedSourceAsMap, updateSourceContentType) - .setVersion(getResult.getVersion()).setReplicationType(request.setReplicationType()).setConsistencyLevel(request.getConsistencyLevel()) - .setTimestamp(timestamp).setTtl(ttl) - .setPercolate(request.getPercolate()) - .setRefresh(request.isRefresh()); - indexRequest.setOperationThreaded(false); + final IndexRequest indexRequest = Requests.indexRequest(request.index()).type(request.type()).id(request.id()).routing(routing).parent(parent) + .source(updatedSourceAsMap, updateSourceContentType) + .version(getResult.getVersion()).replicationType(request.replicationType()).consistencyLevel(request.consistencyLevel()) + .timestamp(timestamp).ttl(ttl) + .percolate(request.percolate()) + .refresh(request.refresh()); + indexRequest.operationThreaded(false); // we fetch it from the index request so we don't generate the bytes twice, its already done in the index request - final BytesReference updateSourceBytes = indexRequest.getSource(); + final BytesReference updateSourceBytes = indexRequest.source(); indexAction.execute(indexRequest, new ActionListener() { @Override public void onResponse(IndexResponse response) { @@ -362,7 +362,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio public void onFailure(Throwable e) { e = ExceptionsHelper.unwrapCause(e); if (e instanceof VersionConflictEngineException) { - if (retryCount < request.getRetryOnConflict()) { + if (retryCount < request.retryOnConflict()) { threadPool.executor(executor()).execute(new Runnable() { @Override public void run() { @@ -376,9 +376,9 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio } }); } else if ("delete".equals(operation)) { - DeleteRequest deleteRequest = Requests.deleteRequest(request.getIndex()).setType(request.getType()).setId(request.getId()).setRouting(routing).setParent(parent) - .setVersion(getResult.getVersion()).setReplicationType(request.setReplicationType()).setConsistencyLevel(request.getConsistencyLevel()); - deleteRequest.setOperationThreaded(false); + DeleteRequest deleteRequest = Requests.deleteRequest(request.index()).type(request.type()).id(request.id()).routing(routing).parent(parent) + .version(getResult.getVersion()).replicationType(request.replicationType()).consistencyLevel(request.consistencyLevel()); + deleteRequest.operationThreaded(false); deleteAction.execute(deleteRequest, new ActionListener() { @Override public void onResponse(DeleteResponse response) { @@ -391,7 +391,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio public void onFailure(Throwable e) { e = ExceptionsHelper.unwrapCause(e); if (e instanceof VersionConflictEngineException) { - if (retryCount < request.getRetryOnConflict()) { + if (retryCount < request.retryOnConflict()) { threadPool.executor(executor()).execute(new Runnable() { @Override public void run() { @@ -416,15 +416,15 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio @Nullable protected GetResult extractGetResult(final UpdateRequest request, long version, final Map source, XContentType sourceContentType, @Nullable final BytesReference sourceAsBytes) { - if (request.getFields() == null || request.getFields().length == 0) { + if (request.fields() == null || request.fields().length == 0) { return null; } boolean sourceRequested = false; Map fields = null; - if (request.getFields() != null && request.getFields().length > 0) { + if (request.fields() != null && request.fields().length > 0) { SourceLookup sourceLookup = new SourceLookup(); sourceLookup.setNextSource(source); - for (String field : request.getFields()) { + for (String field : request.fields()) { if (field.equals("_source")) { sourceRequested = true; continue; @@ -446,6 +446,6 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio // TODO when using delete/none, we can still return the source as bytes by generating it (using the sourceContentType) - return new GetResult(request.getIndex(), request.getType(), request.getId(), version, true, sourceRequested ? sourceAsBytes : null, fields); + return new GetResult(request.index(), request.type(), request.id(), version, true, sourceRequested ? sourceAsBytes : null, fields); } } diff --git a/src/main/java/org/elasticsearch/action/update/UpdateRequest.java b/src/main/java/org/elasticsearch/action/update/UpdateRequest.java index 37b80d8aba0..a98455f5b56 100644 --- a/src/main/java/org/elasticsearch/action/update/UpdateRequest.java +++ b/src/main/java/org/elasticsearch/action/update/UpdateRequest.java @@ -100,14 +100,14 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * The type of the indexed document. */ - public String getType() { + public String type() { return type; } /** * Sets the type of the indexed document. */ - public UpdateRequest setType(String type) { + public UpdateRequest type(String type) { this.type = type; return this; } @@ -115,14 +115,14 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * The id of the indexed document. */ - public String getId() { + public String id() { return id; } /** * Sets the id of the indexed document. */ - public UpdateRequest setId(String id) { + public UpdateRequest id(String id) { this.id = id; return this; } @@ -131,7 +131,7 @@ public class UpdateRequest extends InstanceShardOperationRequest * Controls the shard routing of the request. Using this value to hash the shard * and not the id. */ - public UpdateRequest setRouting(String routing) { + public UpdateRequest routing(String routing) { if (routing != null && routing.length() == 0) { this.routing = null; } else { @@ -144,7 +144,7 @@ public class UpdateRequest extends InstanceShardOperationRequest * Sets the parent id of this document. Will simply set the routing to this value, as it is only * used for routing with delete requests. */ - public UpdateRequest setParent(String parent) { + public UpdateRequest parent(String parent) { if (routing == null) { routing = parent; } @@ -155,19 +155,19 @@ public class UpdateRequest extends InstanceShardOperationRequest * Controls the shard routing of the request. Using this value to hash the shard * and not the id. */ - public String getRouting() { + public String routing() { return this.routing; } - public int getShardId() { + int shardId() { return this.shardId; } - public String getScript() { + public String script() { return this.script; } - public Map getScriptParams() { + public Map scriptParams() { return this.scriptParams; } @@ -175,7 +175,7 @@ public class UpdateRequest extends InstanceShardOperationRequest * The script to execute. Note, make sure not to send different script each times and instead * use script params if possible with the same (automatically compiled) script. */ - public UpdateRequest setScript(String script) { + public UpdateRequest script(String script) { this.script = script; return this; } @@ -183,7 +183,7 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * The language of the script to execute. */ - public UpdateRequest setScriptLang(String scriptLang) { + public UpdateRequest scriptLang(String scriptLang) { this.scriptLang = scriptLang; return this; } @@ -202,7 +202,7 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * Sets the script parameters to use with the script. */ - public UpdateRequest setScriptParams(Map scriptParams) { + public UpdateRequest scriptParams(Map scriptParams) { if (this.scriptParams == null) { this.scriptParams = scriptParams; } else { @@ -215,7 +215,7 @@ public class UpdateRequest extends InstanceShardOperationRequest * The script to execute. Note, make sure not to send different script each times and instead * use script params if possible with the same (automatically compiled) script. */ - public UpdateRequest setScript(String script, @Nullable Map scriptParams) { + public UpdateRequest script(String script, @Nullable Map scriptParams) { this.script = script; if (this.scriptParams != null) { this.scriptParams.putAll(scriptParams); @@ -233,7 +233,7 @@ public class UpdateRequest extends InstanceShardOperationRequest * @param scriptLang The script language * @param scriptParams The script parameters */ - public UpdateRequest setScript(String script, @Nullable String scriptLang, @Nullable Map scriptParams) { + public UpdateRequest script(String script, @Nullable String scriptLang, @Nullable Map scriptParams) { this.script = script; this.scriptLang = scriptLang; if (this.scriptParams != null) { @@ -247,7 +247,7 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * Explicitly specify the fields that will be returned. By default, nothing is returned. */ - public UpdateRequest setFields(String... fields) { + public UpdateRequest fields(String... fields) { this.fields = fields; return this; } @@ -255,7 +255,7 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * Get the fields to be returned. */ - public String[] getFields() { + public String[] fields() { return this.fields; } @@ -263,12 +263,12 @@ public class UpdateRequest extends InstanceShardOperationRequest * Sets the number of retries of a version conflict occurs because the document was updated between * getting it and updating it. Defaults to 1. */ - public UpdateRequest setRetryOnConflict(int retryOnConflict) { + public UpdateRequest retryOnConflict(int retryOnConflict) { this.retryOnConflict = retryOnConflict; return this; } - public int getRetryOnConflict() { + public int retryOnConflict() { return this.retryOnConflict; } @@ -277,12 +277,12 @@ public class UpdateRequest extends InstanceShardOperationRequest * to use to reduce the percolated queries that are going to run against this doc. Can be * set to * to indicate that all percolate queries should be run. */ - public UpdateRequest setPercolate(String percolate) { + public UpdateRequest percolate(String percolate) { this.percolate = percolate; return this; } - public String getPercolate() { + public String percolate() { return this.percolate; } @@ -291,38 +291,38 @@ public class UpdateRequest extends InstanceShardOperationRequest * be searchable. Note, heavy indexing should not set this to true. Defaults * to false. */ - public UpdateRequest setRefresh(boolean refresh) { + public UpdateRequest refresh(boolean refresh) { this.refresh = refresh; return this; } - public boolean isRefresh() { + public boolean refresh() { return this.refresh; } /** * The replication type. */ - public ReplicationType setReplicationType() { + public ReplicationType replicationType() { return this.replicationType; } /** * Sets the replication type. */ - public UpdateRequest setReplicationType(ReplicationType replicationType) { + public UpdateRequest replicationType(ReplicationType replicationType) { this.replicationType = replicationType; return this; } - public WriteConsistencyLevel getConsistencyLevel() { + public WriteConsistencyLevel consistencyLevel() { return this.consistencyLevel; } /** * Sets the consistency level of write. Defaults to {@link org.elasticsearch.action.WriteConsistencyLevel#DEFAULT} */ - public UpdateRequest setConsistencyLevel(WriteConsistencyLevel consistencyLevel) { + public UpdateRequest consistencyLevel(WriteConsistencyLevel consistencyLevel) { this.consistencyLevel = consistencyLevel; return this; } @@ -330,7 +330,7 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * Sets the doc to use for updates when a script is not specified. */ - public UpdateRequest setDoc(IndexRequest doc) { + public UpdateRequest doc(IndexRequest doc) { this.doc = doc; return this; } @@ -338,56 +338,56 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * Sets the doc to use for updates when a script is not specified. */ - public UpdateRequest setDoc(XContentBuilder source) { - getSafeDoc().setSource(source); + public UpdateRequest doc(XContentBuilder source) { + safeDoc().source(source); return this; } /** * Sets the doc to use for updates when a script is not specified. */ - public UpdateRequest setDoc(Map source) { - getSafeDoc().setSource(source); + public UpdateRequest doc(Map source) { + safeDoc().source(source); return this; } /** * Sets the doc to use for updates when a script is not specified. */ - public UpdateRequest setDoc(Map source, XContentType contentType) { - getSafeDoc().setSource(source, contentType); + public UpdateRequest doc(Map source, XContentType contentType) { + safeDoc().source(source, contentType); return this; } /** * Sets the doc to use for updates when a script is not specified. */ - public UpdateRequest setDoc(String source) { - getSafeDoc().setSource(source); + public UpdateRequest doc(String source) { + safeDoc().source(source); return this; } /** * Sets the doc to use for updates when a script is not specified. */ - public UpdateRequest setDoc(byte[] source) { - getSafeDoc().setSource(source); + public UpdateRequest doc(byte[] source) { + safeDoc().source(source); return this; } /** * Sets the doc to use for updates when a script is not specified. */ - public UpdateRequest setDoc(byte[] source, int offset, int length) { - getSafeDoc().setSource(source, offset, length); + public UpdateRequest doc(byte[] source, int offset, int length) { + safeDoc().source(source, offset, length); return this; } - public IndexRequest getDoc() { + public IndexRequest doc() { return this.doc; } - private IndexRequest getSafeDoc() { + private IndexRequest safeDoc() { if (doc == null) { doc = new IndexRequest(); } @@ -398,7 +398,7 @@ public class UpdateRequest extends InstanceShardOperationRequest * Sets the index request to be used if the document does not exists. Otherwise, a {@link org.elasticsearch.index.engine.DocumentMissingException} * is thrown. */ - public UpdateRequest setUpsertRequest(IndexRequest upsertRequest) { + public UpdateRequest upsert(IndexRequest upsertRequest) { this.upsertRequest = upsertRequest; return this; } @@ -406,75 +406,75 @@ public class UpdateRequest extends InstanceShardOperationRequest /** * Sets the doc source of the update request to be used when the document does not exists. */ - public UpdateRequest setUpsertRequest(XContentBuilder source) { - getSafeUpsertRequest().setSource(source); + public UpdateRequest upsert(XContentBuilder source) { + safeUpsertRequest().source(source); return this; } /** * Sets the doc source of the update request to be used when the document does not exists. */ - public UpdateRequest setUpsertRequest(Map source) { - getSafeUpsertRequest().setSource(source); + public UpdateRequest upsert(Map source) { + safeUpsertRequest().source(source); return this; } /** * Sets the doc source of the update request to be used when the document does not exists. */ - public UpdateRequest setUpsertRequest(Map source, XContentType contentType) { - getSafeUpsertRequest().setSource(source, contentType); + public UpdateRequest upsert(Map source, XContentType contentType) { + safeUpsertRequest().source(source, contentType); return this; } /** * Sets the doc source of the update request to be used when the document does not exists. */ - public UpdateRequest setUpsertRequest(String source) { - getSafeUpsertRequest().setSource(source); + public UpdateRequest upsert(String source) { + safeUpsertRequest().source(source); return this; } /** * Sets the doc source of the update request to be used when the document does not exists. */ - public UpdateRequest setUpsertRequest(byte[] source) { - getSafeUpsertRequest().setSource(source); + public UpdateRequest upsert(byte[] source) { + safeUpsertRequest().source(source); return this; } /** * Sets the doc source of the update request to be used when the document does not exists. */ - public UpdateRequest setUpsertRequest(byte[] source, int offset, int length) { - getSafeUpsertRequest().setSource(source, offset, length); + public UpdateRequest upsert(byte[] source, int offset, int length) { + safeUpsertRequest().source(source, offset, length); return this; } - public IndexRequest getUpsertRequest() { + public IndexRequest upsertRequest() { return this.upsertRequest; } - private IndexRequest getSafeUpsertRequest() { + private IndexRequest safeUpsertRequest() { if (upsertRequest == null) { upsertRequest = new IndexRequest(); } return upsertRequest; } - public UpdateRequest setSource(XContentBuilder source) throws Exception { - return setSource(source.bytes()); + public UpdateRequest source(XContentBuilder source) throws Exception { + return source(source.bytes()); } - public UpdateRequest setSource(byte[] source) throws Exception { - return setSource(source, 0, source.length); + public UpdateRequest source(byte[] source) throws Exception { + return source(source, 0, source.length); } - public UpdateRequest setSource(byte[] source, int offset, int length) throws Exception { - return setSource(new BytesArray(source, offset, length)); + public UpdateRequest source(byte[] source, int offset, int length) throws Exception { + return source(new BytesArray(source, offset, length)); } - public UpdateRequest setSource(BytesReference source) throws Exception { + public UpdateRequest source(BytesReference source) throws Exception { XContentType xContentType = XContentFactory.xContentType(source); XContentParser parser = XContentFactory.xContent(xContentType).createParser(source); try { @@ -495,11 +495,11 @@ public class UpdateRequest extends InstanceShardOperationRequest } else if ("upsert".equals(currentFieldName)) { XContentBuilder builder = XContentFactory.contentBuilder(xContentType); builder.copyCurrentStructure(parser); - getSafeUpsertRequest().setSource(builder); + safeUpsertRequest().source(builder); } else if ("doc".equals(currentFieldName)) { XContentBuilder docBuilder = XContentFactory.contentBuilder(xContentType); docBuilder.copyCurrentStructure(parser); - getSafeDoc().setSource(docBuilder); + safeDoc().source(docBuilder); } } } finally { @@ -558,9 +558,9 @@ public class UpdateRequest extends InstanceShardOperationRequest } else { out.writeBoolean(true); // make sure the basics are set - doc.setIndex(index); - doc.setType(type); - doc.setId(id); + doc.index(index); + doc.type(type); + doc.id(id); doc.writeTo(out); } if (fields == null) { @@ -576,9 +576,9 @@ public class UpdateRequest extends InstanceShardOperationRequest } else { out.writeBoolean(true); // make sure the basics are set - upsertRequest.setIndex(index); - upsertRequest.setType(type); - upsertRequest.setId(id); + upsertRequest.index(index); + upsertRequest.type(type); + upsertRequest.id(id); upsertRequest.writeTo(out); } } diff --git a/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java b/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java index 3e8911a49f7..1b19105408b 100644 --- a/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java @@ -48,7 +48,7 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder scriptParams) { - request.setScriptParams(scriptParams); + request.scriptParams(scriptParams); return this; } @@ -111,7 +111,7 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilderfalse. */ public UpdateRequestBuilder setRefresh(boolean refresh) { - request.setRefresh(refresh); + request.refresh(refresh); return this; } @@ -138,7 +138,7 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder* to indicate that all percolate queries should be run. */ public UpdateRequestBuilder setPercolate(String percolate) { - request.setPercolate(percolate); + request.percolate(percolate); return this; } @@ -164,7 +164,7 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder() { diff --git a/src/main/java/org/elasticsearch/gateway/local/state/meta/TransportNodesListGatewayMetaState.java b/src/main/java/org/elasticsearch/gateway/local/state/meta/TransportNodesListGatewayMetaState.java index b6aa85fab9e..8a8d5f8ca2a 100644 --- a/src/main/java/org/elasticsearch/gateway/local/state/meta/TransportNodesListGatewayMetaState.java +++ b/src/main/java/org/elasticsearch/gateway/local/state/meta/TransportNodesListGatewayMetaState.java @@ -60,7 +60,7 @@ public class TransportNodesListGatewayMetaState extends TransportNodesOperationA } public ActionFuture list(Set nodesIds, @Nullable TimeValue timeout) { - return execute(new Request(nodesIds).setTimeout(timeout)); + return execute(new Request(nodesIds).timeout(timeout)); } @Override diff --git a/src/main/java/org/elasticsearch/gateway/local/state/shards/TransportNodesListGatewayStartedShards.java b/src/main/java/org/elasticsearch/gateway/local/state/shards/TransportNodesListGatewayStartedShards.java index 915bfe24bd1..c2b38900bb3 100644 --- a/src/main/java/org/elasticsearch/gateway/local/state/shards/TransportNodesListGatewayStartedShards.java +++ b/src/main/java/org/elasticsearch/gateway/local/state/shards/TransportNodesListGatewayStartedShards.java @@ -60,7 +60,7 @@ public class TransportNodesListGatewayStartedShards extends TransportNodesOperat } public ActionFuture list(ShardId shardId, Set nodesIds, @Nullable TimeValue timeout) { - return execute(new Request(shardId, nodesIds).setTimeout(timeout)); + return execute(new Request(shardId, nodesIds).timeout(timeout)); } @Override diff --git a/src/main/java/org/elasticsearch/index/search/shape/ShapeFetchService.java b/src/main/java/org/elasticsearch/index/search/shape/ShapeFetchService.java index 8138a52ed93..f617438f09b 100644 --- a/src/main/java/org/elasticsearch/index/search/shape/ShapeFetchService.java +++ b/src/main/java/org/elasticsearch/index/search/shape/ShapeFetchService.java @@ -58,7 +58,7 @@ public class ShapeFetchService extends AbstractComponent { * @throws IOException Can be thrown while parsing the Shape Document and extracting the Shape */ public Shape fetch(String id, String type, String index, String shapeField) throws IOException { - GetResponse response = client.get(new GetRequest(index, type, id).setPreference("_local").setOperationThreaded(false)).actionGet(); + GetResponse response = client.get(new GetRequest(index, type, id).preference("_local").operationThreaded(false)).actionGet(); if (!response.isExists()) { throw new ElasticSearchIllegalArgumentException("Shape with ID [" + id + "] in type [" + type + "] not found"); } diff --git a/src/main/java/org/elasticsearch/indices/cache/filter/terms/IndicesTermsFilterCache.java b/src/main/java/org/elasticsearch/indices/cache/filter/terms/IndicesTermsFilterCache.java index 095c18a2bd3..a3e97af648e 100644 --- a/src/main/java/org/elasticsearch/indices/cache/filter/terms/IndicesTermsFilterCache.java +++ b/src/main/java/org/elasticsearch/indices/cache/filter/terms/IndicesTermsFilterCache.java @@ -94,7 +94,7 @@ public class IndicesTermsFilterCache extends AbstractComponent { return cache.get(cacheKey, new Callable() { @Override public TermsFilterValue call() throws Exception { - GetResponse getResponse = client.get(new GetRequest(lookup.getIndex(), lookup.getType(), lookup.getId()).setPreference("_local")).actionGet(); + GetResponse getResponse = client.get(new GetRequest(lookup.getIndex(), lookup.getType(), lookup.getId()).preference("_local")).actionGet(); if (!getResponse.isExists()) { return NO_TERMS; } diff --git a/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java b/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java index 7b468db5167..7c7f57843f2 100644 --- a/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java +++ b/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java @@ -73,7 +73,7 @@ public class TransportNodesListShardStoreMetaData extends TransportNodesOperatio } public ActionFuture list(ShardId shardId, boolean onlyUnallocated, Set nodesIds, @Nullable TimeValue timeout) { - return execute(new Request(shardId, onlyUnallocated, nodesIds).setTimeout(timeout)); + return execute(new Request(shardId, onlyUnallocated, nodesIds).timeout(timeout)); } @Override diff --git a/src/main/java/org/elasticsearch/indices/ttl/IndicesTTLService.java b/src/main/java/org/elasticsearch/indices/ttl/IndicesTTLService.java index 97b3107da35..f0966af654a 100644 --- a/src/main/java/org/elasticsearch/indices/ttl/IndicesTTLService.java +++ b/src/main/java/org/elasticsearch/indices/ttl/IndicesTTLService.java @@ -194,7 +194,7 @@ public class IndicesTTLService extends AbstractLifecycleComponent docsToPurge = expiredDocsCollector.getDocsToPurge(); BulkRequestBuilder bulkRequest = client.prepareBulk(); for (DocToPurge docToPurge : docsToPurge) { - bulkRequest.add(new DeleteRequest().setIndex(shardToPurge.routingEntry().index()).setType(docToPurge.type).setId(docToPurge.id).setVersion(docToPurge.version).setRouting(docToPurge.routing)); + bulkRequest.add(new DeleteRequest().index(shardToPurge.routingEntry().index()).type(docToPurge.type).id(docToPurge.id).version(docToPurge.version).routing(docToPurge.routing)); bulkRequest = processBulkIfNeeded(bulkRequest, false); } processBulkIfNeeded(bulkRequest, true); @@ -289,4 +289,4 @@ public class IndicesTTLService extends AbstractLifecycleComponent() { @Override public void onResponse(NodesHotThreadsResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java index fcac69e4593..335e9a90ecf 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java @@ -89,20 +89,20 @@ public class RestNodesInfoAction extends BaseRestHandler { if (all) { nodesInfoRequest.all(); } - nodesInfoRequest.setSettings(request.paramAsBoolean("settings", nodesInfoRequest.isSettings())); - nodesInfoRequest.setOs(request.paramAsBoolean("os", nodesInfoRequest.isOs())); - nodesInfoRequest.setProcess(request.paramAsBoolean("process", nodesInfoRequest.isProcess())); - nodesInfoRequest.setJvm(request.paramAsBoolean("jvm", nodesInfoRequest.isJvm())); - nodesInfoRequest.setThreadPool(request.paramAsBoolean("thread_pool", nodesInfoRequest.isThreadPool())); - nodesInfoRequest.setNetwork(request.paramAsBoolean("network", nodesInfoRequest.isNetwork())); - nodesInfoRequest.setTransport(request.paramAsBoolean("transport", nodesInfoRequest.isTransport())); - nodesInfoRequest.setHttp(request.paramAsBoolean("http", nodesInfoRequest.isHttp())); + nodesInfoRequest.settings(request.paramAsBoolean("settings", nodesInfoRequest.settings())); + nodesInfoRequest.os(request.paramAsBoolean("os", nodesInfoRequest.os())); + nodesInfoRequest.process(request.paramAsBoolean("process", nodesInfoRequest.process())); + nodesInfoRequest.jvm(request.paramAsBoolean("jvm", nodesInfoRequest.jvm())); + nodesInfoRequest.threadPool(request.paramAsBoolean("thread_pool", nodesInfoRequest.threadPool())); + nodesInfoRequest.network(request.paramAsBoolean("network", nodesInfoRequest.network())); + nodesInfoRequest.transport(request.paramAsBoolean("transport", nodesInfoRequest.transport())); + nodesInfoRequest.http(request.paramAsBoolean("http", nodesInfoRequest.http())); executeNodeRequest(request, channel, nodesInfoRequest); } void executeNodeRequest(final RestRequest request, final RestChannel channel, NodesInfoRequest nodesInfoRequest) { - nodesInfoRequest.setListenerThreaded(false); + nodesInfoRequest.listenerThreaded(false); client.admin().cluster().nodesInfo(nodesInfoRequest, new ActionListener() { @Override public void onResponse(NodesInfoResponse response) { @@ -134,7 +134,7 @@ public class RestNodesInfoAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesInfoRequest.clear().setSettings(true); + nodesInfoRequest.clear().settings(true); executeNodeRequest(request, channel, nodesInfoRequest); } } @@ -143,7 +143,7 @@ public class RestNodesInfoAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesInfoRequest.clear().setOs(true); + nodesInfoRequest.clear().os(true); executeNodeRequest(request, channel, nodesInfoRequest); } } @@ -152,7 +152,7 @@ public class RestNodesInfoAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesInfoRequest.clear().setProcess(true); + nodesInfoRequest.clear().process(true); executeNodeRequest(request, channel, nodesInfoRequest); } } @@ -161,7 +161,7 @@ public class RestNodesInfoAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesInfoRequest.clear().setJvm(true); + nodesInfoRequest.clear().jvm(true); executeNodeRequest(request, channel, nodesInfoRequest); } } @@ -170,7 +170,7 @@ public class RestNodesInfoAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesInfoRequest.clear().setThreadPool(true); + nodesInfoRequest.clear().threadPool(true); executeNodeRequest(request, channel, nodesInfoRequest); } } @@ -179,7 +179,7 @@ public class RestNodesInfoAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesInfoRequest.clear().setNetwork(true); + nodesInfoRequest.clear().network(true); executeNodeRequest(request, channel, nodesInfoRequest); } } @@ -188,7 +188,7 @@ public class RestNodesInfoAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesInfoRequest.clear().setTransport(true); + nodesInfoRequest.clear().transport(true); executeNodeRequest(request, channel, nodesInfoRequest); } } @@ -197,7 +197,7 @@ public class RestNodesInfoAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesInfoRequest nodesInfoRequest = new NodesInfoRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesInfoRequest.clear().setHttp(true); + nodesInfoRequest.clear().http(true); executeNodeRequest(request, channel, nodesInfoRequest); } } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java index 2589be4cea9..6d8877dd628 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java @@ -50,8 +50,8 @@ public class RestNodesRestartAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { String[] nodesIds = RestActions.splitNodes(request.param("nodeId")); NodesRestartRequest nodesRestartRequest = new NodesRestartRequest(nodesIds); - nodesRestartRequest.setListenerThreaded(false); - nodesRestartRequest.setDelay(request.paramAsTime("delay", nodesRestartRequest.getDelay())); + nodesRestartRequest.listenerThreaded(false); + nodesRestartRequest.delay(request.paramAsTime("delay", nodesRestartRequest.delay())); client.admin().cluster().nodesRestart(nodesRestartRequest, new ActionListener() { @Override public void onResponse(NodesRestartResponse result) { @@ -85,4 +85,4 @@ public class RestNodesRestartAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java index 4c794c33c18..d1465224834 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java @@ -52,9 +52,9 @@ public class RestNodesShutdownAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { String[] nodesIds = RestActions.splitNodes(request.param("nodeId")); NodesShutdownRequest nodesShutdownRequest = new NodesShutdownRequest(nodesIds); - nodesShutdownRequest.setListenerThreaded(false); - nodesShutdownRequest.setDelay(request.paramAsTime("delay", nodesShutdownRequest.getDelay())); - nodesShutdownRequest.setExit(request.paramAsBoolean("exit", nodesShutdownRequest.isExit())); + nodesShutdownRequest.listenerThreaded(false); + nodesShutdownRequest.delay(request.paramAsTime("delay", nodesShutdownRequest.delay())); + nodesShutdownRequest.exit(request.paramAsBoolean("exit", nodesShutdownRequest.exit())); client.admin().cluster().nodesShutdown(nodesShutdownRequest, new ActionListener() { @Override public void onResponse(NodesShutdownResponse response) { @@ -88,4 +88,4 @@ public class RestNodesShutdownAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java index 66949e5b68e..6838fa5f195 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java @@ -113,20 +113,20 @@ public class RestNodesStatsAction extends BaseRestHandler { if (all) { nodesStatsRequest.all(); } - nodesStatsRequest.setIndices(request.paramAsBoolean("indices", nodesStatsRequest.isIndices())); - nodesStatsRequest.setOs(request.paramAsBoolean("os", nodesStatsRequest.isOs())); - nodesStatsRequest.setProcess(request.paramAsBoolean("process", nodesStatsRequest.isProcess())); - nodesStatsRequest.setJvm(request.paramAsBoolean("jvm", nodesStatsRequest.isJvm())); - nodesStatsRequest.setThreadPool(request.paramAsBoolean("thread_pool", nodesStatsRequest.isThreadPool())); - nodesStatsRequest.setNetwork(request.paramAsBoolean("network", nodesStatsRequest.isNetwork())); - nodesStatsRequest.setFs(request.paramAsBoolean("fs", nodesStatsRequest.isFs())); - nodesStatsRequest.setTransport(request.paramAsBoolean("transport", nodesStatsRequest.isTransport())); - nodesStatsRequest.setHttp(request.paramAsBoolean("http", nodesStatsRequest.isHttp())); + nodesStatsRequest.indices(request.paramAsBoolean("indices", nodesStatsRequest.indices())); + nodesStatsRequest.os(request.paramAsBoolean("os", nodesStatsRequest.os())); + nodesStatsRequest.process(request.paramAsBoolean("process", nodesStatsRequest.process())); + nodesStatsRequest.jvm(request.paramAsBoolean("jvm", nodesStatsRequest.jvm())); + nodesStatsRequest.threadPool(request.paramAsBoolean("thread_pool", nodesStatsRequest.threadPool())); + nodesStatsRequest.network(request.paramAsBoolean("network", nodesStatsRequest.network())); + nodesStatsRequest.fs(request.paramAsBoolean("fs", nodesStatsRequest.fs())); + nodesStatsRequest.transport(request.paramAsBoolean("transport", nodesStatsRequest.transport())); + nodesStatsRequest.http(request.paramAsBoolean("http", nodesStatsRequest.http())); executeNodeStats(request, channel, nodesStatsRequest); } void executeNodeStats(final RestRequest request, final RestChannel channel, final NodesStatsRequest nodesStatsRequest) { - nodesStatsRequest.setListenerThreaded(false); + nodesStatsRequest.listenerThreaded(false); client.admin().cluster().nodesStats(nodesStatsRequest, new ActionListener() { @Override public void onResponse(NodesStatsResponse response) { @@ -156,7 +156,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setIndices(true); + nodesStatsRequest.clear().indices(true); executeNodeStats(request, channel, nodesStatsRequest); } } @@ -165,7 +165,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setOs(true); + nodesStatsRequest.clear().os(true); executeNodeStats(request, channel, nodesStatsRequest); } } @@ -174,7 +174,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setProcess(true); + nodesStatsRequest.clear().process(true); executeNodeStats(request, channel, nodesStatsRequest); } } @@ -183,7 +183,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setJvm(true); + nodesStatsRequest.clear().jvm(true); executeNodeStats(request, channel, nodesStatsRequest); } } @@ -192,7 +192,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setThreadPool(true); + nodesStatsRequest.clear().threadPool(true); executeNodeStats(request, channel, nodesStatsRequest); } } @@ -201,7 +201,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setNetwork(true); + nodesStatsRequest.clear().network(true); executeNodeStats(request, channel, nodesStatsRequest); } } @@ -210,7 +210,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setFs(true); + nodesStatsRequest.clear().fs(true); executeNodeStats(request, channel, nodesStatsRequest); } } @@ -219,7 +219,7 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setTransport(true); + nodesStatsRequest.clear().transport(true); executeNodeStats(request, channel, nodesStatsRequest); } } @@ -228,8 +228,8 @@ public class RestNodesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { NodesStatsRequest nodesStatsRequest = new NodesStatsRequest(RestActions.splitNodes(request.param("nodeId"))); - nodesStatsRequest.clear().setHttp(true); + nodesStatsRequest.clear().http(true); executeNodeStats(request, channel, nodesStatsRequest); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java index 069a138d296..33d913e5c52 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java @@ -50,11 +50,11 @@ public class RestClusterRerouteAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final ClusterRerouteRequest clusterRerouteRequest = Requests.clusterRerouteRequest(); - clusterRerouteRequest.setListenerThreaded(false); + clusterRerouteRequest.listenerThreaded(false); clusterRerouteRequest.dryRun(request.paramAsBoolean("dry_run", clusterRerouteRequest.dryRun())); if (request.hasContent()) { try { - clusterRerouteRequest.setSource(request.content()); + clusterRerouteRequest.source(request.content()); } catch (Exception e) { try { channel.sendResponse(new XContentThrowableRestResponse(request, e)); @@ -100,4 +100,4 @@ public class RestClusterRerouteAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java index f0d6f2646b7..48a30c04422 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java @@ -46,9 +46,9 @@ public class RestClusterGetSettingsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() - .setListenerThreaded(false) - .setFilterRoutingTable(true) - .setFilterNodes(true); + .listenerThreaded(false) + .filterRoutingTable(true) + .filterNodes(true); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override public void onResponse(ClusterStateResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java index de52256003d..a2e5552fd34 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java @@ -45,14 +45,14 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest(); - clusterUpdateSettingsRequest.setListenerThreaded(false); + clusterUpdateSettingsRequest.listenerThreaded(false); try { Map source = XContentFactory.xContent(request.content()).createParser(request.content()).mapAndClose(); if (source.containsKey("transient")) { - clusterUpdateSettingsRequest.setTransientSettings((Map) source.get("transient")); + clusterUpdateSettingsRequest.transientSettings((Map) source.get("transient")); } if (source.containsKey("persistent")) { - clusterUpdateSettingsRequest.setPersistentSettings((Map) source.get("persistent")); + clusterUpdateSettingsRequest.persistentSettings((Map) source.get("persistent")); } } catch (Exception e) { try { @@ -86,4 +86,4 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java index 6558e48ec5c..7a13f07d7eb 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java @@ -55,15 +55,15 @@ public class RestClusterStateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest(); - clusterStateRequest.setListenerThreaded(false); - clusterStateRequest.setMasterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.getMasterNodeTimeout())); - clusterStateRequest.setFilterNodes(request.paramAsBoolean("filter_nodes", clusterStateRequest.isFilterNodes())); - clusterStateRequest.setFilterRoutingTable(request.paramAsBoolean("filter_routing_table", clusterStateRequest.isFilterRoutingTable())); - clusterStateRequest.setFilterMetaData(request.paramAsBoolean("filter_metadata", clusterStateRequest.isFilterMetaData())); - clusterStateRequest.setFilterBlocks(request.paramAsBoolean("filter_blocks", clusterStateRequest.isFilterBlocks())); - clusterStateRequest.setFilteredIndices(RestActions.splitIndices(request.param("filter_indices", null))); - clusterStateRequest.setFilteredIndexTemplates(request.paramAsStringArray("filter_index_templates", Strings.EMPTY_ARRAY)); - clusterStateRequest.setLocal(request.paramAsBoolean("local", clusterStateRequest.isLocal())); + clusterStateRequest.listenerThreaded(false); + clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout())); + clusterStateRequest.filterNodes(request.paramAsBoolean("filter_nodes", clusterStateRequest.filterNodes())); + clusterStateRequest.filterRoutingTable(request.paramAsBoolean("filter_routing_table", clusterStateRequest.filterRoutingTable())); + clusterStateRequest.filterMetaData(request.paramAsBoolean("filter_metadata", clusterStateRequest.filterMetaData())); + clusterStateRequest.filterBlocks(request.paramAsBoolean("filter_blocks", clusterStateRequest.filterBlocks())); + clusterStateRequest.filteredIndices(RestActions.splitIndices(request.param("filter_indices", null))); + clusterStateRequest.filteredIndexTemplates(request.paramAsStringArray("filter_index_templates", Strings.EMPTY_ARRAY)); + clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override public void onResponse(ClusterStateResponse response) { @@ -96,4 +96,4 @@ public class RestClusterStateAction extends BaseRestHandler { static final class Fields { static final XContentBuilderString CLUSTER_NAME = new XContentBuilderString("cluster_name"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java index 9c44f24968a..19e4aa17e6c 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestGetIndicesAliasesAction.java @@ -57,11 +57,11 @@ public class RestGetIndicesAliasesAction extends BaseRestHandler { final String[] indices = splitIndices(request.param("index")); ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() - .setFilterRoutingTable(true) - .setFilterNodes(true) - .setFilteredIndices(indices); + .filterRoutingTable(true) + .filterNodes(true) + .filteredIndices(indices); - clusterStateRequest.setListenerThreaded(false); + clusterStateRequest.listenerThreaded(false); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java index 3e94028cf1f..cdba81b0571 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java @@ -55,7 +55,7 @@ public class RestIndicesAliasesAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest(); - indicesAliasesRequest.setListenerThreaded(false); + indicesAliasesRequest.listenerThreaded(false); XContentParser parser = null; try { // { @@ -64,7 +64,7 @@ public class RestIndicesAliasesAction extends BaseRestHandler { // { remove : { index : "test1", alias : "alias1" } } // ] // } - indicesAliasesRequest.setTimeout(request.paramAsTime("timeout", timeValueSeconds(10))); + indicesAliasesRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); parser = XContentFactory.xContent(request.content()).createParser(request.content()); XContentParser.Token token = parser.nextToken(); if (token == null) { @@ -177,4 +177,4 @@ public class RestIndicesAliasesAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java index 3cccd643dab..6bea98854d4 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java @@ -66,12 +66,12 @@ public class RestAnalyzeAction extends BaseRestHandler { } AnalyzeRequest analyzeRequest = new AnalyzeRequest(request.param("index"), text); - analyzeRequest.setListenerThreaded(false); - analyzeRequest.setPreferLocal(request.paramAsBoolean("prefer_local", analyzeRequest.isPreferLocal())); - analyzeRequest.setAnalyzer(request.param("analyzer")); - analyzeRequest.setField(request.param("field")); - analyzeRequest.setTokenizer(request.param("tokenizer")); - analyzeRequest.setTokenFilters(request.paramAsStringArray("token_filters", request.paramAsStringArray("filters", null))); + analyzeRequest.listenerThreaded(false); + analyzeRequest.preferLocal(request.paramAsBoolean("prefer_local", analyzeRequest.preferLocalShard())); + analyzeRequest.analyzer(request.param("analyzer")); + analyzeRequest.field(request.param("field")); + analyzeRequest.tokenizer(request.param("tokenizer")); + analyzeRequest.tokenFilters(request.paramAsStringArray("token_filters", request.paramAsStringArray("filters", null))); client.admin().indices().analyze(analyzeRequest, new ActionListener() { @Override public void onResponse(AnalyzeResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java index bdd4510cfe1..ca9e5604be7 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java @@ -58,23 +58,23 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(RestActions.splitIndices(request.param("index"))); - clearIndicesCacheRequest.setListenerThreaded(false); + clearIndicesCacheRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - clearIndicesCacheRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + clearIndicesCacheRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } try { - clearIndicesCacheRequest.setFilterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.isFilterCache())); - clearIndicesCacheRequest.setFieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.isFieldDataCache())); - clearIndicesCacheRequest.setIdCache(request.paramAsBoolean("id", clearIndicesCacheRequest.isIdCache())); - clearIndicesCacheRequest.setFields(request.paramAsStringArray("fields", clearIndicesCacheRequest.getFields())); - clearIndicesCacheRequest.setFilterKeys(request.paramAsStringArray("filter_keys", clearIndicesCacheRequest.getFilterKeys())); + clearIndicesCacheRequest.filterCache(request.paramAsBoolean("filter", clearIndicesCacheRequest.filterCache())); + clearIndicesCacheRequest.fieldDataCache(request.paramAsBoolean("field_data", clearIndicesCacheRequest.fieldDataCache())); + clearIndicesCacheRequest.idCache(request.paramAsBoolean("id", clearIndicesCacheRequest.idCache())); + clearIndicesCacheRequest.fields(request.paramAsStringArray("fields", clearIndicesCacheRequest.fields())); + clearIndicesCacheRequest.filterKeys(request.paramAsStringArray("filter_keys", clearIndicesCacheRequest.filterKeys())); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = BroadcastOperationThreading.THREAD_PER_SHARD; } - clearIndicesCacheRequest.setOperationThreading(operationThreading); + clearIndicesCacheRequest.operationThreading(operationThreading); } catch (Exception e) { try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); @@ -111,4 +111,4 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java index 63ac3528356..c4082b02adf 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java @@ -49,8 +49,8 @@ public class RestCloseIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { CloseIndexRequest closeIndexRequest = new CloseIndexRequest(request.param("index")); - closeIndexRequest.setListenerThreaded(false); - closeIndexRequest.setTimeout(request.paramAsTime("timeout", timeValueSeconds(10))); + closeIndexRequest.listenerThreaded(false); + closeIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().close(closeIndexRequest, new ActionListener() { @Override public void onResponse(CloseIndexResponse response) { @@ -81,4 +81,4 @@ public class RestCloseIndexAction extends BaseRestHandler { static final XContentBuilderString OK = new XContentBuilderString("ok"); static final XContentBuilderString ACKNOWLEDGED = new XContentBuilderString("acknowledged"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java index 38101b84907..be25063261c 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java @@ -50,10 +50,10 @@ public class RestCreateIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index")); - createIndexRequest.setListenerThreaded(false); + createIndexRequest.listenerThreaded(false); if (request.hasContent()) { try { - createIndexRequest.setSource(request.content()); + createIndexRequest.source(request.content()); } catch (Exception e) { try { channel.sendResponse(new XContentThrowableRestResponse(request, e)); @@ -64,7 +64,7 @@ public class RestCreateIndexAction extends BaseRestHandler { } } - createIndexRequest.setTimeout(request.paramAsTime("timeout", timeValueSeconds(10))); + createIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().create(createIndexRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java index dab414739a5..97a4879598b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java @@ -51,8 +51,8 @@ public class RestDeleteIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(splitIndices(request.param("index"))); - deleteIndexRequest.setListenerThreaded(false); - deleteIndexRequest.setTimeout(request.paramAsTime("timeout", timeValueSeconds(10))); + deleteIndexRequest.listenerThreaded(false); + deleteIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().delete(deleteIndexRequest, new ActionListener() { @Override public void onResponse(DeleteIndexResponse response) { @@ -83,4 +83,4 @@ public class RestDeleteIndexAction extends BaseRestHandler { static final XContentBuilderString OK = new XContentBuilderString("ok"); static final XContentBuilderString ACKNOWLEDGED = new XContentBuilderString("acknowledged"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java index 66a2e75c2b0..608b976d391 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java @@ -53,7 +53,7 @@ public class RestIndicesExistsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesExistsRequest indicesExistsRequest = new IndicesExistsRequest(splitIndices(request.param("index"))); - indicesExistsRequest.setListenerThreaded(false); + indicesExistsRequest.listenerThreaded(false); client.admin().indices().exists(indicesExistsRequest, new ActionListener() { @Override public void onResponse(IndicesExistsResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java index 33d53f505e6..d427680c153 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java @@ -51,9 +51,9 @@ public class RestTypesExistsAction extends BaseRestHandler { TypesExistsRequest typesExistsRequest = new TypesExistsRequest( splitIndices(request.param("index")), splitTypes(request.param("type")) ); - typesExistsRequest.setListenerThreaded(false); + typesExistsRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - typesExistsRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + typesExistsRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } client.admin().indices().typesExists(typesExistsRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java index 4588cae6ea4..89c025ab327 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java @@ -57,19 +57,19 @@ public class RestFlushAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { FlushRequest flushRequest = new FlushRequest(RestActions.splitIndices(request.param("index"))); - flushRequest.setListenerThreaded(false); + flushRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - flushRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + flushRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operationThreading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = BroadcastOperationThreading.THREAD_PER_SHARD; } - flushRequest.setOperationThreading(operationThreading); - flushRequest.setRefresh(request.paramAsBoolean("refresh", flushRequest.isRefresh())); - flushRequest.setFull(request.paramAsBoolean("full", flushRequest.isFull())); - flushRequest.setForce(request.paramAsBoolean("force", flushRequest.isForce())); + flushRequest.operationThreading(operationThreading); + flushRequest.refresh(request.paramAsBoolean("refresh", flushRequest.refresh())); + flushRequest.full(request.paramAsBoolean("full", flushRequest.full())); + flushRequest.force(request.paramAsBoolean("force", flushRequest.force())); client.admin().indices().flush(flushRequest, new ActionListener() { @Override public void onResponse(FlushResponse response) { @@ -97,4 +97,4 @@ public class RestFlushAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java index f304d68bd0e..228b6452cba 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/gateway/snapshot/RestGatewaySnapshotAction.java @@ -52,9 +52,9 @@ public class RestGatewaySnapshotAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { GatewaySnapshotRequest gatewaySnapshotRequest = new GatewaySnapshotRequest(RestActions.splitIndices(request.param("index"))); - gatewaySnapshotRequest.setListenerThreaded(false); + gatewaySnapshotRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - gatewaySnapshotRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + gatewaySnapshotRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } client.admin().indices().gatewaySnapshot(gatewaySnapshotRequest, new ActionListener() { @Override @@ -83,4 +83,4 @@ public class RestGatewaySnapshotAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java index d209426d0ab..ac096fa9003 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java @@ -51,8 +51,8 @@ public class RestDeleteMappingAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteMappingRequest deleteMappingRequest = deleteMappingRequest(splitIndices(request.param("index"))); - deleteMappingRequest.setListenerThreaded(false); - deleteMappingRequest.setType(request.param("type")); + deleteMappingRequest.listenerThreaded(false); + deleteMappingRequest.type(request.param("type")); client.admin().indices().deleteMapping(deleteMappingRequest, new ActionListener() { @Override public void onResponse(DeleteMappingResponse response) { @@ -77,4 +77,4 @@ public class RestDeleteMappingAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java index dfe6a248296..26d6f870dd3 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java @@ -65,11 +65,11 @@ public class RestGetMappingAction extends BaseRestHandler { final Set types = ImmutableSet.copyOf(splitTypes(request.param("type"))); ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() - .setFilterRoutingTable(true) - .setFilterNodes(true) - .setFilteredIndices(indices); + .filterRoutingTable(true) + .filterNodes(true) + .filteredIndices(indices); - clusterStateRequest.setListenerThreaded(false); + clusterStateRequest.listenerThreaded(false); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java index c3084b43878..9bef144e9b7 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java @@ -56,11 +56,11 @@ public class RestPutMappingAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PutMappingRequest putMappingRequest = putMappingRequest(splitIndices(request.param("index"))); - putMappingRequest.setListenerThreaded(false); - putMappingRequest.setType(request.param("type")); - putMappingRequest.setSource(request.content().toUtf8()); - putMappingRequest.setTimeout(request.paramAsTime("timeout", timeValueSeconds(10))); - putMappingRequest.setIgnoreConflicts(request.paramAsBoolean("ignore_conflicts", putMappingRequest.isIgnoreConflicts())); + putMappingRequest.listenerThreaded(false); + putMappingRequest.type(request.param("type")); + putMappingRequest.source(request.content().toUtf8()); + putMappingRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); + putMappingRequest.ignoreConflicts(request.paramAsBoolean("ignore_conflicts", putMappingRequest.ignoreConflicts())); client.admin().indices().putMapping(putMappingRequest, new ActionListener() { @Override public void onResponse(PutMappingResponse response) { @@ -86,4 +86,4 @@ public class RestPutMappingAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java index 3f1ed41bec5..e6ae4f5703b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java @@ -49,8 +49,8 @@ public class RestOpenIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { OpenIndexRequest openIndexRequest = new OpenIndexRequest(request.param("index")); - openIndexRequest.setListenerThreaded(false); - openIndexRequest.setTimeout(request.paramAsTime("timeout", timeValueSeconds(10))); + openIndexRequest.listenerThreaded(false); + openIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().open(openIndexRequest, new ActionListener() { @Override public void onResponse(OpenIndexResponse response) { @@ -81,4 +81,4 @@ public class RestOpenIndexAction extends BaseRestHandler { static final XContentBuilderString OK = new XContentBuilderString("ok"); static final XContentBuilderString ACKNOWLEDGED = new XContentBuilderString("acknowledged"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java index 1814c0a955a..f52d3268072 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java @@ -58,23 +58,23 @@ public class RestOptimizeAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { OptimizeRequest optimizeRequest = new OptimizeRequest(RestActions.splitIndices(request.param("index"))); - optimizeRequest.setListenerThreaded(false); + optimizeRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - optimizeRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + optimizeRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } try { - optimizeRequest.setWaitForMerge(request.paramAsBoolean("wait_for_merge", optimizeRequest.isWaitForMerge())); - optimizeRequest.setMaxNumSegments(request.paramAsInt("max_num_segments", optimizeRequest.getMaxNumSegments())); - optimizeRequest.setOnlyExpungeDeletes(request.paramAsBoolean("only_expunge_deletes", optimizeRequest.isOnlyExpungeDeletes())); - optimizeRequest.setFlush(request.paramAsBoolean("flush", optimizeRequest.isFlush())); - optimizeRequest.setRefresh(request.paramAsBoolean("refresh", optimizeRequest.isRefresh())); + optimizeRequest.waitForMerge(request.paramAsBoolean("wait_for_merge", optimizeRequest.waitForMerge())); + optimizeRequest.maxNumSegments(request.paramAsInt("max_num_segments", optimizeRequest.maxNumSegments())); + optimizeRequest.onlyExpungeDeletes(request.paramAsBoolean("only_expunge_deletes", optimizeRequest.onlyExpungeDeletes())); + optimizeRequest.flush(request.paramAsBoolean("flush", optimizeRequest.flush())); + optimizeRequest.refresh(request.paramAsBoolean("refresh", optimizeRequest.refresh())); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = BroadcastOperationThreading.THREAD_PER_SHARD; } - optimizeRequest.setOperationThreading(operationThreading); + optimizeRequest.operationThreading(operationThreading); } catch (Exception e) { try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); @@ -111,4 +111,4 @@ public class RestOptimizeAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java index 82c1ec5990a..8c8446ba97c 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java @@ -57,16 +57,16 @@ public class RestRefreshAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { RefreshRequest refreshRequest = new RefreshRequest(RestActions.splitIndices(request.param("index"))); - refreshRequest.setListenerThreaded(false); + refreshRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - refreshRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + refreshRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = BroadcastOperationThreading.THREAD_PER_SHARD; } - refreshRequest.setOperationThreading(operationThreading); + refreshRequest.operationThreading(operationThreading); client.admin().indices().refresh(refreshRequest, new ActionListener() { @Override public void onResponse(RefreshResponse response) { @@ -94,4 +94,4 @@ public class RestRefreshAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java index 65435d4ed64..a99cf174a86 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java @@ -52,16 +52,16 @@ public class RestIndicesSegmentsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(splitIndices(request.param("index"))); - indicesSegmentsRequest.setListenerThreaded(false); + indicesSegmentsRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - indicesSegmentsRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + indicesSegmentsRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = BroadcastOperationThreading.SINGLE_THREAD; } - indicesSegmentsRequest.setOperationThreading(operationThreading); + indicesSegmentsRequest.operationThreading(operationThreading); client.admin().indices().segments(indicesSegmentsRequest, new ActionListener() { @Override public void onResponse(IndicesSegmentResponse response) { @@ -88,4 +88,4 @@ public class RestIndicesSegmentsAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java index 850373d5da4..79de9e14ce7 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java @@ -61,10 +61,10 @@ public class RestGetSettingsAction extends BaseRestHandler { final String[] indices = splitIndices(request.param("index")); ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() - .setFilterRoutingTable(true) - .setFilterNodes(true) - .setFilteredIndices(indices); - clusterStateRequest.setListenerThreaded(false); + .filterRoutingTable(true) + .filterNodes(true) + .filteredIndices(indices); + clusterStateRequest.listenerThreaded(false); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java index 2012128780d..47ab59f621f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java @@ -55,7 +55,7 @@ public class RestUpdateSettingsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(splitIndices(request.param("index"))); - updateSettingsRequest.setListenerThreaded(false); + updateSettingsRequest.listenerThreaded(false); ImmutableSettings.Builder updateSettings = ImmutableSettings.settingsBuilder(); String bodySettingsStr = request.content().toUtf8(); @@ -86,7 +86,7 @@ public class RestUpdateSettingsAction extends BaseRestHandler { } updateSettings.put(entry.getKey(), entry.getValue()); } - updateSettingsRequest.setSettings(updateSettings); + updateSettingsRequest.settings(updateSettings); client.admin().indices().updateSettings(updateSettingsRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java index 543422c2141..e039eef5fa2 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java @@ -82,9 +82,9 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); + indicesStatsRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - indicesStatsRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + indicesStatsRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } boolean clear = request.paramAsBoolean("clear", false); if (clear) { @@ -94,20 +94,20 @@ public class RestIndicesStatsAction extends BaseRestHandler { if (all) { indicesStatsRequest.all(); } - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); - indicesStatsRequest.setTypes(splitTypes(request.param("types"))); + indicesStatsRequest.indices(splitIndices(request.param("index"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); if (request.hasParam("groups")) { - indicesStatsRequest.setGroups(Strings.splitStringByCommaToArray(request.param("groups"))); + indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("groups"))); } - indicesStatsRequest.setDocs(request.paramAsBoolean("docs", indicesStatsRequest.isDocs())); - indicesStatsRequest.setStore(request.paramAsBoolean("store", indicesStatsRequest.isStore())); - indicesStatsRequest.setIndexing(request.paramAsBoolean("indexing", indicesStatsRequest.isIndexing())); - indicesStatsRequest.setSearch(request.paramAsBoolean("search", indicesStatsRequest.isSearch())); - indicesStatsRequest.setGet(request.paramAsBoolean("get", indicesStatsRequest.isGet())); - indicesStatsRequest.setMerge(request.paramAsBoolean("merge", indicesStatsRequest.isMerge())); - indicesStatsRequest.setRefresh(request.paramAsBoolean("refresh", indicesStatsRequest.isRefresh())); - indicesStatsRequest.setFlush(request.paramAsBoolean("flush", indicesStatsRequest.isFlush())); - indicesStatsRequest.setWarmer(request.paramAsBoolean("warmer", indicesStatsRequest.isWarmer())); + indicesStatsRequest.docs(request.paramAsBoolean("docs", indicesStatsRequest.docs())); + indicesStatsRequest.store(request.paramAsBoolean("store", indicesStatsRequest.store())); + indicesStatsRequest.indexing(request.paramAsBoolean("indexing", indicesStatsRequest.indexing())); + indicesStatsRequest.search(request.paramAsBoolean("search", indicesStatsRequest.search())); + indicesStatsRequest.get(request.paramAsBoolean("get", indicesStatsRequest.get())); + indicesStatsRequest.merge(request.paramAsBoolean("merge", indicesStatsRequest.merge())); + indicesStatsRequest.refresh(request.paramAsBoolean("refresh", indicesStatsRequest.refresh())); + indicesStatsRequest.flush(request.paramAsBoolean("flush", indicesStatsRequest.flush())); + indicesStatsRequest.warmer(request.paramAsBoolean("warmer", indicesStatsRequest.warmer())); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override @@ -141,10 +141,10 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setDocs(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); - indicesStatsRequest.setTypes(splitTypes(request.param("types"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().docs(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override @@ -179,10 +179,10 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setStore(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); - indicesStatsRequest.setTypes(splitTypes(request.param("types"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().store(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override @@ -217,15 +217,15 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setIndexing(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().indexing(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); if (request.hasParam("types")) { - indicesStatsRequest.setTypes(splitTypes(request.param("types"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); } else if (request.hasParam("indexingTypes1")) { - indicesStatsRequest.setTypes(splitTypes(request.param("indexingTypes1"))); + indicesStatsRequest.types(splitTypes(request.param("indexingTypes1"))); } else if (request.hasParam("indexingTypes2")) { - indicesStatsRequest.setTypes(splitTypes(request.param("indexingTypes2"))); + indicesStatsRequest.types(splitTypes(request.param("indexingTypes2"))); } client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @@ -261,15 +261,15 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setSearch(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().search(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); if (request.hasParam("groups")) { - indicesStatsRequest.setGroups(Strings.splitStringByCommaToArray(request.param("groups"))); + indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("groups"))); } else if (request.hasParam("searchGroupsStats1")) { - indicesStatsRequest.setGroups(Strings.splitStringByCommaToArray(request.param("searchGroupsStats1"))); + indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("searchGroupsStats1"))); } else if (request.hasParam("searchGroupsStats2")) { - indicesStatsRequest.setGroups(Strings.splitStringByCommaToArray(request.param("searchGroupsStats2"))); + indicesStatsRequest.groups(Strings.splitStringByCommaToArray(request.param("searchGroupsStats2"))); } client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @@ -305,9 +305,9 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setGet(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().get(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override @@ -342,10 +342,10 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setMerge(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); - indicesStatsRequest.setTypes(splitTypes(request.param("types"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().merge(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override @@ -380,10 +380,10 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setFlush(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); - indicesStatsRequest.setTypes(splitTypes(request.param("types"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().flush(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override @@ -418,10 +418,10 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setWarmer(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); - indicesStatsRequest.setTypes(splitTypes(request.param("types"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().warmer(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override @@ -456,10 +456,10 @@ public class RestIndicesStatsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest(); - indicesStatsRequest.setListenerThreaded(false); - indicesStatsRequest.clear().setRefresh(true); - indicesStatsRequest.setIndices(splitIndices(request.param("index"))); - indicesStatsRequest.setTypes(splitTypes(request.param("types"))); + indicesStatsRequest.listenerThreaded(false); + indicesStatsRequest.clear().refresh(true); + indicesStatsRequest.indices(splitIndices(request.param("index"))); + indicesStatsRequest.types(splitTypes(request.param("types"))); client.admin().indices().stats(indicesStatsRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java index 90796b87b5f..854ea62aa7b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java @@ -59,18 +59,18 @@ public class RestIndicesStatusAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndicesStatusRequest indicesStatusRequest = new IndicesStatusRequest(splitIndices(request.param("index"))); - indicesStatusRequest.setListenerThreaded(false); + indicesStatusRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - indicesStatusRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + indicesStatusRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } - indicesStatusRequest.setRecovery(request.paramAsBoolean("recovery", indicesStatusRequest.isRecovery())); - indicesStatusRequest.setSnapshot(request.paramAsBoolean("snapshot", indicesStatusRequest.isSnapshot())); + indicesStatusRequest.recovery(request.paramAsBoolean("recovery", indicesStatusRequest.recovery())); + indicesStatusRequest.snapshot(request.paramAsBoolean("snapshot", indicesStatusRequest.snapshot())); BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = BroadcastOperationThreading.SINGLE_THREAD; } - indicesStatusRequest.setOperationThreading(operationThreading); + indicesStatusRequest.operationThreading(operationThreading); client.admin().indices().status(indicesStatusRequest, new ActionListener() { @Override public void onResponse(IndicesStatusResponse response) { @@ -97,4 +97,4 @@ public class RestIndicesStatusAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java index 652908a73f4..559ed45d4e1 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java @@ -49,8 +49,8 @@ public class RestDeleteIndexTemplateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name")); - deleteIndexTemplateRequest.setListenerThreaded(false); - deleteIndexTemplateRequest.setTimeout(request.paramAsTime("timeout", timeValueSeconds(10))); + deleteIndexTemplateRequest.listenerThreaded(false); + deleteIndexTemplateRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10))); client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new ActionListener() { @Override public void onResponse(DeleteIndexTemplateResponse response) { @@ -81,4 +81,4 @@ public class RestDeleteIndexTemplateAction extends BaseRestHandler { static final XContentBuilderString OK = new XContentBuilderString("ok"); static final XContentBuilderString ACKNOWLEDGED = new XContentBuilderString("acknowledged"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java index 81cb66b2867..747c442cbca 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java @@ -61,12 +61,12 @@ public class RestGetIndexTemplateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() - .setFilterRoutingTable(true) - .setFilterNodes(true) - .setFilteredIndexTemplates(request.param("name")) - .setFilteredIndices("_na"); + .filterRoutingTable(true) + .filterNodes(true) + .filteredIndexTemplates(request.param("name")) + .filteredIndices("_na"); - clusterStateRequest.setListenerThreaded(false); + clusterStateRequest.listenerThreaded(false); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java index a8b2257cba8..9bcc82a3730 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java @@ -59,7 +59,7 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name")); - putRequest.setListenerThreaded(false); + putRequest.listenerThreaded(false); putRequest.template(request.param("template", putRequest.template())); putRequest.order(request.paramAsInt("order", putRequest.order())); @@ -107,4 +107,4 @@ public class RestPutIndexTemplateAction extends BaseRestHandler { static final XContentBuilderString OK = new XContentBuilderString("ok"); static final XContentBuilderString ACKNOWLEDGED = new XContentBuilderString("acknowledged"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java index 43cc575a663..53a7fd15c0f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java @@ -62,9 +62,9 @@ public class RestValidateQueryAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(RestActions.splitIndices(request.param("index"))); - validateQueryRequest.setListenerThreaded(false); + validateQueryRequest.listenerThreaded(false); if (request.hasParam("ignore_indices")) { - validateQueryRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + validateQueryRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } try { BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); @@ -72,25 +72,25 @@ public class RestValidateQueryAction extends BaseRestHandler { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = BroadcastOperationThreading.SINGLE_THREAD; } - validateQueryRequest.setOperationThreading(operationThreading); + validateQueryRequest.operationThreading(operationThreading); if (request.hasContent()) { - validateQueryRequest.setQuery(request.content(), request.contentUnsafe()); + validateQueryRequest.query(request.content(), request.contentUnsafe()); } else { String source = request.param("source"); if (source != null) { - validateQueryRequest.setQuery(source); + validateQueryRequest.query(source); } else { BytesReference querySource = RestActions.parseQuerySource(request); if (querySource != null) { - validateQueryRequest.setQuery(querySource, false); + validateQueryRequest.query(querySource, false); } } } - validateQueryRequest.setTypes(splitTypes(request.param("type"))); + validateQueryRequest.types(splitTypes(request.param("type"))); if (request.paramAsBoolean("explain", false)) { - validateQueryRequest.setExplain(true); + validateQueryRequest.explain(true); } else { - validateQueryRequest.setExplain(false); + validateQueryRequest.explain(false); } } catch (Exception e) { try { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java index d2a479ee768..7efac34f956 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java @@ -50,8 +50,8 @@ public class RestDeleteWarmerAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteWarmerRequest deleteWarmerRequest = new DeleteWarmerRequest(request.param("name")) - .setIndices(RestActions.splitIndices(request.param("index"))); - deleteWarmerRequest.setListenerThreaded(false); + .indices(RestActions.splitIndices(request.param("index"))); + deleteWarmerRequest.listenerThreaded(false); client.admin().indices().deleteWarmer(deleteWarmerRequest, new ActionListener() { @Override public void onResponse(DeleteWarmerResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java index 7f00c7599ad..d5a23d00b5a 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java @@ -64,10 +64,10 @@ public class RestGetWarmerAction extends BaseRestHandler { ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() .filterAll() - .setFilterMetaData(false) - .setFilteredIndices(indices); + .filterMetaData(false) + .filteredIndices(indices); - clusterStateRequest.setListenerThreaded(false); + clusterStateRequest.listenerThreaded(false); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java index 76acc998bdb..963776c5779 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java @@ -50,11 +50,11 @@ public class RestPutWarmerAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PutWarmerRequest putWarmerRequest = new PutWarmerRequest(request.param("name")); - putWarmerRequest.setListenerThreaded(false); + putWarmerRequest.listenerThreaded(false); SearchRequest searchRequest = new SearchRequest(RestActions.splitIndices(request.param("index"))) - .setTypes(RestActions.splitTypes(request.param("type"))) - .setSource(request.content(), request.contentUnsafe()); - putWarmerRequest.setSearchRequest(searchRequest); + .types(RestActions.splitTypes(request.param("type"))) + .source(request.content(), request.contentUnsafe()); + putWarmerRequest.searchRequest(searchRequest); client.admin().indices().putWarmer(putWarmerRequest, new ActionListener() { @Override public void onResponse(PutWarmerResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java index 8737e23df4d..a3ad98994b6 100644 --- a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java +++ b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java @@ -68,7 +68,7 @@ public class RestBulkAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { BulkRequest bulkRequest = Requests.bulkRequest(); - bulkRequest.setListenerThreaded(false); + bulkRequest.listenerThreaded(false); String defaultIndex = request.param("index"); String defaultType = request.param("type"); diff --git a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java index 0d821e10c6a..bd16d210536 100644 --- a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java +++ b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java @@ -63,32 +63,32 @@ public class RestCountAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { CountRequest countRequest = new CountRequest(RestActions.splitIndices(request.param("index"))); if (request.hasParam("ignore_indices")) { - countRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + countRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } - countRequest.setListenerThreaded(false); + countRequest.listenerThreaded(false); try { BroadcastOperationThreading operationThreading = BroadcastOperationThreading.fromString(request.param("operation_threading"), BroadcastOperationThreading.SINGLE_THREAD); if (operationThreading == BroadcastOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = BroadcastOperationThreading.SINGLE_THREAD; } - countRequest.setOperationThreading(operationThreading); + countRequest.operationThreading(operationThreading); if (request.hasContent()) { - countRequest.setQuery(request.content(), request.contentUnsafe()); + countRequest.query(request.content(), request.contentUnsafe()); } else { String source = request.param("source"); if (source != null) { - countRequest.setQuery(source); + countRequest.query(source); } else { BytesReference querySource = RestActions.parseQuerySource(request); if (querySource != null) { - countRequest.setQuery(querySource, false); + countRequest.query(querySource, false); } } } - countRequest.setRouting(request.param("routing")); - countRequest.setMinScore(request.paramAsFloat("min_score", DEFAULT_MIN_SCORE)); - countRequest.setTypes(splitTypes(request.param("type"))); + countRequest.routing(request.param("routing")); + countRequest.minScore(request.paramAsFloat("min_score", DEFAULT_MIN_SCORE)); + countRequest.types(splitTypes(request.param("type"))); } catch (Exception e) { try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); @@ -126,4 +126,4 @@ public class RestCountAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java b/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java index 68bd862fd33..afc9b0c890c 100644 --- a/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java +++ b/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java @@ -55,23 +55,23 @@ public class RestDeleteAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteRequest deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id")); - deleteRequest.setListenerThreaded(false); - deleteRequest.setOperationThreaded(true); + deleteRequest.listenerThreaded(false); + deleteRequest.operationThreaded(true); - deleteRequest.setParent(request.param("parent")); - deleteRequest.setRouting(request.param("routing")); - deleteRequest.setTimeout(request.paramAsTime("timeout", DeleteRequest.DEFAULT_TIMEOUT)); - deleteRequest.setRefresh(request.paramAsBoolean("refresh", deleteRequest.isRefresh())); - deleteRequest.setVersion(RestActions.parseVersion(request)); - deleteRequest.setVersionType(VersionType.fromString(request.param("version_type"), deleteRequest.getVersionType())); + deleteRequest.parent(request.param("parent")); + deleteRequest.routing(request.param("routing")); + deleteRequest.timeout(request.paramAsTime("timeout", DeleteRequest.DEFAULT_TIMEOUT)); + deleteRequest.refresh(request.paramAsBoolean("refresh", deleteRequest.refresh())); + deleteRequest.version(RestActions.parseVersion(request)); + deleteRequest.versionType(VersionType.fromString(request.param("version_type"), deleteRequest.versionType())); String replicationType = request.param("replication"); if (replicationType != null) { - deleteRequest.setReplicationType(ReplicationType.fromString(replicationType)); + deleteRequest.replicationType(ReplicationType.fromString(replicationType)); } String consistencyLevel = request.param("consistency"); if (consistencyLevel != null) { - deleteRequest.setConsistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); + deleteRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); } client.delete(deleteRequest, new ActionListener() { @@ -116,4 +116,4 @@ public class RestDeleteAction extends BaseRestHandler { static final XContentBuilderString _ID = new XContentBuilderString("_id"); static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java b/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java index dea1340cb44..b9b31fb1025 100644 --- a/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java @@ -58,30 +58,30 @@ public class RestDeleteByQueryAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(splitIndices(request.param("index"))); - deleteByQueryRequest.setListenerThreaded(false); + deleteByQueryRequest.listenerThreaded(false); try { if (request.hasContent()) { - deleteByQueryRequest.setQuery(request.content(), request.contentUnsafe()); + deleteByQueryRequest.query(request.content(), request.contentUnsafe()); } else { String source = request.param("source"); if (source != null) { - deleteByQueryRequest.setQuery(source); + deleteByQueryRequest.query(source); } else { BytesReference bytes = RestActions.parseQuerySource(request); - deleteByQueryRequest.setQuery(bytes, false); + deleteByQueryRequest.query(bytes, false); } } - deleteByQueryRequest.setTypes(splitTypes(request.param("type"))); - deleteByQueryRequest.setTimeout(request.paramAsTime("timeout", ShardDeleteByQueryRequest.DEFAULT_TIMEOUT)); + deleteByQueryRequest.types(splitTypes(request.param("type"))); + deleteByQueryRequest.timeout(request.paramAsTime("timeout", ShardDeleteByQueryRequest.DEFAULT_TIMEOUT)); - deleteByQueryRequest.setRouting(request.param("routing")); + deleteByQueryRequest.routing(request.param("routing")); String replicationType = request.param("replication"); if (replicationType != null) { - deleteByQueryRequest.setReplicationType(ReplicationType.fromString(replicationType)); + deleteByQueryRequest.replicationType(ReplicationType.fromString(replicationType)); } String consistencyLevel = request.param("consistency"); if (consistencyLevel != null) { - deleteByQueryRequest.setConsistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); + deleteByQueryRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); } } catch (Exception e) { try { @@ -130,4 +130,4 @@ public class RestDeleteByQueryAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java b/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java index 87a5fab3a1b..febb1c16395 100644 --- a/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java +++ b/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java @@ -58,15 +58,15 @@ public class RestExplainAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final ExplainRequest explainRequest = new ExplainRequest(request.param("index"), request.param("type"), request.param("id")); - explainRequest.setParent(request.param("parent")); - explainRequest.setRouting(request.param("routing")); - explainRequest.setPreference(request.param("preference")); + explainRequest.parent(request.param("parent")); + explainRequest.routing(request.param("routing")); + explainRequest.preference(request.param("preference")); String sourceString = request.param("source"); String queryString = request.param("q"); if (request.hasContent()) { - explainRequest.setSource(request.content(), request.contentUnsafe()); + explainRequest.source(request.content(), request.contentUnsafe()); } else if (sourceString != null) { - explainRequest.setSource(new BytesArray(request.param("source")), false); + explainRequest.source(new BytesArray(request.param("source")), false); } else if (queryString != null) { QueryStringQueryBuilder queryStringBuilder = QueryBuilders.queryString(queryString); queryStringBuilder.defaultField(request.param("df")); @@ -87,14 +87,14 @@ public class RestExplainAction extends BaseRestHandler { ExplainSourceBuilder explainSourceBuilder = new ExplainSourceBuilder(); explainSourceBuilder.setQuery(queryStringBuilder); - explainRequest.setSource(explainSourceBuilder); + explainRequest.source(explainSourceBuilder); } String sField = request.param("fields"); if (sField != null) { String[] sFields = Strings.splitStringByCommaToArray(sField); if (sFields != null) { - explainRequest.setFields(sFields); + explainRequest.fields(sFields); } } @@ -106,9 +106,9 @@ public class RestExplainAction extends BaseRestHandler { XContentBuilder builder = restContentBuilder(request); builder.startObject(); builder.field(Fields.OK, response.isExists()) - .field(Fields._INDEX, explainRequest.getIndex()) - .field(Fields._TYPE, explainRequest.getType()) - .field(Fields._ID, explainRequest.getId()) + .field(Fields._INDEX, explainRequest.index()) + .field(Fields._TYPE, explainRequest.type()) + .field(Fields._ID, explainRequest.id()) .field(Fields.MATCHED, response.isMatch()); if (response.hasExplanation()) { @@ -168,4 +168,4 @@ public class RestExplainAction extends BaseRestHandler { static final XContentBuilderString GET = new XContentBuilderString("get"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java index 9a60ce9dbbb..e4dfb11b0f6 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java @@ -50,19 +50,19 @@ public class RestGetAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id")); - getRequest.setListenerThreaded(false); - getRequest.setOperationThreaded(true); - getRequest.setRefresh(request.paramAsBoolean("refresh", getRequest.isRefresh())); - getRequest.setParent(request.param("parent")); - getRequest.setRouting(request.param("routing")); - getRequest.setPreference(request.param("preference")); - getRequest.setRealtime(request.paramAsBooleanOptional("realtime", null)); + getRequest.listenerThreaded(false); + getRequest.operationThreaded(true); + getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh())); + getRequest.parent(request.param("parent")); + getRequest.routing(request.param("routing")); + getRequest.preference(request.param("preference")); + getRequest.realtime(request.paramAsBooleanOptional("realtime", null)); String sField = request.param("fields"); if (sField != null) { String[] sFields = Strings.splitStringByCommaToArray(sField); if (sFields != null) { - getRequest.setFields(sFields); + getRequest.fields(sFields); } } @@ -94,4 +94,4 @@ public class RestGetAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java index 567f0fd7cf3..cccba25c1bc 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java @@ -47,15 +47,15 @@ public class RestHeadAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id")); - getRequest.setListenerThreaded(false); - getRequest.setOperationThreaded(true); - getRequest.setRefresh(request.paramAsBoolean("refresh", getRequest.isRefresh())); - getRequest.setParent(request.param("parent")); - getRequest.setRouting(request.param("routing")); - getRequest.setPreference(request.param("preference")); - getRequest.setRealtime(request.paramAsBooleanOptional("realtime", null)); + getRequest.listenerThreaded(false); + getRequest.operationThreaded(true); + getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh())); + getRequest.parent(request.param("parent")); + getRequest.routing(request.param("routing")); + getRequest.preference(request.param("preference")); + getRequest.realtime(request.paramAsBooleanOptional("realtime", null)); // don't get any fields back... - getRequest.setFields(Strings.EMPTY_ARRAY); + getRequest.fields(Strings.EMPTY_ARRAY); // TODO we can also just return the document size as Content-Length client.get(getRequest, new ActionListener() { @@ -82,4 +82,4 @@ public class RestHeadAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java index 89c4aa1c9fc..77894872dec 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java @@ -53,10 +53,10 @@ public class RestMultiGetAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { MultiGetRequest multiGetRequest = new MultiGetRequest(); - multiGetRequest.setListenerThreaded(false); - multiGetRequest.setRefresh(request.paramAsBoolean("refresh", multiGetRequest.isRefresh())); - multiGetRequest.setPreference(request.param("preference")); - multiGetRequest.setRealtime(request.paramAsBooleanOptional("realtime", null)); + multiGetRequest.listenerThreaded(false); + multiGetRequest.refresh(request.paramAsBoolean("refresh", multiGetRequest.refresh())); + multiGetRequest.preference(request.param("preference")); + multiGetRequest.realtime(request.paramAsBooleanOptional("realtime", null)); String[] sFields = null; String sField = request.param("fields"); @@ -98,4 +98,4 @@ public class RestMultiGetAction extends BaseRestHandler { } }); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java b/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java index 5cc3049677a..1827dd31a72 100644 --- a/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java @@ -66,26 +66,26 @@ public class RestIndexAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { IndexRequest indexRequest = new IndexRequest(request.param("index"), request.param("type"), request.param("id")); - indexRequest.setListenerThreaded(false); - indexRequest.setOperationThreaded(true); - indexRequest.setRouting(request.param("routing")); - indexRequest.setParent(request.param("parent")); // order is important, set it after routing, so it will set the routing - indexRequest.setTimestamp(request.param("timestamp")); + indexRequest.listenerThreaded(false); + indexRequest.operationThreaded(true); + indexRequest.routing(request.param("routing")); + indexRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing + indexRequest.timestamp(request.param("timestamp")); if (request.hasParam("ttl")) { - indexRequest.setTtl(request.paramAsTime("ttl", null).millis()); + indexRequest.ttl(request.paramAsTime("ttl", null).millis()); } - indexRequest.setSource(request.content(), request.contentUnsafe()); - indexRequest.setTimeout(request.paramAsTime("timeout", IndexRequest.DEFAULT_TIMEOUT)); - indexRequest.setRefresh(request.paramAsBoolean("refresh", indexRequest.isRefresh())); - indexRequest.setVersion(RestActions.parseVersion(request)); - indexRequest.setVersionType(VersionType.fromString(request.param("version_type"), indexRequest.getVersionType())); - indexRequest.setPercolate(request.param("percolate", null)); + indexRequest.source(request.content(), request.contentUnsafe()); + indexRequest.timeout(request.paramAsTime("timeout", IndexRequest.DEFAULT_TIMEOUT)); + indexRequest.refresh(request.paramAsBoolean("refresh", indexRequest.refresh())); + indexRequest.version(RestActions.parseVersion(request)); + indexRequest.versionType(VersionType.fromString(request.param("version_type"), indexRequest.versionType())); + indexRequest.percolate(request.param("percolate", null)); String sOpType = request.param("op_type"); if (sOpType != null) { if ("index".equals(sOpType)) { - indexRequest.setOpType(IndexRequest.OpType.INDEX); + indexRequest.opType(IndexRequest.OpType.INDEX); } else if ("create".equals(sOpType)) { - indexRequest.setOpType(IndexRequest.OpType.CREATE); + indexRequest.opType(IndexRequest.OpType.CREATE); } else { try { XContentBuilder builder = RestXContentBuilder.restContentBuilder(request); @@ -98,11 +98,11 @@ public class RestIndexAction extends BaseRestHandler { } String replicationType = request.param("replication"); if (replicationType != null) { - indexRequest.setReplicationType(ReplicationType.fromString(replicationType)); + indexRequest.replicationType(ReplicationType.fromString(replicationType)); } String consistencyLevel = request.param("consistency"); if (consistencyLevel != null) { - indexRequest.setConsistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); + indexRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); } client.index(indexRequest, new ActionListener() { @Override @@ -153,4 +153,4 @@ public class RestIndexAction extends BaseRestHandler { static final XContentBuilderString MATCHES = new XContentBuilderString("matches"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java index ca46b1224d7..bf8a656a1af 100644 --- a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java +++ b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java @@ -51,10 +51,10 @@ public class RestMainAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { ClusterStateRequest clusterStateRequest = new ClusterStateRequest(); - clusterStateRequest.setListenerThreaded(false); - clusterStateRequest.setMasterNodeTimeout(TimeValue.timeValueMillis(0)); - clusterStateRequest.setLocal(true); - clusterStateRequest.filterAll().setFilterBlocks(false); + clusterStateRequest.listenerThreaded(false); + clusterStateRequest.masterNodeTimeout(TimeValue.timeValueMillis(0)); + clusterStateRequest.local(true); + clusterStateRequest.filterAll().filterBlocks(false); client.admin().cluster().state(clusterStateRequest, new ActionListener() { @Override public void onResponse(ClusterStateResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java b/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java index d1e26f49c44..e9702ae6eac 100644 --- a/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java +++ b/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java @@ -54,38 +54,38 @@ public class RestMoreLikeThisAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { - MoreLikeThisRequest mltRequest = moreLikeThisRequest(request.param("index")).setType(request.param("type")).setId(request.param("id")); - mltRequest.setRouting(request.param("routing")); + MoreLikeThisRequest mltRequest = moreLikeThisRequest(request.param("index")).type(request.param("type")).id(request.param("id")); + mltRequest.routing(request.param("routing")); - mltRequest.setListenerThreaded(false); + mltRequest.listenerThreaded(false); try { - mltRequest.setFields(request.paramAsStringArray("mlt_fields", null)); - mltRequest.setPercentTermsToMatch(request.paramAsFloat("percent_terms_to_match", -1)); - mltRequest.setMinTermFreq(request.paramAsInt("min_term_freq", -1)); - mltRequest.setMaxQueryTerms(request.paramAsInt("max_query_terms", -1)); - mltRequest.setStopWords(request.paramAsStringArray("stop_words", null)); - mltRequest.setMinDocFreq(request.paramAsInt("min_doc_freq", -1)); - mltRequest.setMaxDocFreq(request.paramAsInt("max_doc_freq", -1)); - mltRequest.setMinWordLen(request.paramAsInt("min_word_len", -1)); - mltRequest.setMaxWordLen(request.paramAsInt("max_word_len", -1)); - mltRequest.setBoostTerms(request.paramAsFloat("boost_terms", -1)); + mltRequest.fields(request.paramAsStringArray("mlt_fields", null)); + mltRequest.percentTermsToMatch(request.paramAsFloat("percent_terms_to_match", -1)); + mltRequest.minTermFreq(request.paramAsInt("min_term_freq", -1)); + mltRequest.maxQueryTerms(request.paramAsInt("max_query_terms", -1)); + mltRequest.stopWords(request.paramAsStringArray("stop_words", null)); + mltRequest.minDocFreq(request.paramAsInt("min_doc_freq", -1)); + mltRequest.maxDocFreq(request.paramAsInt("max_doc_freq", -1)); + mltRequest.minWordLen(request.paramAsInt("min_word_len", -1)); + mltRequest.maxWordLen(request.paramAsInt("max_word_len", -1)); + mltRequest.boostTerms(request.paramAsFloat("boost_terms", -1)); - mltRequest.setSearchType(SearchType.fromString(request.param("search_type"))); - mltRequest.setSearchIndices(request.paramAsStringArray("search_indices", null)); - mltRequest.setSearchTypes(request.paramAsStringArray("search_types", null)); - mltRequest.setSearchQueryHint(request.param("search_query_hint")); - mltRequest.setSearchSize(request.paramAsInt("search_size", mltRequest.getSearchSize())); - mltRequest.setSearchFrom(request.paramAsInt("search_from", mltRequest.getSearchFrom())); + mltRequest.searchType(SearchType.fromString(request.param("search_type"))); + mltRequest.searchIndices(request.paramAsStringArray("search_indices", null)); + mltRequest.searchTypes(request.paramAsStringArray("search_types", null)); + mltRequest.searchQueryHint(request.param("search_query_hint")); + mltRequest.searchSize(request.paramAsInt("search_size", mltRequest.searchSize())); + mltRequest.searchFrom(request.paramAsInt("search_from", mltRequest.searchFrom())); String searchScroll = request.param("search_scroll"); if (searchScroll != null) { - mltRequest.setSearchScroll(new Scroll(parseTimeValue(searchScroll, null))); + mltRequest.searchScroll(new Scroll(parseTimeValue(searchScroll, null))); } if (request.hasContent()) { - mltRequest.setSearchSource(request.content(), request.contentUnsafe()); + mltRequest.searchSource(request.content(), request.contentUnsafe()); } else { String searchSource = request.param("search_source"); if (searchSource != null) { - mltRequest.setSearchSource(searchSource); + mltRequest.searchSource(searchSource); } } } catch (Exception e) { diff --git a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java index 811effe416a..1012524b9a0 100644 --- a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java @@ -51,15 +51,15 @@ public class RestPercolateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { PercolateRequest percolateRequest = new PercolateRequest(request.param("index"), request.param("type")); - percolateRequest.setListenerThreaded(false); - percolateRequest.setSource(request.content(), request.contentUnsafe()); + percolateRequest.listenerThreaded(false); + percolateRequest.source(request.content(), request.contentUnsafe()); // we just send a response, no need to fork - percolateRequest.setListenerThreaded(false); + percolateRequest.listenerThreaded(false); // we don't spawn, then fork if local - percolateRequest.setOperationThreaded(true); + percolateRequest.operationThreaded(true); - percolateRequest.setPreferLocal(request.paramAsBoolean("prefer_local", percolateRequest.isPreferLocal())); + percolateRequest.preferLocal(request.paramAsBoolean("prefer_local", percolateRequest.preferLocalShard())); client.percolate(percolateRequest, new ActionListener() { @Override public void onResponse(PercolateResponse response) { diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index 715b4bb0828..0438d56d7dd 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -57,7 +57,7 @@ public class RestMultiSearchAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { MultiSearchRequest multiSearchRequest = new MultiSearchRequest(); - multiSearchRequest.setListenerThreaded(false); + multiSearchRequest.listenerThreaded(false); String[] indices = RestActions.splitIndices(request.param("index")); String[] types = RestActions.splitTypes(request.param("type")); diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index c1c0345d430..b636e6eedb9 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -68,14 +68,14 @@ public class RestSearchAction extends BaseRestHandler { SearchRequest searchRequest; try { searchRequest = parseSearchRequest(request); - searchRequest.setListenerThreaded(false); + searchRequest.listenerThreaded(false); SearchOperationThreading operationThreading = SearchOperationThreading.fromString(request.param("operation_threading"), null); if (operationThreading != null) { if (operationThreading == SearchOperationThreading.NO_THREADS) { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = SearchOperationThreading.SINGLE_THREAD; } - searchRequest.setOperationThreading(operationThreading); + searchRequest.operationThreading(operationThreading); } } catch (Exception e) { if (logger.isDebugEnabled()) { @@ -122,28 +122,28 @@ public class RestSearchAction extends BaseRestHandler { SearchRequest searchRequest = new SearchRequest(indices); // get the content, and put it in the body if (request.hasContent()) { - searchRequest.setSource(request.content(), request.contentUnsafe()); + searchRequest.source(request.content(), request.contentUnsafe()); } else { String source = request.param("source"); if (source != null) { - searchRequest.setSource(source); + searchRequest.source(source); } } // add extra source based on the request parameters - searchRequest.setExtraSource(parseSearchSource(request)); + searchRequest.extraSource(parseSearchSource(request)); - searchRequest.setSearchType(request.param("search_type")); + searchRequest.searchType(request.param("search_type")); String scroll = request.param("scroll"); if (scroll != null) { - searchRequest.setScroll(new Scroll(parseTimeValue(scroll, null))); + searchRequest.scroll(new Scroll(parseTimeValue(scroll, null))); } - searchRequest.setTypes(RestActions.splitTypes(request.param("type"))); - searchRequest.setRouting(request.param("routing")); - searchRequest.setPreference(request.param("preference")); + searchRequest.types(RestActions.splitTypes(request.param("type"))); + searchRequest.routing(request.param("routing")); + searchRequest.preference(request.param("preference")); if (request.hasParam("ignore_indices")) { - searchRequest.setIgnoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); + searchRequest.ignoreIndices(IgnoreIndices.fromString(request.param("ignore_indices"))); } return searchRequest; diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index 611ec5ddc40..a4269d6c448 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -60,11 +60,11 @@ public class RestSearchScrollAction extends BaseRestHandler { scrollId = request.content().toUtf8(); } SearchScrollRequest searchScrollRequest = new SearchScrollRequest(scrollId); - searchScrollRequest.setListenerThreaded(false); + searchScrollRequest.listenerThreaded(false); try { String scroll = request.param("scroll"); if (scroll != null) { - searchScrollRequest.setScroll(new Scroll(parseTimeValue(scroll, null))); + searchScrollRequest.scroll(new Scroll(parseTimeValue(scroll, null))); } SearchOperationThreading operationThreading = SearchOperationThreading.fromString(request.param("operation_threading"), null); if (operationThreading != null) { @@ -72,7 +72,7 @@ public class RestSearchScrollAction extends BaseRestHandler { // since we don't spawn, don't allow no_threads, but change it to a single thread operationThreading = SearchOperationThreading.SINGLE_THREAD; } - searchScrollRequest.setOperationThreading(operationThreading); + searchScrollRequest.operationThreading(operationThreading); } } catch (Exception e) { try { diff --git a/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java b/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java index ce3490af5ed..dc264b5303d 100644 --- a/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java @@ -56,22 +56,22 @@ public class RestUpdateAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel) { UpdateRequest updateRequest = new UpdateRequest(request.param("index"), request.param("type"), request.param("id")); - updateRequest.setListenerThreaded(false); - updateRequest.setRouting(request.param("routing")); - updateRequest.setParent(request.param("parent")); // order is important, set it after routing, so it will set the routing - updateRequest.setTimeout(request.paramAsTime("timeout", updateRequest.getTimeout())); - updateRequest.setRefresh(request.paramAsBoolean("refresh", updateRequest.isRefresh())); + updateRequest.listenerThreaded(false); + updateRequest.routing(request.param("routing")); + updateRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing + updateRequest.timeout(request.paramAsTime("timeout", updateRequest.timeout())); + updateRequest.refresh(request.paramAsBoolean("refresh", updateRequest.refresh())); String replicationType = request.param("replication"); if (replicationType != null) { - updateRequest.setReplicationType(ReplicationType.fromString(replicationType)); + updateRequest.replicationType(ReplicationType.fromString(replicationType)); } String consistencyLevel = request.param("consistency"); if (consistencyLevel != null) { - updateRequest.setConsistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); + updateRequest.consistencyLevel(WriteConsistencyLevel.fromString(consistencyLevel)); } - updateRequest.setPercolate(request.param("percolate", null)); - updateRequest.setScript(request.param("script")); - updateRequest.setScriptLang(request.param("lang")); + updateRequest.percolate(request.param("percolate", null)); + updateRequest.script(request.param("script")); + updateRequest.scriptLang(request.param("lang")); for (Map.Entry entry : request.params().entrySet()) { if (entry.getKey().startsWith("sp_")) { updateRequest.addScriptParam(entry.getKey().substring(3), entry.getValue()); @@ -81,36 +81,36 @@ public class RestUpdateAction extends BaseRestHandler { if (sField != null) { String[] sFields = Strings.splitStringByCommaToArray(sField); if (sFields != null) { - updateRequest.setFields(sFields); + updateRequest.fields(sFields); } } - updateRequest.setRetryOnConflict(request.paramAsInt("retry_on_conflict", updateRequest.getRetryOnConflict())); + updateRequest.retryOnConflict(request.paramAsInt("retry_on_conflict", updateRequest.retryOnConflict())); // see if we have it in the body if (request.hasContent()) { try { - updateRequest.setSource(request.content()); - IndexRequest upsertRequest = updateRequest.getUpsertRequest(); + updateRequest.source(request.content()); + IndexRequest upsertRequest = updateRequest.upsertRequest(); if (upsertRequest != null) { - upsertRequest.setRouting(request.param("routing")); - upsertRequest.setParent(request.param("parent")); // order is important, set it after routing, so it will set the routing - upsertRequest.setTimestamp(request.param("timestamp")); + upsertRequest.routing(request.param("routing")); + upsertRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing + upsertRequest.timestamp(request.param("timestamp")); if (request.hasParam("ttl")) { - upsertRequest.setTtl(request.paramAsTime("ttl", null).millis()); + upsertRequest.ttl(request.paramAsTime("ttl", null).millis()); } - upsertRequest.setVersion(RestActions.parseVersion(request)); - upsertRequest.setVersionType(VersionType.fromString(request.param("version_type"), upsertRequest.getVersionType())); + upsertRequest.version(RestActions.parseVersion(request)); + upsertRequest.versionType(VersionType.fromString(request.param("version_type"), upsertRequest.versionType())); } - IndexRequest doc = updateRequest.getDoc(); + IndexRequest doc = updateRequest.doc(); if (doc != null) { - doc.setRouting(request.param("routing")); - doc.setParent(request.param("parent")); // order is important, set it after routing, so it will set the routing - doc.setTimestamp(request.param("timestamp")); + doc.routing(request.param("routing")); + doc.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing + doc.timestamp(request.param("timestamp")); if (request.hasParam("ttl")) { - doc.setTtl(request.paramAsTime("ttl", null).millis()); + doc.ttl(request.paramAsTime("ttl", null).millis()); } - doc.setVersion(RestActions.parseVersion(request)); - doc.setVersionType(VersionType.fromString(request.param("version_type"), doc.getVersionType())); + doc.version(RestActions.parseVersion(request)); + doc.versionType(VersionType.fromString(request.param("version_type"), doc.versionType())); } } catch (Exception e) { try { diff --git a/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java b/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java index ba034296f17..fe7cd5248d0 100644 --- a/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java +++ b/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java @@ -53,7 +53,7 @@ import java.util.Map; * A search source builder allowing to easily build search source. Simple construction * using {@link org.elasticsearch.search.builder.SearchSourceBuilder#searchSource()}. * - * @see org.elasticsearch.action.search.SearchRequest#setSource(SearchSourceBuilder) + * @see org.elasticsearch.action.search.SearchRequest#source(SearchSourceBuilder) */ public class SearchSourceBuilder implements ToXContent { diff --git a/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java b/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java index dcda42ec892..5984f44997e 100644 --- a/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java +++ b/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java @@ -44,7 +44,7 @@ public class InternalScrollSearchRequest extends TransportRequest { public InternalScrollSearchRequest(SearchScrollRequest request, long id) { super(request); this.id = id; - this.scroll = request.getScroll(); + this.scroll = request.scroll(); } public InternalScrollSearchRequest(long id) { diff --git a/src/main/java/org/elasticsearch/search/internal/ShardSearchRequest.java b/src/main/java/org/elasticsearch/search/internal/ShardSearchRequest.java index 642893a0e2f..c2c063ec286 100644 --- a/src/main/java/org/elasticsearch/search/internal/ShardSearchRequest.java +++ b/src/main/java/org/elasticsearch/search/internal/ShardSearchRequest.java @@ -79,11 +79,11 @@ public class ShardSearchRequest extends TransportRequest { this.index = shardRouting.index(); this.shardId = shardRouting.id(); this.numberOfShards = numberOfShards; - this.searchType = searchRequest.getSearchType(); - this.source = searchRequest.getSource(); - this.extraSource = searchRequest.getExtraSource(); - this.scroll = searchRequest.getScroll(); - this.types = searchRequest.getTypes(); + this.searchType = searchRequest.searchType(); + this.source = searchRequest.source(); + this.extraSource = searchRequest.extraSource(); + this.scroll = searchRequest.scroll(); + this.types = searchRequest.types(); } diff --git a/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java b/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java index 4c328d052ef..324e3338472 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java @@ -89,7 +89,7 @@ public class SuggestSearchBenchMark { int termCounter = 0; BulkRequestBuilder request = client.prepareBulk(); for (int j = 0; j < BATCH; j++) { - request.add(Requests.indexRequest("test").setType("type1").setId(Integer.toString(idCounter++)).setSource(source("prefix" + character + termCounter++))); + request.add(Requests.indexRequest("test").type("type1").id(Integer.toString(idCounter++)).source(source("prefix" + character + termCounter++))); } character++; BulkResponse response = request.execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java index a2e9478892c..d5aa087c57d 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java @@ -87,12 +87,12 @@ public class ChildSearchBenchmark { BulkRequestBuilder request = client.prepareBulk(); for (int j = 0; j < BATCH; j++) { counter++; - request.add(Requests.indexRequest(indexName).setType("parent").setId(Integer.toString(counter)) - .setSource(parentSource(Integer.toString(counter), "test" + counter))); + request.add(Requests.indexRequest(indexName).type("parent").id(Integer.toString(counter)) + .source(parentSource(Integer.toString(counter), "test" + counter))); for (int k = 0; k < CHILD_COUNT; k++) { - request.add(Requests.indexRequest(indexName).setType("child").setId(Integer.toString(counter) + "_" + k) - .setParent(Integer.toString(counter)) - .setSource(childSource(Integer.toString(counter), "tag" + k))); + request.add(Requests.indexRequest(indexName).type("child").id(Integer.toString(counter) + "_" + k) + .parent(Integer.toString(counter)) + .source(childSource(Integer.toString(counter), "tag" + k))); } } BulkResponse response = request.execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/benchmark/search/facet/HistogramFacetSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/facet/HistogramFacetSearchBenchmark.java index 76750017166..ee0430bf00f 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/facet/HistogramFacetSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/facet/HistogramFacetSearchBenchmark.java @@ -76,7 +76,7 @@ public class HistogramFacetSearchBenchmark { Thread.sleep(10000); try { - client.admin().indices().create(createIndexRequest("test").setSettings( + client.admin().indices().create(createIndexRequest("test").settings( settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 0))) .actionGet(); @@ -95,8 +95,8 @@ public class HistogramFacetSearchBenchmark { .field("l_value", lValues[counter % lValues.length]) .field("date", new Date()) .endObject(); - request.add(Requests.indexRequest("test").setType("type1").setId(Integer.toString(counter)) - .setSource(source)); + request.add(Requests.indexRequest("test").type("type1").id(Integer.toString(counter)) + .source(source)); } BulkResponse response = request.execute().actionGet(); if (response.hasFailures()) { diff --git a/src/test/java/org/elasticsearch/benchmark/search/facet/QueryFilterFacetSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/facet/QueryFilterFacetSearchBenchmark.java index 3a335e4f6e6..579fe6dbb9e 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/facet/QueryFilterFacetSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/facet/QueryFilterFacetSearchBenchmark.java @@ -90,8 +90,8 @@ public class QueryFilterFacetSearchBenchmark { builder.endObject(); - request.add(Requests.indexRequest("test").setType("type1").setId(Integer.toString(counter)) - .setSource(builder)); + request.add(Requests.indexRequest("test").type("type1").id(Integer.toString(counter)) + .source(builder)); } BulkResponse response = request.execute().actionGet(); if (response.hasFailures()) { @@ -160,4 +160,4 @@ public class QueryFilterFacetSearchBenchmark { } System.out.println("--> Query facet first l_value (global) (mode/post) " + (totalQueryTime / QUERY_COUNT) + "ms"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/benchmark/search/facet/TermsFacetSearchBenchmark.java b/src/test/java/org/elasticsearch/benchmark/search/facet/TermsFacetSearchBenchmark.java index fd399717da2..5580644792f 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/facet/TermsFacetSearchBenchmark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/facet/TermsFacetSearchBenchmark.java @@ -123,8 +123,8 @@ public class TermsFacetSearchBenchmark { builder.endObject(); - request.add(Requests.indexRequest("test").setType("type1").setId(Integer.toString(counter)) - .setSource(builder)); + request.add(Requests.indexRequest("test").type("type1").id(Integer.toString(counter)) + .source(builder)); } BulkResponse response = request.execute().actionGet(); if (response.hasFailures()) { diff --git a/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java b/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java index 19c80c560d9..fe7aabe968a 100644 --- a/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java +++ b/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java @@ -98,7 +98,7 @@ public class NestedSearchBenchMark { } doc = doc.endArray(); request.add( - Requests.indexRequest(indexName).setType("type").setId(Integer.toString(counter)).setSource(doc) + Requests.indexRequest(indexName).type("type").id(Integer.toString(counter)).source(doc) ); } BulkResponse response = request.execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/benchmark/stress/NodesStressTest.java b/src/test/java/org/elasticsearch/benchmark/stress/NodesStressTest.java index c31b860d8de..d9fd39ed52a 100644 --- a/src/test/java/org/elasticsearch/benchmark/stress/NodesStressTest.java +++ b/src/test/java/org/elasticsearch/benchmark/stress/NodesStressTest.java @@ -210,7 +210,7 @@ public class NodesStressTest { query = constantScoreQuery(queryFilter(query)); SearchResponse search = client.search(searchRequest() - .setSource(searchSource().query(query))) + .source(searchSource().query(query))) .actionGet(); // System.out.println("Got search response, hits [" + search.hits().totalHits() + "]"); } @@ -247,8 +247,8 @@ public class NodesStressTest { for (; counter < max; counter++) { Client client = client(counter); long id = idGenerator.incrementAndGet(); - client.index(Requests.indexRequest().setIndex("test").setType("type1").setId(Long.toString(id)) - .setSource(XContentFactory.jsonBuilder().startObject() + client.index(Requests.indexRequest().index("test").type("type1").id(Long.toString(id)) + .source(XContentFactory.jsonBuilder().startObject() .field("num", id % fieldNumLimit) .endObject())) .actionGet(); diff --git a/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadBulkStress.java b/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadBulkStress.java index fb0f2c4effd..4bf597c53be 100644 --- a/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadBulkStress.java +++ b/src/test/java/org/elasticsearch/benchmark/stress/SingleThreadBulkStress.java @@ -91,7 +91,7 @@ public class SingleThreadBulkStress { BulkRequestBuilder request = client1.prepareBulk(); for (int j = 0; j < BATCH; j++) { counter++; - request.add(Requests.indexRequest("test").setType("type1").setId(Integer.toString(counter)).setSource(source(Integer.toString(counter), "test" + counter))); + request.add(Requests.indexRequest("test").type("type1").id(Integer.toString(counter)).source(source(Integer.toString(counter), "test" + counter))); } BulkResponse response = request.execute().actionGet(); if (response.hasFailures()) { diff --git a/src/test/java/org/elasticsearch/test/integration/aliases/IndexAliasesTests.java b/src/test/java/org/elasticsearch/test/integration/aliases/IndexAliasesTests.java index 770e3820ed7..e2dafc0c65f 100644 --- a/src/test/java/org/elasticsearch/test/integration/aliases/IndexAliasesTests.java +++ b/src/test/java/org/elasticsearch/test/integration/aliases/IndexAliasesTests.java @@ -108,14 +108,14 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); try { logger.info("--> indexing against [alias1], should fail"); - client1.index(indexRequest("alias1").setType("type1").setId("1").setSource(source("1", "test"))).actionGet(); + client1.index(indexRequest("alias1").type("type1").id("1").source(source("1", "test"))).actionGet(); assert false : "index [alias1] should not exists"; } catch (IndexMissingException e) { assertThat(e.index().name(), equalTo("alias1")); @@ -125,14 +125,14 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().prepareAliases().addAlias("test", "alias1").execute().actionGet(); logger.info("--> indexing against [alias1], should work now"); - IndexResponse indexResponse = client1.index(indexRequest("alias1").setType("type1").setId("1").setSource(source("1", "test"))).actionGet(); + IndexResponse indexResponse = client1.index(indexRequest("alias1").type("type1").id("1").source(source("1", "test"))).actionGet(); assertThat(indexResponse.getIndex(), equalTo("test")); logger.info("--> creating index [test]"); client1.admin().indices().create(createIndexRequest("test_x")).actionGet(); logger.info("--> running cluster_health"); - clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -142,7 +142,7 @@ public class IndexAliasesTests extends AbstractNodesTests { Thread.sleep(300); logger.info("--> indexing against [alias1], should work against [test_x]"); - indexResponse = client1.index(indexRequest("alias1").setType("type1").setId("1").setSource(source("1", "test"))).actionGet(); + indexResponse = client1.index(indexRequest("alias1").type("type1").id("1").source(source("1", "test"))).actionGet(); assertThat(indexResponse.getIndex(), equalTo("test_x")); } @@ -155,7 +155,7 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -178,7 +178,7 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -204,7 +204,7 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -217,10 +217,10 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().prepareAliases().addAlias("test", "tests", termFilter("name", "test")).execute().actionGet(); logger.info("--> indexing against [test]"); - client1.index(indexRequest("test").setType("type1").setId("1").setSource(source("1", "foo test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test").setType("type1").setId("2").setSource(source("2", "bar test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test").setType("type1").setId("3").setSource(source("3", "baz test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test").setType("type1").setId("4").setSource(source("4", "something else")).setRefresh(true)).actionGet(); + client1.index(indexRequest("test").type("type1").id("1").source(source("1", "foo test")).refresh(true)).actionGet(); + client1.index(indexRequest("test").type("type1").id("2").source(source("2", "bar test")).refresh(true)).actionGet(); + client1.index(indexRequest("test").type("type1").id("3").source(source("3", "baz test")).refresh(true)).actionGet(); + client1.index(indexRequest("test").type("type1").id("4").source(source("4", "something else")).refresh(true)).actionGet(); logger.info("--> checking single filtering alias search"); SearchResponse searchResponse = client1.prepareSearch("foos").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); @@ -257,7 +257,7 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test2")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -274,16 +274,16 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().prepareAliases().addAlias("test2", "foos", termFilter("name", "foo")).execute().actionGet(); logger.info("--> indexing against [test1]"); - client1.index(indexRequest("test1").setType("type1").setId("1").setSource(source("1", "foo test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test1").setType("type1").setId("2").setSource(source("2", "bar test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test1").setType("type1").setId("3").setSource(source("3", "baz test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test1").setType("type1").setId("4").setSource(source("4", "something else")).setRefresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("1").source(source("1", "foo test")).refresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("2").source(source("2", "bar test")).refresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("3").source(source("3", "baz test")).refresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("4").source(source("4", "something else")).refresh(true)).actionGet(); logger.info("--> indexing against [test2]"); - client1.index(indexRequest("test2").setType("type1").setId("5").setSource(source("5", "foo test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("6").setSource(source("6", "bar test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("7").setSource(source("7", "baz test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("8").setSource(source("8", "something else")).setRefresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("5").source(source("5", "foo test")).refresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("6").source(source("6", "bar test")).refresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("7").source(source("7", "baz test")).refresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("8").source(source("8", "something else")).refresh(true)).actionGet(); logger.info("--> checking filtering alias for two indices"); SearchResponse searchResponse = client1.prepareSearch("foos").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); @@ -327,7 +327,7 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test3")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -346,17 +346,17 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().prepareAliases().addAlias("test3", "filter13", termFilter("name", "baz")).execute().actionGet(); logger.info("--> indexing against [test1]"); - client1.index(indexRequest("test1").setType("type1").setId("11").setSource(source("11", "foo test1")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test1").setType("type1").setId("12").setSource(source("12", "bar test1")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test1").setType("type1").setId("13").setSource(source("13", "baz test1")).setRefresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("11").source(source("11", "foo test1")).refresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("12").source(source("12", "bar test1")).refresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("13").source(source("13", "baz test1")).refresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("21").setSource(source("21", "foo test2")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("22").setSource(source("22", "bar test2")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("23").setSource(source("23", "baz test2")).setRefresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("21").source(source("21", "foo test2")).refresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("22").source(source("22", "bar test2")).refresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("23").source(source("23", "baz test2")).refresh(true)).actionGet(); - client1.index(indexRequest("test3").setType("type1").setId("31").setSource(source("31", "foo test3")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test3").setType("type1").setId("32").setSource(source("32", "bar test3")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test3").setType("type1").setId("33").setSource(source("33", "baz test3")).setRefresh(true)).actionGet(); + client1.index(indexRequest("test3").type("type1").id("31").source(source("31", "foo test3")).refresh(true)).actionGet(); + client1.index(indexRequest("test3").type("type1").id("32").source(source("32", "bar test3")).refresh(true)).actionGet(); + client1.index(indexRequest("test3").type("type1").id("33").source(source("33", "baz test3")).refresh(true)).actionGet(); logger.info("--> checking filtering alias for multiple indices"); SearchResponse searchResponse = client1.prepareSearch("filter23", "filter13").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); @@ -397,7 +397,7 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test2")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -416,16 +416,16 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().prepareAliases().addAlias("test2", "tests", termFilter("name", "test")).execute().actionGet(); logger.info("--> indexing against [test1]"); - client1.index(indexRequest("test1").setType("type1").setId("1").setSource(source("1", "foo test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test1").setType("type1").setId("2").setSource(source("2", "bar test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test1").setType("type1").setId("3").setSource(source("3", "baz test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test1").setType("type1").setId("4").setSource(source("4", "something else")).setRefresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("1").source(source("1", "foo test")).refresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("2").source(source("2", "bar test")).refresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("3").source(source("3", "baz test")).refresh(true)).actionGet(); + client1.index(indexRequest("test1").type("type1").id("4").source(source("4", "something else")).refresh(true)).actionGet(); logger.info("--> indexing against [test2]"); - client1.index(indexRequest("test2").setType("type1").setId("5").setSource(source("5", "foo test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("6").setSource(source("6", "bar test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("7").setSource(source("7", "baz test")).setRefresh(true)).actionGet(); - client1.index(indexRequest("test2").setType("type1").setId("8").setSource(source("8", "something else")).setRefresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("5").source(source("5", "foo test")).refresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("6").source(source("6", "bar test")).refresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("7").source(source("7", "baz test")).refresh(true)).actionGet(); + client1.index(indexRequest("test2").type("type1").id("8").source(source("8", "something else")).refresh(true)).actionGet(); logger.info("--> checking counts before delete"); assertThat(client1.prepareCount("bars").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(1L)); @@ -463,14 +463,14 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); for (int i = 0; i < 10; i++) { assertThat(client1.admin().indices().prepareAliases().addAlias("test", "alias" + i).execute().actionGet().isAcknowledged(), equalTo(true)); - client2.index(indexRequest("alias" + i).setType("type1").setId("1").setSource(source("1", "test")).setRefresh(true)).actionGet(); + client2.index(indexRequest("alias" + i).type("type1").id("1").source(source("1", "test")).refresh(true)).actionGet(); } } @@ -481,17 +481,17 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().prepareDelete().execute().actionGet(); logger.info("--> creating index [test]"); - client1.admin().indices().create(createIndexRequest("test").setSettings(settingsBuilder().put("index.numberOfReplicas", 0).put("index.numberOfShards", 1))).actionGet(); + client1.admin().indices().create(createIndexRequest("test").settings(settingsBuilder().put("index.numberOfReplicas", 0).put("index.numberOfShards", 1))).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); for (int i = 0; i < 10; i++) { assertThat(getClient().admin().indices().prepareAliases().addAlias("test", "alias" + i).execute().actionGet().isAcknowledged(), equalTo(true)); - getClient().index(indexRequest("alias" + i).setType("type1").setId("1").setSource(source("1", "test")).setRefresh(true)).actionGet(); + getClient().index(indexRequest("alias" + i).type("type1").id("1").source(source("1", "test")).refresh(true)).actionGet(); } } @@ -505,7 +505,7 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -517,7 +517,7 @@ public class IndexAliasesTests extends AbstractNodesTests { @Override public void run() { assertThat(client1.admin().indices().prepareAliases().addAlias("test", aliasName).execute().actionGet().isAcknowledged(), equalTo(true)); - client2.index(indexRequest(aliasName).setType("type1").setId("1").setSource(source("1", "test")).setRefresh(true)).actionGet(); + client2.index(indexRequest(aliasName).type("type1").id("1").source(source("1", "test")).refresh(true)).actionGet(); } }); } @@ -538,7 +538,7 @@ public class IndexAliasesTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test")).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); diff --git a/src/test/java/org/elasticsearch/test/integration/broadcast/BroadcastActionsTests.java b/src/test/java/org/elasticsearch/test/integration/broadcast/BroadcastActionsTests.java index 90b12d6b603..e81f0993789 100644 --- a/src/test/java/org/elasticsearch/test/integration/broadcast/BroadcastActionsTests.java +++ b/src/test/java/org/elasticsearch/test/integration/broadcast/BroadcastActionsTests.java @@ -58,17 +58,17 @@ public class BroadcastActionsTests extends AbstractNodesTests { client("server1").admin().indices().prepareCreate("test").execute().actionGet(5000); logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); - client("server1").index(indexRequest("test").setType("type1").setId("1").setSource(source("1", "test"))).actionGet(); + client("server1").index(indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); FlushResponse flushResponse = client("server1").admin().indices().flush(flushRequest("test")).actionGet(); assertThat(flushResponse.getTotalShards(), equalTo(10)); assertThat(flushResponse.getSuccessfulShards(), equalTo(5)); assertThat(flushResponse.getFailedShards(), equalTo(0)); - client("server1").index(indexRequest("test").setType("type1").setId("2").setSource(source("2", "test"))).actionGet(); + client("server1").index(indexRequest("test").type("type1").id("2").source(source("2", "test"))).actionGet(); RefreshResponse refreshResponse = client("server1").admin().indices().refresh(refreshRequest("test")).actionGet(); assertThat(refreshResponse.getTotalShards(), equalTo(10)); assertThat(refreshResponse.getSuccessfulShards(), equalTo(5)); @@ -78,7 +78,7 @@ public class BroadcastActionsTests extends AbstractNodesTests { // check count for (int i = 0; i < 5; i++) { // test successful - CountResponse countResponse = client("server1").count(countRequest("test").setQuery(termQuery("_type", "type1")).setOperationThreading(BroadcastOperationThreading.NO_THREADS)).actionGet(); + CountResponse countResponse = client("server1").count(countRequest("test").query(termQuery("_type", "type1")).operationThreading(BroadcastOperationThreading.NO_THREADS)).actionGet(); assertThat(countResponse.getCount(), equalTo(2l)); assertThat(countResponse.getTotalShards(), equalTo(5)); assertThat(countResponse.getSuccessfulShards(), equalTo(5)); @@ -86,7 +86,7 @@ public class BroadcastActionsTests extends AbstractNodesTests { } for (int i = 0; i < 5; i++) { - CountResponse countResponse = client("server1").count(countRequest("test").setQuery(termQuery("_type", "type1")).setOperationThreading(BroadcastOperationThreading.SINGLE_THREAD)).actionGet(); + CountResponse countResponse = client("server1").count(countRequest("test").query(termQuery("_type", "type1")).operationThreading(BroadcastOperationThreading.SINGLE_THREAD)).actionGet(); assertThat(countResponse.getCount(), equalTo(2l)); assertThat(countResponse.getTotalShards(), equalTo(5)); assertThat(countResponse.getSuccessfulShards(), equalTo(5)); @@ -94,7 +94,7 @@ public class BroadcastActionsTests extends AbstractNodesTests { } for (int i = 0; i < 5; i++) { - CountResponse countResponse = client("server1").count(countRequest("test").setQuery(termQuery("_type", "type1")).setOperationThreading(BroadcastOperationThreading.THREAD_PER_SHARD)).actionGet(); + CountResponse countResponse = client("server1").count(countRequest("test").query(termQuery("_type", "type1")).operationThreading(BroadcastOperationThreading.THREAD_PER_SHARD)).actionGet(); assertThat(countResponse.getCount(), equalTo(2l)); assertThat(countResponse.getTotalShards(), equalTo(5)); assertThat(countResponse.getSuccessfulShards(), equalTo(5)); @@ -103,7 +103,7 @@ public class BroadcastActionsTests extends AbstractNodesTests { for (int i = 0; i < 5; i++) { // test failed (simply query that can't be parsed) - CountResponse countResponse = client("server1").count(countRequest("test").setQuery(Unicode.fromStringAsBytes("{ term : { _type : \"type1 } }"))).actionGet(); + CountResponse countResponse = client("server1").count(countRequest("test").query(Unicode.fromStringAsBytes("{ term : { _type : \"type1 } }"))).actionGet(); assertThat(countResponse.getCount(), equalTo(0l)); assertThat(countResponse.getTotalShards(), equalTo(5)); diff --git a/src/test/java/org/elasticsearch/test/integration/cluster/MinimumMasterNodesTests.java b/src/test/java/org/elasticsearch/test/integration/cluster/MinimumMasterNodesTests.java index 42a44332da4..4d48a9dd27e 100644 --- a/src/test/java/org/elasticsearch/test/integration/cluster/MinimumMasterNodesTests.java +++ b/src/test/java/org/elasticsearch/test/integration/cluster/MinimumMasterNodesTests.java @@ -137,7 +137,7 @@ public class MinimumMasterNodesTests extends AbstractZenNodesTests { assertThat(state.metaData().indices().containsKey("test"), equalTo(true)); logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -175,7 +175,7 @@ public class MinimumMasterNodesTests extends AbstractZenNodesTests { assertThat(state.metaData().indices().containsKey("test"), equalTo(true)); logger.info("Running Cluster Health"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -271,7 +271,7 @@ public class MinimumMasterNodesTests extends AbstractZenNodesTests { assertThat(clusterHealthResponse.isTimedOut(), equalTo(false)); logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -284,4 +284,4 @@ public class MinimumMasterNodesTests extends AbstractZenNodesTests { assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getCount(), equalTo(100l)); } } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/test/integration/cluster/SimpleDataNodesTests.java b/src/test/java/org/elasticsearch/test/integration/cluster/SimpleDataNodesTests.java index ec12a5d1bbf..468ff7b1452 100644 --- a/src/test/java/org/elasticsearch/test/integration/cluster/SimpleDataNodesTests.java +++ b/src/test/java/org/elasticsearch/test/integration/cluster/SimpleDataNodesTests.java @@ -47,7 +47,7 @@ public class SimpleDataNodesTests extends AbstractNodesTests { startNode("nonData1", settingsBuilder().put("node.data", false).build()); client("nonData1").admin().indices().create(createIndexRequest("test")).actionGet(); try { - client("nonData1").index(Requests.indexRequest("test").setType("type1").setId("1").setSource(source("1", "test")).setTimeout(timeValueSeconds(1))).actionGet(); + client("nonData1").index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test")).timeout(timeValueSeconds(1))).actionGet(); assert false : "no allocation should happen"; } catch (UnavailableShardsException e) { // all is well @@ -58,7 +58,7 @@ public class SimpleDataNodesTests extends AbstractNodesTests { // still no shard should be allocated try { - client("nonData2").index(Requests.indexRequest("test").setType("type1").setId("1").setSource(source("1", "test")).setTimeout(timeValueSeconds(1))).actionGet(); + client("nonData2").index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test")).timeout(timeValueSeconds(1))).actionGet(); assert false : "no allocation should happen"; } catch (UnavailableShardsException e) { // all is well @@ -68,7 +68,7 @@ public class SimpleDataNodesTests extends AbstractNodesTests { startNode("data1", settingsBuilder().put("node.data", true).build()); assertThat(client("nonData1").admin().cluster().prepareHealth().setWaitForNodes("3").execute().actionGet().isTimedOut(), equalTo(false)); - IndexResponse indexResponse = client("nonData2").index(Requests.indexRequest("test").setType("type1").setId("1").setSource(source("1", "test"))).actionGet(); + IndexResponse indexResponse = client("nonData2").index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); assertThat(indexResponse.getId(), equalTo("1")); assertThat(indexResponse.getType(), equalTo("type1")); } diff --git a/src/test/java/org/elasticsearch/test/integration/document/AliasedIndexDocumentActionsTests.java b/src/test/java/org/elasticsearch/test/integration/document/AliasedIndexDocumentActionsTests.java index 930d0a5031d..db8ee2430ab 100644 --- a/src/test/java/org/elasticsearch/test/integration/document/AliasedIndexDocumentActionsTests.java +++ b/src/test/java/org/elasticsearch/test/integration/document/AliasedIndexDocumentActionsTests.java @@ -38,7 +38,7 @@ public class AliasedIndexDocumentActionsTests extends DocumentActionsTests { // ignore } logger.info("--> creating index test"); - client1.admin().indices().create(createIndexRequest("test1").setSettings(settingsBuilder().putArray("index.aliases", "test"))).actionGet(); + client1.admin().indices().create(createIndexRequest("test1").settings(settingsBuilder().putArray("index.aliases", "test"))).actionGet(); } @Override @@ -50,4 +50,4 @@ public class AliasedIndexDocumentActionsTests extends DocumentActionsTests { protected Settings nodeSettings() { return ImmutableSettings.settingsBuilder().put("action.auto_create_index", false).build(); } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/test/integration/document/DocumentActionsTests.java b/src/test/java/org/elasticsearch/test/integration/document/DocumentActionsTests.java index e12d7d27a6b..b1edd924a26 100644 --- a/src/test/java/org/elasticsearch/test/integration/document/DocumentActionsTests.java +++ b/src/test/java/org/elasticsearch/test/integration/document/DocumentActionsTests.java @@ -116,7 +116,7 @@ public class DocumentActionsTests extends AbstractNodesTests { public void testIndexActions() throws Exception { createIndex(); logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -157,7 +157,7 @@ public class DocumentActionsTests extends AbstractNodesTests { assertThat(getResult.getIndex(), equalTo(getConcreteIndexName())); assertThat("cycle #" + i, getResult.getSourceAsString(), equalTo(source("1", "test").string())); assertThat("cycle(map) #" + i, (String) ((Map) getResult.getSourceAsMap().get("type1")).get("name"), equalTo("test")); - getResult = client1.get(getRequest("test").setType("type1").setId("1").setOperationThreaded(true)).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id("1").operationThreaded(true)).actionGet(); assertThat("cycle #" + i, getResult.getSourceAsString(), equalTo(source("1", "test").string())); assertThat(getResult.getIndex(), equalTo(getConcreteIndexName())); } @@ -173,7 +173,7 @@ public class DocumentActionsTests extends AbstractNodesTests { logger.info("Get [type1/2] (should be empty)"); for (int i = 0; i < 5; i++) { - getResult = client1.get(getRequest("test").setType("type1").setId("2")).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id("2")).actionGet(); assertThat(getResult.isExists(), equalTo(false)); } @@ -187,14 +187,14 @@ public class DocumentActionsTests extends AbstractNodesTests { logger.info("Get [type1/1] (should be empty)"); for (int i = 0; i < 5; i++) { - getResult = client1.get(getRequest("test").setType("type1").setId("1")).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id("1")).actionGet(); assertThat(getResult.isExists(), equalTo(false)); } logger.info("Index [type1/1]"); - client1.index(indexRequest("test").setType("type1").setId("1").setSource(source("1", "test"))).actionGet(); + client1.index(indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); logger.info("Index [type1/2]"); - client1.index(indexRequest("test").setType("type1").setId("2").setSource(source("2", "test2"))).actionGet(); + client1.index(indexRequest("test").type("type1").id("2").source(source("2", "test2"))).actionGet(); logger.info("Flushing"); FlushResponse flushResult = client1.admin().indices().prepareFlush("test").execute().actionGet(); @@ -205,10 +205,10 @@ public class DocumentActionsTests extends AbstractNodesTests { logger.info("Get [type1/1] and [type1/2]"); for (int i = 0; i < 5; i++) { - getResult = client1.get(getRequest("test").setType("type1").setId("1")).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id("1")).actionGet(); assertThat(getResult.getIndex(), equalTo(getConcreteIndexName())); assertThat("cycle #" + i, getResult.getSourceAsString(), equalTo(source("1", "test").string())); - getResult = client1.get(getRequest("test").setType("type1").setId("2")).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id("2")).actionGet(); String ste1 = getResult.getSourceAsString(); String ste2 = source("2", "test2").string(); assertThat("cycle #" + i, ste1, equalTo(ste2)); @@ -225,18 +225,18 @@ public class DocumentActionsTests extends AbstractNodesTests { assertThat(countResponse.getSuccessfulShards(), equalTo(5)); assertThat(countResponse.getFailedShards(), equalTo(0)); - countResponse = client1.count(countRequest("test").setQuery(termQuery("_type", "type1")).setOperationThreading(BroadcastOperationThreading.SINGLE_THREAD)).actionGet(); + countResponse = client1.count(countRequest("test").query(termQuery("_type", "type1")).operationThreading(BroadcastOperationThreading.SINGLE_THREAD)).actionGet(); assertThat(countResponse.getCount(), equalTo(2l)); assertThat(countResponse.getSuccessfulShards(), equalTo(5)); assertThat(countResponse.getFailedShards(), equalTo(0)); - countResponse = client1.count(countRequest("test").setQuery(termQuery("_type", "type1")).setOperationThreading(BroadcastOperationThreading.THREAD_PER_SHARD)).actionGet(); + countResponse = client1.count(countRequest("test").query(termQuery("_type", "type1")).operationThreading(BroadcastOperationThreading.THREAD_PER_SHARD)).actionGet(); assertThat(countResponse.getCount(), equalTo(2l)); assertThat(countResponse.getSuccessfulShards(), equalTo(5)); assertThat(countResponse.getFailedShards(), equalTo(0)); // test failed (simply query that can't be parsed) - countResponse = client1.count(countRequest("test").setQuery(Unicode.fromStringAsBytes("{ term : { _type : \"type1 } }"))).actionGet(); + countResponse = client1.count(countRequest("test").query(Unicode.fromStringAsBytes("{ term : { _type : \"type1 } }"))).actionGet(); assertThat(countResponse.getCount(), equalTo(0l)); assertThat(countResponse.getSuccessfulShards(), equalTo(0)); @@ -258,10 +258,10 @@ public class DocumentActionsTests extends AbstractNodesTests { logger.info("Get [type1/1] and [type1/2], should be empty"); for (int i = 0; i < 5; i++) { - getResult = client1.get(getRequest("test").setType("type1").setId("1")).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id("1")).actionGet(); assertThat(getResult.getIndex(), equalTo(getConcreteIndexName())); assertThat("cycle #" + i, getResult.getSourceAsString(), equalTo(source("1", "test").string())); - getResult = client1.get(getRequest("test").setType("type1").setId("2")).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id("2")).actionGet(); assertThat("cycle #" + i, getResult.isExists(), equalTo(false)); assertThat(getResult.getIndex(), equalTo(getConcreteIndexName())); } @@ -271,7 +271,7 @@ public class DocumentActionsTests extends AbstractNodesTests { public void testBulk() throws Exception { createIndex(); logger.info("-> running Cluster Health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -322,15 +322,15 @@ public class DocumentActionsTests extends AbstractNodesTests { for (int i = 0; i < 5; i++) { - GetResponse getResult = client1.get(getRequest("test").setType("type1").setId("1")).actionGet(); + GetResponse getResult = client1.get(getRequest("test").type("type1").id("1")).actionGet(); assertThat(getResult.getIndex(), equalTo(getConcreteIndexName())); assertThat("cycle #" + i, getResult.isExists(), equalTo(false)); - getResult = client1.get(getRequest("test").setType("type1").setId("2")).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id("2")).actionGet(); assertThat("cycle #" + i, getResult.getSourceAsString(), equalTo(source("2", "test").string())); assertThat(getResult.getIndex(), equalTo(getConcreteIndexName())); - getResult = client1.get(getRequest("test").setType("type1").setId(generatedId3)).actionGet(); + getResult = client1.get(getRequest("test").type("type1").id(generatedId3)).actionGet(); assertThat("cycle #" + i, getResult.getSourceAsString(), equalTo(source("3", "test").string())); assertThat(getResult.getIndex(), equalTo(getConcreteIndexName())); } diff --git a/src/test/java/org/elasticsearch/test/integration/gateway/fs/AbstractSimpleIndexGatewayTests.java b/src/test/java/org/elasticsearch/test/integration/gateway/fs/AbstractSimpleIndexGatewayTests.java index 9894e932be7..933181b53f7 100644 --- a/src/test/java/org/elasticsearch/test/integration/gateway/fs/AbstractSimpleIndexGatewayTests.java +++ b/src/test/java/org/elasticsearch/test/integration/gateway/fs/AbstractSimpleIndexGatewayTests.java @@ -73,7 +73,7 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests logger.info("Running Cluster Health (waiting for node to startup properly)"); - ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -93,16 +93,16 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests // create two and delete the first logger.info("Indexing #1"); - client("server1").index(Requests.indexRequest("test").setType("type1").setId("1").setSource(source("1", "test"))).actionGet(); + client("server1").index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); logger.info("Indexing #2"); - client("server1").index(Requests.indexRequest("test").setType("type1").setId("2").setSource(source("2", "test"))).actionGet(); + client("server1").index(Requests.indexRequest("test").type("type1").id("2").source(source("2", "test"))).actionGet(); // perform snapshot to the index logger.info("Gateway Snapshot"); client("server1").admin().indices().gatewaySnapshot(gatewaySnapshotRequest("test")).actionGet(); logger.info("Deleting #1"); - client("server1").delete(deleteRequest("test").setType("type1").setId("1")).actionGet(); + client("server1").delete(deleteRequest("test").type("type1").id("1")).actionGet(); // perform snapshot to the index logger.info("Gateway Snapshot"); @@ -117,7 +117,7 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests startNode("server1"); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -127,17 +127,17 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests assertThat(clusterState.getState().metaData().index("test").mapping("type1"), notNullValue()); logger.info("Getting #1, should not exists"); - GetResponse getResponse = client("server1").get(getRequest("test").setType("type1").setId("1")).actionGet(); + GetResponse getResponse = client("server1").get(getRequest("test").type("type1").id("1")).actionGet(); assertThat(getResponse.isExists(), equalTo(false)); logger.info("Getting #2"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("2")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("2")).actionGet(); assertThat(getResponse.getSourceAsString(), equalTo(source("2", "test"))); // Now flush and add some data (so we have index recovery as well) logger.info("Flushing, so we have actual content in the index files (#2 should be in the index)"); client("server1").admin().indices().flush(flushRequest("test")).actionGet(); logger.info("Indexing #3, so we have something in the translog as well"); - client("server1").index(Requests.indexRequest("test").setType("type1").setId("3").setSource(source("3", "test"))).actionGet(); + client("server1").index(Requests.indexRequest("test").type("type1").id("3").source(source("3", "test"))).actionGet(); logger.info("Gateway Snapshot"); client("server1").admin().indices().gatewaySnapshot(gatewaySnapshotRequest("test")).actionGet(); @@ -150,19 +150,19 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests startNode("server1"); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); logger.info("Getting #1, should not exists"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("1")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("1")).actionGet(); assertThat(getResponse.isExists(), equalTo(false)); logger.info("Getting #2 (not from the translog, but from the index)"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("2")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("2")).actionGet(); assertThat(getResponse.getSourceAsString(), equalTo(source("2", "test"))); logger.info("Getting #3 (from the translog)"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("3")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("3")).actionGet(); assertThat(getResponse.getSourceAsString(), equalTo(source("3", "test"))); logger.info("Closing the server"); @@ -173,19 +173,19 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests startNode("server1"); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); logger.info("Getting #1, should not exists"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("1")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("1")).actionGet(); assertThat(getResponse.isExists(), equalTo(false)); logger.info("Getting #2 (not from the translog, but from the index)"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("2")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("2")).actionGet(); assertThat(getResponse.getSourceAsString(), equalTo(source("2", "test"))); logger.info("Getting #3 (from the translog)"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("3")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("3")).actionGet(); assertThat(getResponse.getSourceAsString(), equalTo(source("3", "test"))); @@ -203,19 +203,19 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests startNode("server1"); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); logger.info("Getting #1, should not exists"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("1")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("1")).actionGet(); assertThat(getResponse.isExists(), equalTo(false)); logger.info("Getting #2 (not from the translog, but from the index)"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("2")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("2")).actionGet(); assertThat(getResponse.getSourceAsString(), equalTo(source("2", "test"))); logger.info("Getting #3 (not from the translog, but from the index)"); - getResponse = client("server1").get(getRequest("test").setType("type1").setId("3")).actionGet(); + getResponse = client("server1").get(getRequest("test").type("type1").id("3")).actionGet(); assertThat(getResponse.getSourceAsString(), equalTo(source("3", "test"))); logger.info("Deleting the index"); @@ -240,7 +240,7 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests startNode("server1"); logger.info("Running Cluster Health (waiting for node to startup properly)"); - ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -252,7 +252,7 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests client("server1").admin().indices().prepareCreate("test").execute().actionGet(); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -294,7 +294,7 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests startNode("server1"); logger.info("--> running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("--> done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -324,4 +324,4 @@ public abstract class AbstractSimpleIndexGatewayTests extends AbstractNodesTests private String source(String id, String nameValue) { return "{ type1 : { \"id\" : \"" + id + "\", \"name\" : \"" + nameValue + "\" } }"; } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/test/integration/gateway/fs/FsMetaDataGatewayTests.java b/src/test/java/org/elasticsearch/test/integration/gateway/fs/FsMetaDataGatewayTests.java index 8dde18dc558..cd9260bc2ff 100644 --- a/src/test/java/org/elasticsearch/test/integration/gateway/fs/FsMetaDataGatewayTests.java +++ b/src/test/java/org/elasticsearch/test/integration/gateway/fs/FsMetaDataGatewayTests.java @@ -60,7 +60,7 @@ public class FsMetaDataGatewayTests extends AbstractNodesTests { startNode("server1"); logger.info("Running Cluster Health (waiting for node to startup properly)"); - ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); diff --git a/src/test/java/org/elasticsearch/test/integration/gateway/local/QuorumLocalGatewayTests.java b/src/test/java/org/elasticsearch/test/integration/gateway/local/QuorumLocalGatewayTests.java index 69ded48dbaa..c02b9df0c2b 100644 --- a/src/test/java/org/elasticsearch/test/integration/gateway/local/QuorumLocalGatewayTests.java +++ b/src/test/java/org/elasticsearch/test/integration/gateway/local/QuorumLocalGatewayTests.java @@ -75,7 +75,7 @@ public class QuorumLocalGatewayTests extends AbstractNodesTests { node1.client().admin().indices().prepareRefresh().execute().actionGet(); logger.info("--> running cluster_health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(6)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(6)).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -100,7 +100,7 @@ public class QuorumLocalGatewayTests extends AbstractNodesTests { client("node1").admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder().put("recovery.initial_shards", 1)).execute().actionGet(); logger.info("--> running cluster_health (wait for the shards to startup), 4 shards since we only have 2 nodes"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(4)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(4)).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -131,7 +131,7 @@ public class QuorumLocalGatewayTests extends AbstractNodesTests { node1.client().admin().indices().prepareRefresh().execute().actionGet(); logger.info("--> running cluster_health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(6)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(6)).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -144,7 +144,7 @@ public class QuorumLocalGatewayTests extends AbstractNodesTests { closeNode("node1"); logger.info("--> running cluster_health (wait for the shards to startup)"); - clusterHealth = client("node2").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForNodes("2").setWaitForActiveShards(4)).actionGet(); + clusterHealth = client("node2").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForNodes("2").waitForActiveShards(4)).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -167,7 +167,7 @@ public class QuorumLocalGatewayTests extends AbstractNodesTests { node2 = startNode("node3", settingsBuilder().put("gateway.type", "local").build()); logger.info("--> running cluster_health (wait for the shards to startup)"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(6)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(6)).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); diff --git a/src/test/java/org/elasticsearch/test/integration/gateway/local/SimpleRecoveryLocalGatewayTests.java b/src/test/java/org/elasticsearch/test/integration/gateway/local/SimpleRecoveryLocalGatewayTests.java index 524d98dadee..f92d8c9828c 100644 --- a/src/test/java/org/elasticsearch/test/integration/gateway/local/SimpleRecoveryLocalGatewayTests.java +++ b/src/test/java/org/elasticsearch/test/integration/gateway/local/SimpleRecoveryLocalGatewayTests.java @@ -90,7 +90,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build()); logger.info("Running Cluster Health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -102,7 +102,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build()); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -134,7 +134,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build()); logger.info("Running Cluster Health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -150,7 +150,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build()); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -181,7 +181,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build()); logger.info("Running Cluster Health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -194,7 +194,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node1 = startNode("node1", settingsBuilder().put("gateway.type", "local").build()); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -220,7 +220,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node1.client().admin().indices().prepareRefresh().execute().actionGet(); logger.info("Running Cluster Health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(2)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(2)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -241,7 +241,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node2 = startNode("node2", settingsBuilder().put("gateway.type", "local").put("gateway.recover_after_nodes", 2).build()); logger.info("Running Cluster Health (wait for the shards to startup)"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(2)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(2)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -267,7 +267,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node1.client().admin().indices().prepareRefresh().execute().actionGet(); logger.info("--> running cluster_health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(2)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(2)).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -310,7 +310,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { node2 = startNode("node2", settingsBuilder().put("gateway.type", "local").put("gateway.recover_after_nodes", 2).build()); logger.info("--> running cluster_health (wait for the shards to startup)"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(2)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(2)).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -352,7 +352,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { } } logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForRelocatingShards(0)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForRelocatingShards(0)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -371,7 +371,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { startNode("node4", settings); logger.info("Running Cluster Health"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(10)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(10)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -390,7 +390,7 @@ public class SimpleRecoveryLocalGatewayTests extends AbstractNodesTests { startNode("node4", settings); logger.info("Running Cluster Health"); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForActiveShards(10)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForActiveShards(10)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); diff --git a/src/test/java/org/elasticsearch/test/integration/get/GetActionTests.java b/src/test/java/org/elasticsearch/test/integration/get/GetActionTests.java index b0b2c142133..3556d046a54 100644 --- a/src/test/java/org/elasticsearch/test/integration/get/GetActionTests.java +++ b/src/test/java/org/elasticsearch/test/integration/get/GetActionTests.java @@ -67,7 +67,7 @@ public class GetActionTests extends AbstractNodesTests { client.admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)).execute().actionGet(); - ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -160,7 +160,7 @@ public class GetActionTests extends AbstractNodesTests { } client.admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)).execute().actionGet(); - ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -194,8 +194,8 @@ public class GetActionTests extends AbstractNodesTests { // multi get with specific field response = client.prepareMultiGet() - .add(new MultiGetRequest.Item("test", "type1", "1").setFields("field")) - .add(new MultiGetRequest.Item("test", "type1", "3").setFields("field")) + .add(new MultiGetRequest.Item("test", "type1", "1").fields("field")) + .add(new MultiGetRequest.Item("test", "type1", "3").fields("field")) .execute().actionGet(); assertThat(response.getResponses().length, equalTo(2)); @@ -211,7 +211,7 @@ public class GetActionTests extends AbstractNodesTests { .addMapping("type", jsonBuilder().startObject().startObject("type").startObject("_source").field("compress", true).endObject().endObject().endObject()) .execute().actionGet(); - ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -245,7 +245,7 @@ public class GetActionTests extends AbstractNodesTests { .endObject().endObject()) .execute().actionGet(); - ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -313,7 +313,7 @@ public class GetActionTests extends AbstractNodesTests { .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)) .execute().actionGet(); - ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -381,4 +381,4 @@ public class GetActionTests extends AbstractNodesTests { assertThat(((List) response.getFields().get("field").getValues().get(0)).get(1).toString(), equalTo("2")); } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java b/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java index 2409f050a62..78f74d9531f 100644 --- a/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java +++ b/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java @@ -97,7 +97,7 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { ClusterService clusterService2 = ((InternalNode) node("server2")).injector().getInstance(ClusterService.class); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForNodes("2")).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForNodes("2")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -121,7 +121,7 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { ClusterService clusterService3 = ((InternalNode) node("server3")).injector().getInstance(ClusterService.class); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForNodes("3").setWaitForRelocatingShards(0)).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForNodes("3").waitForRelocatingShards(0)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -151,7 +151,7 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { closeNode("server1"); // verify health logger.info("Running Cluster Health"); - clusterHealth = client("server2").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForRelocatingShards(0).setWaitForNodes("2")).actionGet(); + clusterHealth = client("server2").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForRelocatingShards(0).waitForNodes("2")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -208,7 +208,7 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { assertThat(createIndexResponse.isAcknowledged(), equalTo(true)); logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -226,7 +226,7 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { Thread.sleep(200); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForRelocatingShards(0).setWaitForNodes("2")).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForRelocatingShards(0).waitForNodes("2")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -255,7 +255,7 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { ClusterService clusterService3 = ((InternalNode) node("server3")).injector().getInstance(ClusterService.class); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForRelocatingShards(0).setWaitForNodes("3")).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForRelocatingShards(0).waitForNodes("3")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -285,7 +285,7 @@ public class IndexLifecycleActionTests extends AbstractNodesTests { closeNode("server1"); logger.info("Running Cluster Health"); - clusterHealth = client("server3").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForNodes("2").setWaitForRelocatingShards(0)).actionGet(); + clusterHealth = client("server3").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForNodes("2").waitForRelocatingShards(0)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); diff --git a/src/test/java/org/elasticsearch/test/integration/indices/store/IndicesStoreTests.java b/src/test/java/org/elasticsearch/test/integration/indices/store/IndicesStoreTests.java index 577d868d47c..e440a0ae8bc 100644 --- a/src/test/java/org/elasticsearch/test/integration/indices/store/IndicesStoreTests.java +++ b/src/test/java/org/elasticsearch/test/integration/indices/store/IndicesStoreTests.java @@ -74,10 +74,10 @@ public class IndicesStoreTests extends AbstractNodesTests { logger.info("--> creating index [test] with one shard and on replica"); client1.admin().indices().create(createIndexRequest("test") - .setSettings(settingsBuilder().put("index.numberOfReplicas", 1).put("index.numberOfShards", 1))).actionGet(); + .settings(settingsBuilder().put("index.numberOfReplicas", 1).put("index.numberOfShards", 1))).actionGet(); logger.info("--> running cluster_health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); assertThat(clusterHealth.isTimedOut(), equalTo(false)); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); @@ -98,7 +98,7 @@ public class IndicesStoreTests extends AbstractNodesTests { assertThat(server2Shard.exists(), equalTo(true)); logger.info("--> running cluster_health"); - clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForNodes("2")).actionGet(); + clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForNodes("2")).actionGet(); assertThat(clusterHealth.isTimedOut(), equalTo(false)); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); @@ -111,7 +111,7 @@ public class IndicesStoreTests extends AbstractNodesTests { startNode("server2"); logger.info("--> running cluster_health"); - clusterHealth = client("server2").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + clusterHealth = client("server2").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); assertThat(clusterHealth.isTimedOut(), equalTo(false)); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); diff --git a/src/test/java/org/elasticsearch/test/integration/mlt/MoreLikeThisActionTests.java b/src/test/java/org/elasticsearch/test/integration/mlt/MoreLikeThisActionTests.java index b8b5eae4882..b4dc4a9fda3 100644 --- a/src/test/java/org/elasticsearch/test/integration/mlt/MoreLikeThisActionTests.java +++ b/src/test/java/org/elasticsearch/test/integration/mlt/MoreLikeThisActionTests.java @@ -79,18 +79,18 @@ public class MoreLikeThisActionTests extends AbstractNodesTests { client1.admin().indices().create(createIndexRequest("test")).actionGet(); logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); logger.info("Indexing..."); - client1.index(indexRequest("test").setType("type1").setId("1").setSource(jsonBuilder().startObject().field("text", "lucene").endObject())).actionGet(); - client1.index(indexRequest("test").setType("type1").setId("2").setSource(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet(); + client1.index(indexRequest("test").type("type1").id("1").source(jsonBuilder().startObject().field("text", "lucene").endObject())).actionGet(); + client1.index(indexRequest("test").type("type1").id("2").source(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet(); client1.admin().indices().refresh(refreshRequest()).actionGet(); logger.info("Running moreLikeThis"); - SearchResponse mltResponse = client1.moreLikeThis(moreLikeThisRequest("test").setType("type1").setId("1").setMinTermFreq(1).setMinDocFreq(1)).actionGet(); + SearchResponse mltResponse = client1.moreLikeThis(moreLikeThisRequest("test").type("type1").id("1").minTermFreq(1).minDocFreq(1)).actionGet(); assertThat(mltResponse.getSuccessfulShards(), equalTo(5)); assertThat(mltResponse.getFailedShards(), equalTo(0)); assertThat(mltResponse.getHits().totalHits(), equalTo(1l)); @@ -111,29 +111,29 @@ public class MoreLikeThisActionTests extends AbstractNodesTests { client1.admin().indices().aliases(indexAliasesRequest().addAlias("test", "beta", termFilter("text", "beta"))).actionGet(); logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); logger.info("Indexing..."); - client1.index(indexRequest("test").setType("type1").setId("1").setSource(jsonBuilder().startObject().field("text", "lucene beta").endObject())).actionGet(); - client1.index(indexRequest("test").setType("type1").setId("2").setSource(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet(); - client1.index(indexRequest("test").setType("type1").setId("3").setSource(jsonBuilder().startObject().field("text", "elasticsearch beta").endObject())).actionGet(); - client1.index(indexRequest("test").setType("type1").setId("4").setSource(jsonBuilder().startObject().field("text", "elasticsearch release").endObject())).actionGet(); + client1.index(indexRequest("test").type("type1").id("1").source(jsonBuilder().startObject().field("text", "lucene beta").endObject())).actionGet(); + client1.index(indexRequest("test").type("type1").id("2").source(jsonBuilder().startObject().field("text", "lucene release").endObject())).actionGet(); + client1.index(indexRequest("test").type("type1").id("3").source(jsonBuilder().startObject().field("text", "elasticsearch beta").endObject())).actionGet(); + client1.index(indexRequest("test").type("type1").id("4").source(jsonBuilder().startObject().field("text", "elasticsearch release").endObject())).actionGet(); client1.admin().indices().refresh(refreshRequest()).actionGet(); logger.info("Running moreLikeThis on index"); - SearchResponse mltResponse = client1.moreLikeThis(moreLikeThisRequest("test").setType("type1").setId("1").setMinTermFreq(1).setMinDocFreq(1)).actionGet(); + SearchResponse mltResponse = client1.moreLikeThis(moreLikeThisRequest("test").type("type1").id("1").minTermFreq(1).minDocFreq(1)).actionGet(); assertThat(mltResponse.getHits().totalHits(), equalTo(2l)); logger.info("Running moreLikeThis on beta shard"); - mltResponse = client1.moreLikeThis(moreLikeThisRequest("beta").setType("type1").setId("1").setMinTermFreq(1).setMinDocFreq(1)).actionGet(); + mltResponse = client1.moreLikeThis(moreLikeThisRequest("beta").type("type1").id("1").minTermFreq(1).minDocFreq(1)).actionGet(); assertThat(mltResponse.getHits().totalHits(), equalTo(1l)); assertThat(mltResponse.getHits().getAt(0).id(), equalTo("3")); logger.info("Running moreLikeThis on release shard"); - mltResponse = client1.moreLikeThis(moreLikeThisRequest("test").setType("type1").setId("1").setMinTermFreq(1).setMinDocFreq(1).setSearchIndices("release")).actionGet(); + mltResponse = client1.moreLikeThis(moreLikeThisRequest("test").type("type1").id("1").minTermFreq(1).minDocFreq(1).searchIndices("release")).actionGet(); assertThat(mltResponse.getHits().totalHits(), equalTo(1l)); assertThat(mltResponse.getHits().getAt(0).id(), equalTo("2")); } diff --git a/src/test/java/org/elasticsearch/test/integration/nodesinfo/SimpleNodesInfoTests.java b/src/test/java/org/elasticsearch/test/integration/nodesinfo/SimpleNodesInfoTests.java index e9f7aeb15f0..cd1b43e3d65 100644 --- a/src/test/java/org/elasticsearch/test/integration/nodesinfo/SimpleNodesInfoTests.java +++ b/src/test/java/org/elasticsearch/test/integration/nodesinfo/SimpleNodesInfoTests.java @@ -48,7 +48,7 @@ public class SimpleNodesInfoTests extends AbstractNodesTests { startNode("server1"); startNode("server2"); - ClusterHealthResponse clusterHealth = client("server2").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("server2").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("--> done cluster_health, status " + clusterHealth.getStatus()); String server1NodeId = ((InternalNode) node("server1")).injector().getInstance(ClusterService.class).state().nodes().localNodeId(); diff --git a/src/test/java/org/elasticsearch/test/integration/percolator/RecoveryPercolatorTests.java b/src/test/java/org/elasticsearch/test/integration/percolator/RecoveryPercolatorTests.java index 77e83a01a42..495cf3c4c91 100644 --- a/src/test/java/org/elasticsearch/test/integration/percolator/RecoveryPercolatorTests.java +++ b/src/test/java/org/elasticsearch/test/integration/percolator/RecoveryPercolatorTests.java @@ -89,7 +89,7 @@ public class RecoveryPercolatorTests extends AbstractNodesTests { client = client("node1"); logger.info("Running Cluster Health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -137,7 +137,7 @@ public class RecoveryPercolatorTests extends AbstractNodesTests { client = client("node1"); logger.info("Running Cluster Health (wait for the shards to startup)"); - ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -146,7 +146,7 @@ public class RecoveryPercolatorTests extends AbstractNodesTests { client.admin().indices().prepareDelete("test").execute().actionGet(); client.admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet(); - clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus().setWaitForActiveShards(1)).actionGet(); + clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -176,4 +176,4 @@ public class RecoveryPercolatorTests extends AbstractNodesTests { .execute().actionGet(); assertThat(percolate.getMatches().size(), equalTo(1)); } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/test/integration/recovery/SimpleRecoveryTests.java b/src/test/java/org/elasticsearch/test/integration/recovery/SimpleRecoveryTests.java index 3ff297ac524..29d50e56453 100644 --- a/src/test/java/org/elasticsearch/test/integration/recovery/SimpleRecoveryTests.java +++ b/src/test/java/org/elasticsearch/test/integration/recovery/SimpleRecoveryTests.java @@ -55,17 +55,17 @@ public class SimpleRecoveryTests extends AbstractNodesTests { client("server1").admin().indices().create(createIndexRequest("test")).actionGet(5000); logger.info("Running Cluster Health"); - ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForYellowStatus()).actionGet(); + ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForYellowStatus()).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); - client("server1").index(indexRequest("test").setType("type1").setId("1").setSource(source("1", "test"))).actionGet(); + client("server1").index(indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); FlushResponse flushResponse = client("server1").admin().indices().flush(flushRequest("test")).actionGet(); assertThat(flushResponse.getTotalShards(), equalTo(10)); assertThat(flushResponse.getSuccessfulShards(), equalTo(5)); assertThat(flushResponse.getFailedShards(), equalTo(0)); - client("server1").index(indexRequest("test").setType("type1").setId("2").setSource(source("2", "test"))).actionGet(); + client("server1").index(indexRequest("test").type("type1").id("2").source(source("2", "test"))).actionGet(); RefreshResponse refreshResponse = client("server1").admin().indices().refresh(refreshRequest("test")).actionGet(); assertThat(refreshResponse.getTotalShards(), equalTo(10)); assertThat(refreshResponse.getSuccessfulShards(), equalTo(5)); @@ -74,7 +74,7 @@ public class SimpleRecoveryTests extends AbstractNodesTests { startNode("server2", recoverySettings()); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForNodes("2")).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForNodes("2")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); @@ -82,13 +82,13 @@ public class SimpleRecoveryTests extends AbstractNodesTests { GetResponse getResult; for (int i = 0; i < 5; i++) { - getResult = client("server1").get(getRequest("test").setType("type1").setId("1").setOperationThreaded(false)).actionGet(1000); + getResult = client("server1").get(getRequest("test").type("type1").id("1").operationThreaded(false)).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("1", "test"))); - getResult = client("server2").get(getRequest("test").setType("type1").setId("1").setOperationThreaded(false)).actionGet(1000); + getResult = client("server2").get(getRequest("test").type("type1").id("1").operationThreaded(false)).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("1", "test"))); - getResult = client("server1").get(getRequest("test").setType("type1").setId("2").setOperationThreaded(true)).actionGet(1000); + getResult = client("server1").get(getRequest("test").type("type1").id("2").operationThreaded(true)).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("2", "test"))); - getResult = client("server2").get(getRequest("test").setType("type1").setId("2").setOperationThreaded(true)).actionGet(1000); + getResult = client("server2").get(getRequest("test").type("type1").id("2").operationThreaded(true)).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("2", "test"))); } @@ -96,23 +96,23 @@ public class SimpleRecoveryTests extends AbstractNodesTests { startNode("server3", recoverySettings()); Thread.sleep(200); logger.info("Running Cluster Health"); - clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().setWaitForGreenStatus().setWaitForRelocatingShards(0).setWaitForNodes("3")).actionGet(); + clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus().waitForRelocatingShards(0).waitForNodes("3")).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.GREEN)); for (int i = 0; i < 5; i++) { - getResult = client("server1").get(getRequest("test").setType("type1").setId("1")).actionGet(1000); + getResult = client("server1").get(getRequest("test").type("type1").id("1")).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("1", "test"))); - getResult = client("server2").get(getRequest("test").setType("type1").setId("1")).actionGet(1000); + getResult = client("server2").get(getRequest("test").type("type1").id("1")).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("1", "test"))); - getResult = client("server3").get(getRequest("test").setType("type1").setId("1")).actionGet(1000); + getResult = client("server3").get(getRequest("test").type("type1").id("1")).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("1", "test"))); - getResult = client("server1").get(getRequest("test").setType("type1").setId("2").setOperationThreaded(true)).actionGet(1000); + getResult = client("server1").get(getRequest("test").type("type1").id("2").operationThreaded(true)).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("2", "test"))); - getResult = client("server2").get(getRequest("test").setType("type1").setId("2").setOperationThreaded(true)).actionGet(1000); + getResult = client("server2").get(getRequest("test").type("type1").id("2").operationThreaded(true)).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("2", "test"))); - getResult = client("server3").get(getRequest("test").setType("type1").setId("2").setOperationThreaded(true)).actionGet(1000); + getResult = client("server3").get(getRequest("test").type("type1").id("2").operationThreaded(true)).actionGet(1000); assertThat(getResult.getSourceAsString(), equalTo(source("2", "test"))); } } diff --git a/src/test/java/org/elasticsearch/test/integration/routing/AliasRoutingTests.java b/src/test/java/org/elasticsearch/test/integration/routing/AliasRoutingTests.java index a23d578a63c..65d7a1d7f37 100644 --- a/src/test/java/org/elasticsearch/test/integration/routing/AliasRoutingTests.java +++ b/src/test/java/org/elasticsearch/test/integration/routing/AliasRoutingTests.java @@ -354,7 +354,7 @@ public class AliasRoutingTests extends AbstractNodesTests { logger.info("--> verifying get with no routing, should not find anything"); logger.info("--> bulk deleting with no routing, should broadcast the delete since _routing is required"); - client.prepareBulk().add(Requests.deleteRequest("test").setType("type1").setId("1")).execute().actionGet(); + client.prepareBulk().add(Requests.deleteRequest("test").type("type1").id("1")).execute().actionGet(); client.admin().indices().prepareRefresh().execute().actionGet(); for (int i = 0; i < 5; i++) { assertThat(client.prepareGet("test", "type1", "1").execute().actionGet().isExists(), equalTo(false)); diff --git a/src/test/java/org/elasticsearch/test/integration/routing/SimpleRoutingTests.java b/src/test/java/org/elasticsearch/test/integration/routing/SimpleRoutingTests.java index fde5832508d..be225408ff6 100644 --- a/src/test/java/org/elasticsearch/test/integration/routing/SimpleRoutingTests.java +++ b/src/test/java/org/elasticsearch/test/integration/routing/SimpleRoutingTests.java @@ -236,7 +236,7 @@ public class SimpleRoutingTests extends AbstractNodesTests { logger.info("--> verifying get with no routing, should not find anything"); logger.info("--> bulk deleting with no routing, should broadcast the delete since _routing is required"); - client.prepareBulk().add(Requests.deleteRequest("test").setType("type1").setId("1")).execute().actionGet(); + client.prepareBulk().add(Requests.deleteRequest("test").type("type1").id("1")).execute().actionGet(); client.admin().indices().prepareRefresh().execute().actionGet(); for (int i = 0; i < 5; i++) { assertThat(client.prepareGet("test", "type1", "1").execute().actionGet().isExists(), equalTo(false)); diff --git a/src/test/java/org/elasticsearch/test/integration/search/basic/TransportSearchFailuresTests.java b/src/test/java/org/elasticsearch/test/integration/search/basic/TransportSearchFailuresTests.java index 232762624c9..eaab21cf336 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/basic/TransportSearchFailuresTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/basic/TransportSearchFailuresTests.java @@ -58,7 +58,7 @@ public class TransportSearchFailuresTests extends AbstractNodesTests { logger.info("Start Testing failed search with wrong query"); startNode("server1"); client("server1").admin().indices().create(createIndexRequest("test") - .setSettings(settingsBuilder().put("index.number_of_shards", 3).put("index.number_of_replicas", 2).put("routing.hash.type", "simple"))) + .settings(settingsBuilder().put("index.number_of_shards", 3).put("index.number_of_replicas", 2).put("routing.hash.type", "simple"))) .actionGet(); client("server1").admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet(); @@ -72,7 +72,7 @@ public class TransportSearchFailuresTests extends AbstractNodesTests { assertThat(refreshResponse.getFailedShards(), equalTo(0)); for (int i = 0; i < 5; i++) { try { - SearchResponse searchResponse = client("server1").search(searchRequest("test").setSource(Unicode.fromStringAsBytes("{ xxx }"))).actionGet(); + SearchResponse searchResponse = client("server1").search(searchRequest("test").source(Unicode.fromStringAsBytes("{ xxx }"))).actionGet(); assertThat(searchResponse.getTotalShards(), equalTo(3)); assertThat(searchResponse.getSuccessfulShards(), equalTo(0)); assertThat(searchResponse.getFailedShards(), equalTo(3)); @@ -88,7 +88,7 @@ public class TransportSearchFailuresTests extends AbstractNodesTests { logger.info("Running Cluster Health"); ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest("test") - .setWaitForYellowStatus().setWaitForRelocatingShards(0).setWaitForActiveShards(6)).actionGet(); + .waitForYellowStatus().waitForRelocatingShards(0).waitForActiveShards(6)).actionGet(); logger.info("Done Cluster Health, status " + clusterHealth.getStatus()); assertThat(clusterHealth.isTimedOut(), equalTo(false)); assertThat(clusterHealth.getStatus(), equalTo(ClusterHealthStatus.YELLOW)); @@ -101,7 +101,7 @@ public class TransportSearchFailuresTests extends AbstractNodesTests { for (int i = 0; i < 5; i++) { try { - SearchResponse searchResponse = client("server1").search(searchRequest("test").setSource(Unicode.fromStringAsBytes("{ xxx }"))).actionGet(); + SearchResponse searchResponse = client("server1").search(searchRequest("test").source(Unicode.fromStringAsBytes("{ xxx }"))).actionGet(); assertThat(searchResponse.getTotalShards(), equalTo(3)); assertThat(searchResponse.getSuccessfulShards(), equalTo(0)); assertThat(searchResponse.getFailedShards(), equalTo(3)); @@ -116,7 +116,7 @@ public class TransportSearchFailuresTests extends AbstractNodesTests { } private void index(Client client, String id, String nameValue, int age) throws IOException { - client.index(Requests.indexRequest("test").setType("type1").setId(id).setSource(source(id, nameValue, age)).setConsistencyLevel(WriteConsistencyLevel.ONE)).actionGet(); + client.index(Requests.indexRequest("test").type("type1").id(id).source(source(id, nameValue, age)).consistencyLevel(WriteConsistencyLevel.ONE)).actionGet(); } private XContentBuilder source(String id, String nameValue, int age) throws IOException { @@ -132,4 +132,4 @@ public class TransportSearchFailuresTests extends AbstractNodesTests { .field("_boost", age * 10) .endObject(); } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/test/integration/search/basic/TransportTwoNodesSearchTests.java b/src/test/java/org/elasticsearch/test/integration/search/basic/TransportTwoNodesSearchTests.java index cb6b9b03593..aae17e475eb 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/basic/TransportTwoNodesSearchTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/basic/TransportTwoNodesSearchTests.java @@ -71,7 +71,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { client = getClient(); client.admin().indices().create(createIndexRequest("test") - .setSettings(settingsBuilder().put("index.number_of_shards", 3).put("index.number_of_replicas", 0).put("routing.hash.type", "simple"))) + .settings(settingsBuilder().put("index.number_of_shards", 3).put("index.number_of_replicas", 0).put("routing.hash.type", "simple"))) .actionGet(); client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); @@ -99,7 +99,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { .query(termQuery("multi", "test")) .from(0).size(60).explain(true); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(DFS_QUERY_THEN_FETCH).setScroll(new Scroll(timeValueMinutes(10)))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(DFS_QUERY_THEN_FETCH).scroll(new Scroll(timeValueMinutes(10)))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); @@ -128,7 +128,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { .query(termQuery("multi", "test")) .from(0).size(60).explain(true).sort("age", SortOrder.ASC); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(DFS_QUERY_THEN_FETCH).setScroll(new Scroll(timeValueMinutes(10)))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(DFS_QUERY_THEN_FETCH).scroll(new Scroll(timeValueMinutes(10)))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); assertThat(searchResponse.getHits().hits().length, equalTo(60)); @@ -156,7 +156,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { .sort("nid", SortOrder.DESC) // we have to sort here to have some ordering with dist scoring .from(0).size(60).explain(true); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(new Scroll(timeValueMinutes(10)))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(new Scroll(timeValueMinutes(10)))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); assertThat(searchResponse.getHits().hits().length, equalTo(60)); @@ -185,7 +185,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { Set collectedIds = Sets.newHashSet(); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source.from(0).size(60)).setSearchType(QUERY_THEN_FETCH)).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source.from(0).size(60)).searchType(QUERY_THEN_FETCH)).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); assertThat(searchResponse.getHits().hits().length, equalTo(60)); @@ -193,7 +193,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { SearchHit hit = searchResponse.getHits().hits()[i]; collectedIds.add(hit.id()); } - searchResponse = client.search(searchRequest("test").setSource(source.from(60).size(60)).setSearchType(QUERY_THEN_FETCH)).actionGet(); + searchResponse = client.search(searchRequest("test").source(source.from(60).size(60)).searchType(QUERY_THEN_FETCH)).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); assertThat(searchResponse.getHits().hits().length, equalTo(40)); @@ -210,7 +210,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { .query(termQuery("multi", "test")) .from(0).size(60).explain(true).sort("age", SortOrder.ASC); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(new Scroll(timeValueMinutes(10)))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(new Scroll(timeValueMinutes(10)))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); assertThat(searchResponse.getHits().hits().length, equalTo(60)); @@ -242,7 +242,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { expectedIds.add(Integer.toString(i)); } - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_AND_FETCH).setScroll(new Scroll(timeValueMinutes(10)))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_AND_FETCH).scroll(new Scroll(timeValueMinutes(10)))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); assertThat(searchResponse.getHits().hits().length, equalTo(60)); // 20 per shard @@ -280,7 +280,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { } - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(DFS_QUERY_AND_FETCH).setScroll(new Scroll(timeValueMinutes(10)))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(DFS_QUERY_AND_FETCH).scroll(new Scroll(timeValueMinutes(10)))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); assertThat(searchResponse.getHits().hits().length, equalTo(60)); // 20 per shard @@ -314,7 +314,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { .facet(FacetBuilders.queryFacet("all", termQuery("multi", "test")).global(true)) .facet(FacetBuilders.queryFacet("test1", termQuery("name", "test1"))); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(sourceBuilder)).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(sourceBuilder)).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); @@ -332,7 +332,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { public void testFailedSearchWithWrongQuery() throws Exception { logger.info("Start Testing failed search with wrong query"); try { - SearchResponse searchResponse = client.search(searchRequest("test").setSource(Unicode.fromStringAsBytes("{ xxx }"))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(Unicode.fromStringAsBytes("{ xxx }"))).actionGet(); assertThat(searchResponse.getTotalShards(), equalTo(3)); assertThat(searchResponse.getSuccessfulShards(), equalTo(0)); assertThat(searchResponse.getFailedShards(), equalTo(3)); @@ -350,21 +350,21 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { SearchSourceBuilder source = searchSource() .query(termQuery("multi", "test")) .from(1000).size(20).explain(true); - SearchResponse response = client.search(searchRequest("test").setSearchType(DFS_QUERY_AND_FETCH).setSource(source)).actionGet(); + SearchResponse response = client.search(searchRequest("test").searchType(DFS_QUERY_AND_FETCH).source(source)).actionGet(); assertThat(response.getHits().hits().length, equalTo(0)); assertThat(response.getTotalShards(), equalTo(3)); assertThat(response.getSuccessfulShards(), equalTo(3)); assertThat(response.getFailedShards(), equalTo(0)); - response = client.search(searchRequest("test").setSearchType(QUERY_THEN_FETCH).setSource(source)).actionGet(); + response = client.search(searchRequest("test").searchType(QUERY_THEN_FETCH).source(source)).actionGet(); assertThat(response.getShardFailures().length, equalTo(0)); assertThat(response.getHits().hits().length, equalTo(0)); - response = client.search(searchRequest("test").setSearchType(DFS_QUERY_AND_FETCH).setSource(source)).actionGet(); + response = client.search(searchRequest("test").searchType(DFS_QUERY_AND_FETCH).source(source)).actionGet(); assertThat(response.getShardFailures().length, equalTo(0)); assertThat(response.getHits().hits().length, equalTo(0)); - response = client.search(searchRequest("test").setSearchType(DFS_QUERY_THEN_FETCH).setSource(source)).actionGet(); + response = client.search(searchRequest("test").searchType(DFS_QUERY_THEN_FETCH).source(source)).actionGet(); assertThat(response.getShardFailures().length, equalTo(0)); assertThat(response.getHits().hits().length, equalTo(0)); @@ -394,7 +394,7 @@ public class TransportTwoNodesSearchTests extends AbstractNodesTests { } private void index(Client client, String id, String nameValue, int age) throws IOException { - client.index(Requests.indexRequest("test").setType("type1").setId(id).setSource(source(id, nameValue, age))).actionGet(); + client.index(Requests.indexRequest("test").type("type1").id(id).source(source(id, nameValue, age))).actionGet(); } private XContentBuilder source(String id, String nameValue, int age) throws IOException { diff --git a/src/test/java/org/elasticsearch/test/integration/search/customscore/CustomScoreSearchTests.java b/src/test/java/org/elasticsearch/test/integration/search/customscore/CustomScoreSearchTests.java index a8ad15207ee..70deb46d471 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/customscore/CustomScoreSearchTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/customscore/CustomScoreSearchTests.java @@ -147,18 +147,18 @@ public class CustomScoreSearchTests extends AbstractNodesTests { client.admin().indices().prepareDelete().execute().actionGet(); client.admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet(); - client.index(indexRequest("test").setType("type1").setId("1") - .setSource(jsonBuilder().startObject().field("test", "value beck").field("num1", 1.0f).endObject())).actionGet(); - client.index(indexRequest("test").setType("type1").setId("2") - .setSource(jsonBuilder().startObject().field("test", "value check").field("num1", 2.0f).endObject())).actionGet(); + client.index(indexRequest("test").type("type1").id("1") + .source(jsonBuilder().startObject().field("test", "value beck").field("num1", 1.0f).endObject())).actionGet(); + client.index(indexRequest("test").type("type1").id("2") + .source(jsonBuilder().startObject().field("test", "value check").field("num1", 2.0f).endObject())).actionGet(); client.admin().indices().refresh(refreshRequest()).actionGet(); logger.info("--- QUERY_THEN_FETCH"); logger.info("running doc['num1'].value"); SearchResponse response = client.search(searchRequest() - .setSearchType(SearchType.QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("doc['num1'].value"))) + .searchType(SearchType.QUERY_THEN_FETCH) + .source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("doc['num1'].value"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -169,8 +169,8 @@ public class CustomScoreSearchTests extends AbstractNodesTests { logger.info("running -doc['num1'].value"); response = client.search(searchRequest() - .setSearchType(SearchType.QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("-doc['num1'].value"))) + .searchType(SearchType.QUERY_THEN_FETCH) + .source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("-doc['num1'].value"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -182,8 +182,8 @@ public class CustomScoreSearchTests extends AbstractNodesTests { logger.info("running pow(doc['num1'].value, 2)"); response = client.search(searchRequest() - .setSearchType(SearchType.QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("pow(doc['num1'].value, 2)"))) + .searchType(SearchType.QUERY_THEN_FETCH) + .source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("pow(doc['num1'].value, 2)"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -194,8 +194,8 @@ public class CustomScoreSearchTests extends AbstractNodesTests { logger.info("running max(doc['num1'].value, 1)"); response = client.search(searchRequest() - .setSearchType(SearchType.QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("max(doc['num1'].value, 1d)"))) + .searchType(SearchType.QUERY_THEN_FETCH) + .source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("max(doc['num1'].value, 1d)"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -206,8 +206,8 @@ public class CustomScoreSearchTests extends AbstractNodesTests { logger.info("running doc['num1'].value * _score"); response = client.search(searchRequest() - .setSearchType(SearchType.QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("doc['num1'].value * _score"))) + .searchType(SearchType.QUERY_THEN_FETCH) + .source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("doc['num1'].value * _score"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -218,8 +218,8 @@ public class CustomScoreSearchTests extends AbstractNodesTests { logger.info("running param1 * param2 * _score"); response = client.search(searchRequest() - .setSearchType(SearchType.QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("param1 * param2 * _score").param("param1", 2).param("param2", 2))) + .searchType(SearchType.QUERY_THEN_FETCH) + .source(searchSource().explain(true).query(customScoreQuery(termQuery("test", "value")).script("param1 * param2 * _score").param("param1", 2).param("param2", 2))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -426,4 +426,4 @@ public class CustomScoreSearchTests extends AbstractNodesTests { assertThat(searchResponse.getHits().getAt(3).id(), equalTo("2")); assertThat(searchResponse.getHits().getAt(3).score(), equalTo(searchResponse.getHits().getAt(3).explanation().getValue())); } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlighterSearchTests.java b/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlighterSearchTests.java index f88237f8685..df7df2b3447 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlighterSearchTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/highlight/HighlighterSearchTests.java @@ -275,7 +275,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field*").order("score").preTags("").postTags("")); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -303,7 +303,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field1").order("score").preTags("").postTags("")); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -315,7 +315,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field1").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -327,7 +327,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field2").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -339,7 +339,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field2").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -351,7 +351,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field2").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -363,7 +363,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field2").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); assertThat(searchResponse.getHits().getAt(0).highlightFields().get("field2").fragments()[0].string(), equalTo("The quick brown fox jumps over the lazy dog")); @@ -389,7 +389,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field1", 100, 0).order("score").preTags("").postTags("")); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -401,7 +401,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field1", 100, 0).order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -414,7 +414,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field2", 100, 0).order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -427,7 +427,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field2", 100, 0).order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -970,7 +970,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field2").order("score").preTags("").postTags("")); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -995,7 +995,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .explain(true).highlight(highlight().field("field2").order("score").preTags("").postTags("")); SearchResponse searchResponse = client.search( - searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH).setScroll(timeValueMinutes(10))).actionGet(); + searchRequest("test").source(source).searchType(QUERY_THEN_FETCH).scroll(timeValueMinutes(10))).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -1041,7 +1041,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field0").order("score").preTags("").postTags("")); - SearchResponse searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH)).actionGet(); + SearchResponse searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH)).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -1053,7 +1053,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { .from(0).size(60).explain(true) .highlight(highlight().field("field1").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH)).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH)).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(2l)); @@ -1073,7 +1073,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { source = searchSource().filter(FilterBuilders.typeFilter("type2")).query(matchPhrasePrefixQuery("field3", "fast bro")).from(0).size(60).explain(true) .highlight(highlight().field("field3").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH)).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH)).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); @@ -1084,7 +1084,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { source = searchSource().filter(FilterBuilders.typeFilter("type2")).query(matchPhrasePrefixQuery("field4", "the fast bro")).from(0).size(60).explain(true) .highlight(highlight().field("field4").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH)).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH)).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(2l)); @@ -1097,7 +1097,7 @@ public class HighlighterSearchTests extends AbstractNodesTests { source = searchSource().filter(FilterBuilders.typeFilter("type2")).query(matchPhrasePrefixQuery("field4", "a fast quick blue ca")).from(0).size(60).explain(true) .highlight(highlight().field("field4").order("score").preTags("").postTags("")); - searchResponse = client.search(searchRequest("test").setSource(source).setSearchType(QUERY_THEN_FETCH)).actionGet(); + searchResponse = client.search(searchRequest("test").source(source).searchType(QUERY_THEN_FETCH)).actionGet(); assertThat("Failures " + Arrays.toString(searchResponse.getShardFailures()), searchResponse.getShardFailures().length, equalTo(0)); assertThat(searchResponse.getHits().totalHits(), equalTo(1l)); diff --git a/src/test/java/org/elasticsearch/test/integration/search/indicesboost/SimpleIndicesBoostSearchTests.java b/src/test/java/org/elasticsearch/test/integration/search/indicesboost/SimpleIndicesBoostSearchTests.java index 28eae6ef1eb..b3deb5649ed 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/indicesboost/SimpleIndicesBoostSearchTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/indicesboost/SimpleIndicesBoostSearchTests.java @@ -84,10 +84,10 @@ public class SimpleIndicesBoostSearchTests extends AbstractNodesTests { client.admin().indices().create(createIndexRequest("test1")).actionGet(); client.admin().indices().create(createIndexRequest("test2")).actionGet(); - client.index(indexRequest("test1").setType("type1").setId("1") - .setSource(jsonBuilder().startObject().field("test", "value check").endObject())).actionGet(); - client.index(indexRequest("test2").setType("type1").setId("1") - .setSource(jsonBuilder().startObject().field("test", "value beck").endObject())).actionGet(); + client.index(indexRequest("test1").type("type1").id("1") + .source(jsonBuilder().startObject().field("test", "value check").endObject())).actionGet(); + client.index(indexRequest("test2").type("type1").id("1") + .source(jsonBuilder().startObject().field("test", "value beck").endObject())).actionGet(); client.admin().indices().refresh(refreshRequest()).actionGet(); float indexBoost = 1.1f; @@ -96,8 +96,8 @@ public class SimpleIndicesBoostSearchTests extends AbstractNodesTests { logger.info("Query with test1 boosted"); SearchResponse response = client.search(searchRequest() - .setSearchType(SearchType.QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).indexBoost("test1", indexBoost).query(termQuery("test", "value"))) + .searchType(SearchType.QUERY_THEN_FETCH) + .source(searchSource().explain(true).indexBoost("test1", indexBoost).query(termQuery("test", "value"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -108,8 +108,8 @@ public class SimpleIndicesBoostSearchTests extends AbstractNodesTests { logger.info("Query with test2 boosted"); response = client.search(searchRequest() - .setSearchType(SearchType.QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).indexBoost("test2", indexBoost).query(termQuery("test", "value"))) + .searchType(SearchType.QUERY_THEN_FETCH) + .source(searchSource().explain(true).indexBoost("test2", indexBoost).query(termQuery("test", "value"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -122,8 +122,8 @@ public class SimpleIndicesBoostSearchTests extends AbstractNodesTests { logger.info("Query with test1 boosted"); response = client.search(searchRequest() - .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).indexBoost("test1", indexBoost).query(termQuery("test", "value"))) + .searchType(SearchType.DFS_QUERY_THEN_FETCH) + .source(searchSource().explain(true).indexBoost("test1", indexBoost).query(termQuery("test", "value"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); @@ -134,8 +134,8 @@ public class SimpleIndicesBoostSearchTests extends AbstractNodesTests { logger.info("Query with test2 boosted"); response = client.search(searchRequest() - .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) - .setSource(searchSource().explain(true).indexBoost("test2", indexBoost).query(termQuery("test", "value"))) + .searchType(SearchType.DFS_QUERY_THEN_FETCH) + .source(searchSource().explain(true).indexBoost("test2", indexBoost).query(termQuery("test", "value"))) ).actionGet(); assertThat(response.getHits().totalHits(), equalTo(2l)); diff --git a/src/test/java/org/elasticsearch/test/integration/update/UpdateTests.java b/src/test/java/org/elasticsearch/test/integration/update/UpdateTests.java index 8367a465b32..c46e67c80cd 100644 --- a/src/test/java/org/elasticsearch/test/integration/update/UpdateTests.java +++ b/src/test/java/org/elasticsearch/test/integration/update/UpdateTests.java @@ -93,71 +93,71 @@ public class UpdateTests extends AbstractNodesTests { public void testUpdateRequest() throws Exception { UpdateRequest request = new UpdateRequest("test", "type", "1"); // simple script - request.setSource(XContentFactory.jsonBuilder().startObject() + request.source(XContentFactory.jsonBuilder().startObject() .field("script", "script1") .endObject()); - assertThat(request.getScript(), equalTo("script1")); + assertThat(request.script(), equalTo("script1")); // script with params request = new UpdateRequest("test", "type", "1"); - request.setSource(XContentFactory.jsonBuilder().startObject() + request.source(XContentFactory.jsonBuilder().startObject() .field("script", "script1") .startObject("params").field("param1", "value1").endObject() .endObject()); - assertThat(request.getScript(), equalTo("script1")); - assertThat(request.getScriptParams().get("param1").toString(), equalTo("value1")); + assertThat(request.script(), equalTo("script1")); + assertThat(request.scriptParams().get("param1").toString(), equalTo("value1")); request = new UpdateRequest("test", "type", "1"); - request.setSource(XContentFactory.jsonBuilder().startObject() + request.source(XContentFactory.jsonBuilder().startObject() .startObject("params").field("param1", "value1").endObject() .field("script", "script1") .endObject()); - assertThat(request.getScript(), equalTo("script1")); - assertThat(request.getScriptParams().get("param1").toString(), equalTo("value1")); + assertThat(request.script(), equalTo("script1")); + assertThat(request.scriptParams().get("param1").toString(), equalTo("value1")); // script with params and upsert request = new UpdateRequest("test", "type", "1"); - request.setSource(XContentFactory.jsonBuilder().startObject() + request.source(XContentFactory.jsonBuilder().startObject() .startObject("params").field("param1", "value1").endObject() .field("script", "script1") .startObject("upsert").field("field1", "value1").startObject("compound").field("field2", "value2").endObject().endObject() .endObject()); - assertThat(request.getScript(), equalTo("script1")); - assertThat(request.getScriptParams().get("param1").toString(), equalTo("value1")); - Map upsertDoc = XContentHelper.convertToMap(request.getUpsertRequest().getSource(), true).v2(); + assertThat(request.script(), equalTo("script1")); + assertThat(request.scriptParams().get("param1").toString(), equalTo("value1")); + Map upsertDoc = XContentHelper.convertToMap(request.upsertRequest().source(), true).v2(); assertThat(upsertDoc.get("field1").toString(), equalTo("value1")); assertThat(((Map) upsertDoc.get("compound")).get("field2").toString(), equalTo("value2")); request = new UpdateRequest("test", "type", "1"); - request.setSource(XContentFactory.jsonBuilder().startObject() + request.source(XContentFactory.jsonBuilder().startObject() .startObject("upsert").field("field1", "value1").startObject("compound").field("field2", "value2").endObject().endObject() .startObject("params").field("param1", "value1").endObject() .field("script", "script1") .endObject()); - assertThat(request.getScript(), equalTo("script1")); - assertThat(request.getScriptParams().get("param1").toString(), equalTo("value1")); - upsertDoc = XContentHelper.convertToMap(request.getUpsertRequest().getSource(), true).v2(); + assertThat(request.script(), equalTo("script1")); + assertThat(request.scriptParams().get("param1").toString(), equalTo("value1")); + upsertDoc = XContentHelper.convertToMap(request.upsertRequest().source(), true).v2(); assertThat(upsertDoc.get("field1").toString(), equalTo("value1")); assertThat(((Map) upsertDoc.get("compound")).get("field2").toString(), equalTo("value2")); request = new UpdateRequest("test", "type", "1"); - request.setSource(XContentFactory.jsonBuilder().startObject() + request.source(XContentFactory.jsonBuilder().startObject() .startObject("params").field("param1", "value1").endObject() .startObject("upsert").field("field1", "value1").startObject("compound").field("field2", "value2").endObject().endObject() .field("script", "script1") .endObject()); - assertThat(request.getScript(), equalTo("script1")); - assertThat(request.getScriptParams().get("param1").toString(), equalTo("value1")); - upsertDoc = XContentHelper.convertToMap(request.getUpsertRequest().getSource(), true).v2(); + assertThat(request.script(), equalTo("script1")); + assertThat(request.scriptParams().get("param1").toString(), equalTo("value1")); + upsertDoc = XContentHelper.convertToMap(request.upsertRequest().source(), true).v2(); assertThat(upsertDoc.get("field1").toString(), equalTo("value1")); assertThat(((Map) upsertDoc.get("compound")).get("field2").toString(), equalTo("value2")); // script with doc request = new UpdateRequest("test", "type", "1"); - request.setSource(XContentFactory.jsonBuilder().startObject() + request.source(XContentFactory.jsonBuilder().startObject() .startObject("doc").field("field1", "value1").startObject("compound").field("field2", "value2").endObject().endObject() .endObject()); - Map doc = request.getDoc().getSourceAsMap(); + Map doc = request.doc().sourceAsMap(); assertThat(doc.get("field1").toString(), equalTo("value1")); assertThat(((Map) doc.get("compound")).get("field2").toString(), equalTo("value2")); } diff --git a/src/test/java/org/elasticsearch/test/stress/fullrestart/FullRestartStressTest.java b/src/test/java/org/elasticsearch/test/stress/fullrestart/FullRestartStressTest.java index c2ee23d56e4..2f3ceec8e2f 100644 --- a/src/test/java/org/elasticsearch/test/stress/fullrestart/FullRestartStressTest.java +++ b/src/test/java/org/elasticsearch/test/stress/fullrestart/FullRestartStressTest.java @@ -187,7 +187,7 @@ public class FullRestartStressTest { json.endObject(); - bulk.add(Requests.indexRequest("test" + (Math.abs(ThreadLocalRandom.current().nextInt()) % numberOfIndices)).setType("type1").setSource(json)); + bulk.add(Requests.indexRequest("test" + (Math.abs(ThreadLocalRandom.current().nextInt()) % numberOfIndices)).type("type1").source(json)); indexCounter.incrementAndGet(); } bulk.execute().actionGet(); diff --git a/src/test/java/org/elasticsearch/test/stress/indexing/BulkIndexingStressTest.java b/src/test/java/org/elasticsearch/test/stress/indexing/BulkIndexingStressTest.java index 9b14f2c0072..3bedcad4a71 100644 --- a/src/test/java/org/elasticsearch/test/stress/indexing/BulkIndexingStressTest.java +++ b/src/test/java/org/elasticsearch/test/stress/indexing/BulkIndexingStressTest.java @@ -49,7 +49,7 @@ public class BulkIndexingStressTest { while (true) { BulkRequestBuilder bulkRequest = client.prepareBulk(); for (int i = 0; i < BATCH; i++) { - bulkRequest.add(Requests.indexRequest("test" + ThreadLocalRandom.current().nextInt(NUMBER_OF_INDICES)).setType("type").setSource("field", "value")); + bulkRequest.add(Requests.indexRequest("test" + ThreadLocalRandom.current().nextInt(NUMBER_OF_INDICES)).type("type").source("field", "value")); } bulkRequest.execute().actionGet(); } diff --git a/src/test/java/org/elasticsearch/test/stress/search1/ParentChildStressTest.java b/src/test/java/org/elasticsearch/test/stress/search1/ParentChildStressTest.java index 1f4fe9e5568..e8f56f8880c 100644 --- a/src/test/java/org/elasticsearch/test/stress/search1/ParentChildStressTest.java +++ b/src/test/java/org/elasticsearch/test/stress/search1/ParentChildStressTest.java @@ -64,7 +64,7 @@ public class ParentChildStressTest { "}}}"; try { - client.admin().indices().create(new CreateIndexRequest(INDEX_NAME).addMapping(CHILD_TYPE_NAME, mapping)).actionGet(); + client.admin().indices().create(new CreateIndexRequest(INDEX_NAME).mapping(CHILD_TYPE_NAME, mapping)).actionGet(); } catch (RemoteTransportException e) { // usually means the index is already created. } @@ -112,7 +112,7 @@ public class ParentChildStressTest { * elevate the visibility of the problem. */ public List executeSearch(String source) { - SearchRequest request = Requests.searchRequest(INDEX_NAME).setSource(source); + SearchRequest request = Requests.searchRequest(INDEX_NAME).source(source); List failures; SearchResponse response; @@ -234,4 +234,4 @@ public class ParentChildStressTest { elasticTest.shutdown(); } } -} \ No newline at end of file +} diff --git a/src/test/java/org/elasticsearch/test/unit/action/bulk/BulkRequestTests.java b/src/test/java/org/elasticsearch/test/unit/action/bulk/BulkRequestTests.java index ee314186b41..1353bd8240c 100644 --- a/src/test/java/org/elasticsearch/test/unit/action/bulk/BulkRequestTests.java +++ b/src/test/java/org/elasticsearch/test/unit/action/bulk/BulkRequestTests.java @@ -38,9 +38,9 @@ public class BulkRequestTests { BulkRequest bulkRequest = new BulkRequest(); bulkRequest.add(bulkAction.getBytes(), 0, bulkAction.length(), true, null, null); assertThat(bulkRequest.numberOfActions(), equalTo(3)); - assertThat(((IndexRequest) bulkRequest.requests().get(0)).getSource().toBytes(), equalTo(new BytesArray("{ \"field1\" : \"value1\" }").toBytes())); + assertThat(((IndexRequest) bulkRequest.requests().get(0)).source().toBytes(), equalTo(new BytesArray("{ \"field1\" : \"value1\" }").toBytes())); assertThat(bulkRequest.requests().get(1), instanceOf(DeleteRequest.class)); - assertThat(((IndexRequest) bulkRequest.requests().get(2)).getSource().toBytes(), equalTo(new BytesArray("{ \"field1\" : \"value3\" }").toBytes())); + assertThat(((IndexRequest) bulkRequest.requests().get(2)).source().toBytes(), equalTo(new BytesArray("{ \"field1\" : \"value3\" }").toBytes())); } @Test diff --git a/src/test/java/org/elasticsearch/test/unit/action/search/MultiSearchRequestTests.java b/src/test/java/org/elasticsearch/test/unit/action/search/MultiSearchRequestTests.java index f8ebbcf546c..4c4850dd69a 100644 --- a/src/test/java/org/elasticsearch/test/unit/action/search/MultiSearchRequestTests.java +++ b/src/test/java/org/elasticsearch/test/unit/action/search/MultiSearchRequestTests.java @@ -37,54 +37,54 @@ public class MultiSearchRequestTests { public void simpleAdd() throws Exception { byte[] data = Streams.copyToBytesFromClasspath("/org/elasticsearch/test/unit/action/search/simple-msearch1.json"); MultiSearchRequest request = new MultiSearchRequest().add(data, 0, data.length, false, null, null, null); - assertThat(request.getRequests().size(), equalTo(5)); - assertThat(request.getRequests().get(0).getIndices()[0], equalTo("test")); - assertThat(request.getRequests().get(0).getTypes().length, equalTo(0)); - assertThat(request.getRequests().get(1).getIndices()[0], equalTo("test")); - assertThat(request.getRequests().get(1).getTypes()[0], equalTo("type1")); - assertThat(request.getRequests().get(2).getIndices(), nullValue()); - assertThat(request.getRequests().get(2).getTypes().length, equalTo(0)); - assertThat(request.getRequests().get(3).getIndices(), nullValue()); - assertThat(request.getRequests().get(3).getTypes().length, equalTo(0)); - assertThat(request.getRequests().get(3).getSearchType(), equalTo(SearchType.COUNT)); - assertThat(request.getRequests().get(4).getIndices(), nullValue()); - assertThat(request.getRequests().get(4).getTypes().length, equalTo(0)); + assertThat(request.requests().size(), equalTo(5)); + assertThat(request.requests().get(0).indices()[0], equalTo("test")); + assertThat(request.requests().get(0).types().length, equalTo(0)); + assertThat(request.requests().get(1).indices()[0], equalTo("test")); + assertThat(request.requests().get(1).types()[0], equalTo("type1")); + assertThat(request.requests().get(2).indices(), nullValue()); + assertThat(request.requests().get(2).types().length, equalTo(0)); + assertThat(request.requests().get(3).indices(), nullValue()); + assertThat(request.requests().get(3).types().length, equalTo(0)); + assertThat(request.requests().get(3).searchType(), equalTo(SearchType.COUNT)); + assertThat(request.requests().get(4).indices(), nullValue()); + assertThat(request.requests().get(4).types().length, equalTo(0)); } @Test public void simpleAdd2() throws Exception { byte[] data = Streams.copyToBytesFromClasspath("/org/elasticsearch/test/unit/action/search/simple-msearch2.json"); MultiSearchRequest request = new MultiSearchRequest().add(data, 0, data.length, false, null, null, null); - assertThat(request.getRequests().size(), equalTo(5)); - assertThat(request.getRequests().get(0).getIndices()[0], equalTo("test")); - assertThat(request.getRequests().get(0).getTypes().length, equalTo(0)); - assertThat(request.getRequests().get(1).getIndices()[0], equalTo("test")); - assertThat(request.getRequests().get(1).getTypes()[0], equalTo("type1")); - assertThat(request.getRequests().get(2).getIndices(), nullValue()); - assertThat(request.getRequests().get(2).getTypes().length, equalTo(0)); - assertThat(request.getRequests().get(3).getIndices(), nullValue()); - assertThat(request.getRequests().get(3).getTypes().length, equalTo(0)); - assertThat(request.getRequests().get(3).getSearchType(), equalTo(SearchType.COUNT)); - assertThat(request.getRequests().get(4).getIndices(), nullValue()); - assertThat(request.getRequests().get(4).getTypes().length, equalTo(0)); + assertThat(request.requests().size(), equalTo(5)); + assertThat(request.requests().get(0).indices()[0], equalTo("test")); + assertThat(request.requests().get(0).types().length, equalTo(0)); + assertThat(request.requests().get(1).indices()[0], equalTo("test")); + assertThat(request.requests().get(1).types()[0], equalTo("type1")); + assertThat(request.requests().get(2).indices(), nullValue()); + assertThat(request.requests().get(2).types().length, equalTo(0)); + assertThat(request.requests().get(3).indices(), nullValue()); + assertThat(request.requests().get(3).types().length, equalTo(0)); + assertThat(request.requests().get(3).searchType(), equalTo(SearchType.COUNT)); + assertThat(request.requests().get(4).indices(), nullValue()); + assertThat(request.requests().get(4).types().length, equalTo(0)); } @Test public void simpleAdd3() throws Exception { byte[] data = Streams.copyToBytesFromClasspath("/org/elasticsearch/test/unit/action/search/simple-msearch3.json"); MultiSearchRequest request = new MultiSearchRequest().add(data, 0, data.length, false, null, null, null); - assertThat(request.getRequests().size(), equalTo(4)); - assertThat(request.getRequests().get(0).getIndices()[0], equalTo("test0")); - assertThat(request.getRequests().get(0).getIndices()[1], equalTo("test1")); - assertThat(request.getRequests().get(1).getIndices()[0], equalTo("test2")); - assertThat(request.getRequests().get(1).getIndices()[1], equalTo("test3")); - assertThat(request.getRequests().get(1).getTypes()[0], equalTo("type1")); - assertThat(request.getRequests().get(2).getIndices()[0], equalTo("test4")); - assertThat(request.getRequests().get(2).getIndices()[1], equalTo("test1")); - assertThat(request.getRequests().get(2).getTypes()[0], equalTo("type2")); - assertThat(request.getRequests().get(2).getTypes()[1], equalTo("type1")); - assertThat(request.getRequests().get(3).getIndices(), nullValue()); - assertThat(request.getRequests().get(3).getTypes().length, equalTo(0)); - assertThat(request.getRequests().get(3).getSearchType(), equalTo(SearchType.COUNT)); + assertThat(request.requests().size(), equalTo(4)); + assertThat(request.requests().get(0).indices()[0], equalTo("test0")); + assertThat(request.requests().get(0).indices()[1], equalTo("test1")); + assertThat(request.requests().get(1).indices()[0], equalTo("test2")); + assertThat(request.requests().get(1).indices()[1], equalTo("test3")); + assertThat(request.requests().get(1).types()[0], equalTo("type1")); + assertThat(request.requests().get(2).indices()[0], equalTo("test4")); + assertThat(request.requests().get(2).indices()[1], equalTo("test1")); + assertThat(request.requests().get(2).types()[0], equalTo("type2")); + assertThat(request.requests().get(2).types()[1], equalTo("type1")); + assertThat(request.requests().get(3).indices(), nullValue()); + assertThat(request.requests().get(3).types().length, equalTo(0)); + assertThat(request.requests().get(3).searchType(), equalTo(SearchType.COUNT)); } }