Merge pull request #19170 from rjernst/rest_handler_client

Changed rest handler interface to take NodeClient
This commit is contained in:
Ryan Ernst 2016-06-30 11:00:09 -07:00 committed by GitHub
commit 8275ab497b
135 changed files with 589 additions and 583 deletions

View File

@ -19,6 +19,12 @@
package org.elasticsearch.http;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicBoolean;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.breaker.CircuitBreaker;
import org.elasticsearch.common.bytes.BytesArray;
@ -39,11 +45,6 @@ import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.RestStatus;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.elasticsearch.rest.RestStatus.FORBIDDEN;
import static org.elasticsearch.rest.RestStatus.INTERNAL_SERVER_ERROR;
@ -57,15 +58,18 @@ public class HttpServer extends AbstractLifecycleComponent<HttpServer> implement
private final NodeService nodeService;
private final NodeClient client;
private final CircuitBreakerService circuitBreakerService;
@Inject
public HttpServer(Settings settings, HttpServerTransport transport, RestController restController, NodeService nodeService,
CircuitBreakerService circuitBreakerService) {
NodeClient client, CircuitBreakerService circuitBreakerService) {
super(settings);
this.transport = transport;
this.restController = restController;
this.nodeService = nodeService;
this.client = client;
this.circuitBreakerService = circuitBreakerService;
nodeService.setHttpServer(this);
transport.httpServerAdapter(this);
@ -115,7 +119,7 @@ public class HttpServer extends AbstractLifecycleComponent<HttpServer> implement
}
// iff we could reserve bytes for the request we need to send the response also over this channel
responseChannel = new ResourceHandlingHttpChannel(channel, circuitBreakerService, contentLength);
restController.dispatchRequest(request, responseChannel, threadContext);
restController.dispatchRequest(request, responseChannel, client, threadContext);
} catch (Throwable t) {
restController.sendErrorResponse(request, responseChannel, t);
}

View File

@ -284,6 +284,7 @@ public class Node implements Closeable {
modules.add(b -> {
b.bind(PluginsService.class).toInstance(pluginsService);
b.bind(Client.class).toInstance(client);
b.bind(NodeClient.class).toInstance(client);
b.bind(Environment.class).toInstance(environment);
b.bind(ThreadPool.class).toInstance(threadPool);
b.bind(NodeEnvironment.class).toInstance(nodeEnvironment);

View File

@ -19,7 +19,6 @@
package org.elasticsearch.rest;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.settings.Setting;
@ -37,19 +36,10 @@ import org.elasticsearch.common.settings.Settings;
public abstract class BaseRestHandler extends AbstractComponent implements RestHandler {
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX =
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope);
private final Client client;
protected final ParseFieldMatcher parseFieldMatcher;
protected BaseRestHandler(Settings settings, Client client) {
protected BaseRestHandler(Settings settings) {
super(settings);
this.client = client;
this.parseFieldMatcher = new ParseFieldMatcher(settings);
}
@Override
public final void handleRequest(RestRequest request, RestChannel channel) throws Exception {
handleRequest(request, channel, client);
}
protected abstract void handleRequest(RestRequest request, RestChannel channel, Client client) throws Exception;
}

View File

@ -19,6 +19,7 @@
package org.elasticsearch.rest;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.component.AbstractLifecycleComponent;
@ -150,7 +151,7 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
return (handler != null) ? handler.canTripCircuitBreaker() : true;
}
public void dispatchRequest(final RestRequest request, final RestChannel channel, ThreadContext threadContext) throws Exception {
public void dispatchRequest(final RestRequest request, final RestChannel channel, final NodeClient client, ThreadContext threadContext) throws Exception {
if (!checkRequestParameters(request, channel)) {
return;
}
@ -162,10 +163,10 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
}
}
if (filters.length == 0) {
executeHandler(request, channel);
executeHandler(request, channel, client);
} else {
ControllerFilterChain filterChain = new ControllerFilterChain(handlerFilter);
filterChain.continueProcessing(request, channel);
filterChain.continueProcessing(request, channel, client);
}
}
}
@ -200,10 +201,10 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
return true;
}
void executeHandler(RestRequest request, RestChannel channel) throws Exception {
void executeHandler(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
final RestHandler handler = getHandler(request);
if (handler != null) {
handler.handleRequest(request, channel);
handler.handleRequest(request, channel, client);
} else {
if (request.method() == RestRequest.Method.OPTIONS) {
// when we have OPTIONS request, simply send OK by default (with the Access Control Origin header which gets automatically added)
@ -261,16 +262,16 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
}
@Override
public void continueProcessing(RestRequest request, RestChannel channel) {
public void continueProcessing(RestRequest request, RestChannel channel, NodeClient client) {
try {
int loc = index.getAndIncrement();
if (loc > filters.length) {
throw new IllegalStateException("filter continueProcessing was called more than expected");
} else if (loc == filters.length) {
executionFilter.process(request, channel, this);
executionFilter.process(request, channel, client, this);
} else {
RestFilter preProcessor = filters[loc];
preProcessor.process(request, channel, this);
preProcessor.process(request, channel, client, this);
}
} catch (Exception e) {
try {
@ -285,8 +286,8 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
class RestHandlerFilter extends RestFilter {
@Override
public void process(RestRequest request, RestChannel channel, RestFilterChain filterChain) throws Exception {
executeHandler(request, channel);
public void process(RestRequest request, RestChannel channel, NodeClient client, RestFilterChain filterChain) throws Exception {
executeHandler(request, channel, client);
}
}
}

View File

@ -21,6 +21,8 @@ package org.elasticsearch.rest;
import java.io.Closeable;
import org.elasticsearch.client.node.NodeClient;
/**
* A filter allowing to filter rest operations.
*/
@ -43,5 +45,5 @@ public abstract class RestFilter implements Closeable {
* Process the rest request. Using the channel to send a response, or the filter chain to continue
* processing the request.
*/
public abstract void process(RestRequest request, RestChannel channel, RestFilterChain filterChain) throws Exception;
public abstract void process(RestRequest request, RestChannel channel, NodeClient client, RestFilterChain filterChain) throws Exception;
}

View File

@ -19,6 +19,8 @@
package org.elasticsearch.rest;
import org.elasticsearch.client.node.NodeClient;
/**
* A filter chain allowing to continue and process the rest request.
*/
@ -28,5 +30,5 @@ public interface RestFilterChain {
* Continue processing the request. Should only be called if a response has not been sent
* through the channel.
*/
void continueProcessing(RestRequest request, RestChannel channel);
void continueProcessing(RestRequest request, RestChannel channel, NodeClient client);
}

View File

@ -19,12 +19,21 @@
package org.elasticsearch.rest;
import org.elasticsearch.client.node.NodeClient;
/**
* Handler for REST requests
*/
public interface RestHandler {
void handleRequest(RestRequest request, RestChannel channel) throws Exception;
/**
* Handles a rest request.
*
* @param request The request to handle
* @param channel The channel to write the request response to
* @param client A client to use to make internal requests on behalf of the original request
*/
void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception;
default boolean canTripCircuitBreaker() {
return true;

View File

@ -19,11 +19,12 @@
package org.elasticsearch.rest.action.admin.cluster.allocation;
import java.io.IOException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.Requests;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.inject.Inject;
@ -42,22 +43,20 @@ import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestBuilderListener;
import java.io.IOException;
/**
* Class handling cluster allocation explanation at the REST level
*/
public class RestClusterAllocationExplainAction extends BaseRestHandler {
@Inject
public RestClusterAllocationExplainAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestClusterAllocationExplainAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/allocation/explain", this);
controller.registerHandler(RestRequest.Method.POST, "/_cluster/allocation/explain", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
ClusterAllocationExplainRequest req;
if (RestActions.hasBodyContent(request) == false) {
// Empty request signals "explain the first unassigned shard you find"

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.health;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -42,15 +42,15 @@ import static org.elasticsearch.client.Requests.clusterHealthRequest;
public class RestClusterHealthAction extends BaseRestHandler {
@Inject
public RestClusterHealthAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestClusterHealthAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/health", this);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/health/{index}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(Strings.splitStringByCommaToArray(request.param("index")));
clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local()));
clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout()));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.hotthreads;
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads;
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequest;
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -42,8 +42,8 @@ import org.elasticsearch.rest.action.support.RestResponseListener;
public class RestNodesHotThreadsAction extends BaseRestHandler {
@Inject
public RestNodesHotThreadsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestNodesHotThreadsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hotthreads", this);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hot_threads", this);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/{nodeId}/hotthreads", this);
@ -56,7 +56,7 @@ public class RestNodesHotThreadsAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
NodesHotThreadsRequest nodesHotThreadsRequest = new NodesHotThreadsRequest(nodesIds);
nodesHotThreadsRequest.threads(request.paramAsInt("threads", nodesHotThreadsRequest.threads()));

View File

@ -20,7 +20,7 @@
package org.elasticsearch.rest.action.admin.cluster.node.info;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -46,8 +46,8 @@ public class RestNodesInfoAction extends BaseRestHandler {
private final static Set<String> ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "os", "plugins", "process", "settings", "thread_pool", "transport", "ingest", "indices");
@Inject
public RestNodesInfoAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
super(settings, client);
public RestNodesInfoAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
super(settings);
controller.registerHandler(GET, "/_nodes", this);
// this endpoint is used for metrics, not for nodeIds, like /_nodes/fs
controller.registerHandler(GET, "/_nodes/{nodeId}", this);
@ -59,7 +59,7 @@ public class RestNodesInfoAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] nodeIds;
Set<String> metrics;

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.stats;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestNodesStatsAction extends BaseRestHandler {
@Inject
public RestNodesStatsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestNodesStatsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_nodes/stats", this);
controller.registerHandler(GET, "/_nodes/{nodeId}/stats", this);
@ -57,7 +57,7 @@ public class RestNodesStatsAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.tasks;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest;
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -42,15 +42,15 @@ public class RestCancelTasksAction extends BaseRestHandler {
private final ClusterService clusterService;
@Inject
public RestCancelTasksAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
super(settings, client);
public RestCancelTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
super(settings);
this.clusterService = clusterService;
controller.registerHandler(POST, "/_tasks/_cancel", this);
controller.registerHandler(POST, "/_tasks/{taskId}/_cancel", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
TaskId taskId = new TaskId(request.param("taskId"));
String[] actions = Strings.splitStringByCommaToArray(request.param("actions"));

View File

@ -20,7 +20,7 @@
package org.elasticsearch.rest.action.admin.cluster.node.tasks;
import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
@ -35,13 +35,13 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestGetTaskAction extends BaseRestHandler {
@Inject
public RestGetTaskAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestGetTaskAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_tasks/{taskId}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
TaskId taskId = new TaskId(request.param("taskId"));
boolean waitForCompletion = request.paramAsBoolean("wait_for_completion", false);
TimeValue timeout = request.paramAsTime("timeout", null);

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.tasks;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -42,8 +42,8 @@ public class RestListTasksAction extends BaseRestHandler {
private final ClusterService clusterService;
@Inject
public RestListTasksAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
super(settings, client);
public RestListTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
super(settings);
this.clusterService = clusterService;
controller.registerHandler(GET, "/_tasks", this);
}
@ -67,7 +67,7 @@ public class RestListTasksAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
ActionListener<ListTasksResponse> listener = nodeSettingListener(clusterService, new RestToXContentListener<>(channel));
client.admin().cluster().listTasks(generateListTasksRequest(request), listener);
}

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.repositories.delete;
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteRepositoryAction extends BaseRestHandler {
@Inject
public RestDeleteRepositoryAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestDeleteRepositoryAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(DELETE, "/_snapshot/{repository}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
DeleteRepositoryRequest deleteRepositoryRequest = deleteRepositoryRequest(request.param("repository"));
deleteRepositoryRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteRepositoryRequest.masterNodeTimeout()));
deleteRepositoryRequest.timeout(request.paramAsTime("timeout", deleteRepositoryRequest.timeout()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.repositories.get;
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.RepositoriesMetaData;
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
import org.elasticsearch.common.Strings;
@ -49,15 +49,15 @@ public class RestGetRepositoriesAction extends BaseRestHandler {
private final SettingsFilter settingsFilter;
@Inject
public RestGetRepositoriesAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
super(settings, client);
public RestGetRepositoriesAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
super(settings);
controller.registerHandler(GET, "/_snapshot", this);
controller.registerHandler(GET, "/_snapshot/{repository}", this);
this.settingsFilter = settingsFilter;
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] repositories = request.paramAsStringArray("repository", Strings.EMPTY_ARRAY);
GetRepositoriesRequest getRepositoriesRequest = getRepositoryRequest(repositories);
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.repositories.put;
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest;
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -40,15 +40,15 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestPutRepositoryAction extends BaseRestHandler {
@Inject
public RestPutRepositoryAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestPutRepositoryAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(PUT, "/_snapshot/{repository}", this);
controller.registerHandler(POST, "/_snapshot/{repository}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
PutRepositoryRequest putRepositoryRequest = putRepositoryRequest(request.param("repository"));
putRepositoryRequest.source(request.content().toUtf8());
putRepositoryRequest.verify(request.paramAsBoolean("verify", true));

View File

@ -20,7 +20,7 @@
package org.elasticsearch.rest.action.admin.cluster.repositories.verify;
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -35,13 +35,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestVerifyRepositoryAction extends BaseRestHandler {
@Inject
public RestVerifyRepositoryAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestVerifyRepositoryAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_snapshot/{repository}/_verify", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
VerifyRepositoryRequest verifyRepositoryRequest = verifyRepositoryRequest(request.param("repository"));
verifyRepositoryRequest.masterNodeTimeout(request.paramAsTime("master_timeout", verifyRepositoryRequest.masterNodeTimeout()));
verifyRepositoryRequest.timeout(request.paramAsTime("timeout", verifyRepositoryRequest.timeout()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.reroute;
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteRequest;
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.Requests;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.routing.allocation.command.AllocationCommandRegistry;
@ -65,16 +65,16 @@ public class RestClusterRerouteAction extends BaseRestHandler {
private final AllocationCommandRegistry registry;
@Inject
public RestClusterRerouteAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter,
public RestClusterRerouteAction(Settings settings, RestController controller, SettingsFilter settingsFilter,
AllocationCommandRegistry registry) {
super(settings, client);
super(settings);
this.settingsFilter = settingsFilter;
this.registry = registry;
controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
ClusterRerouteRequest clusterRerouteRequest = createRequest(request, registry, parseFieldMatcher);
client.admin().cluster().reroute(clusterRerouteRequest, new AcknowledgedRestListener<ClusterRerouteResponse>(channel) {
@Override

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.settings;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.Requests;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.inject.Inject;
@ -50,15 +50,15 @@ public class RestClusterGetSettingsAction extends BaseRestHandler {
private final SettingsFilter settingsFilter;
@Inject
public RestClusterGetSettingsAction(Settings settings, RestController controller, Client client, ClusterSettings clusterSettings, SettingsFilter settingsFilter) {
super(settings, client);
public RestClusterGetSettingsAction(Settings settings, RestController controller, ClusterSettings clusterSettings, SettingsFilter settingsFilter) {
super(settings);
this.clusterSettings = clusterSettings;
controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this);
this.settingsFilter = settingsFilter;
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest()
.routingTable(false)
.nodes(false);

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.settings;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -42,13 +42,13 @@ import java.util.Map;
public class RestClusterUpdateSettingsAction extends BaseRestHandler {
@Inject
public RestClusterUpdateSettingsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestClusterUpdateSettingsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest();
clusterUpdateSettingsRequest.timeout(request.paramAsTime("timeout", clusterUpdateSettingsRequest.timeout()));
clusterUpdateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterUpdateSettingsRequest.masterNodeTimeout()));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.shards;
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsRequest;
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestClusterSearchShardsAction extends BaseRestHandler {
@Inject
public RestClusterSearchShardsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestClusterSearchShardsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_search_shards", this);
controller.registerHandler(POST, "/_search_shards", this);
controller.registerHandler(GET, "/{index}/_search_shards", this);
@ -52,7 +52,7 @@ public class RestClusterSearchShardsAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final ClusterSearchShardsRequest clusterSearchShardsRequest = Requests.clusterSearchShardsRequest(indices);
clusterSearchShardsRequest.local(request.paramAsBoolean("local", clusterSearchShardsRequest.local()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.create;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -40,14 +40,14 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestCreateSnapshotAction extends BaseRestHandler {
@Inject
public RestCreateSnapshotAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestCreateSnapshotAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this);
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
CreateSnapshotRequest createSnapshotRequest = createSnapshotRequest(request.param("repository"), request.param("snapshot"));
createSnapshotRequest.source(request.content().toUtf8());
createSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createSnapshotRequest.masterNodeTimeout()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.delete;
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteSnapshotAction extends BaseRestHandler {
@Inject
public RestDeleteSnapshotAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestDeleteSnapshotAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
DeleteSnapshotRequest deleteSnapshotRequest = deleteSnapshotRequest(request.param("repository"), request.param("snapshot"));
deleteSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteSnapshotRequest.masterNodeTimeout()));
client.admin().cluster().deleteSnapshot(deleteSnapshotRequest, new AcknowledgedRestListener<DeleteSnapshotResponse>(channel));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.get;
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -40,14 +40,14 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestGetSnapshotsAction extends BaseRestHandler {
@Inject
public RestGetSnapshotsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestGetSnapshotsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String repository = request.param("repository");
String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.restore;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestRestoreSnapshotAction extends BaseRestHandler {
@Inject
public RestRestoreSnapshotAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestRestoreSnapshotAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
RestoreSnapshotRequest restoreSnapshotRequest = restoreSnapshotRequest(request.param("repository"), request.param("snapshot"));
restoreSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", restoreSnapshotRequest.masterNodeTimeout()));
restoreSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.status;
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest;
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -40,15 +40,15 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestSnapshotsStatusAction extends BaseRestHandler {
@Inject
public RestSnapshotsStatusAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestSnapshotsStatusAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}/_status", this);
controller.registerHandler(GET, "/_snapshot/{repository}/_status", this);
controller.registerHandler(GET, "/_snapshot/_status", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String repository = request.param("repository", "_all");
String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);
if (snapshots.length == 1 && "_all".equalsIgnoreCase(snapshots[0])) {

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.state;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.Requests;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.Strings;
@ -50,8 +50,8 @@ public class RestClusterStateAction extends BaseRestHandler {
private final SettingsFilter settingsFilter;
@Inject
public RestClusterStateAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
super(settings, client);
public RestClusterStateAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
super(settings);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state", this);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}", this);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}/{indices}", this);
@ -60,7 +60,7 @@ public class RestClusterStateAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest();
clusterStateRequest.indicesOptions(IndicesOptions.fromRequest(request, clusterStateRequest.indicesOptions()));
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));

View File

@ -20,7 +20,7 @@
package org.elasticsearch.rest.action.admin.cluster.stats;
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -35,14 +35,14 @@ import org.elasticsearch.rest.action.support.RestActions.NodesResponseRestListen
public class RestClusterStatsAction extends BaseRestHandler {
@Inject
public RestClusterStatsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestClusterStatsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats", this);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats/nodes/{nodeId}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
ClusterStatsRequest clusterStatsRequest = new ClusterStatsRequest().nodesIds(request.paramAsStringArray("nodeId", null));
clusterStatsRequest.timeout(request.param("timeout"));
client.admin().cluster().clusterStats(clusterStatsRequest, new NodesResponseRestListener<>(channel));

View File

@ -19,7 +19,7 @@
package org.elasticsearch.rest.action.admin.cluster.storedscripts;
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -33,12 +33,12 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteStoredScriptAction extends BaseRestHandler {
@Inject
public RestDeleteStoredScriptAction(Settings settings, RestController controller, Client client) {
this(settings, controller, true, client);
public RestDeleteStoredScriptAction(Settings settings, RestController controller) {
this(settings, controller, true);
}
protected RestDeleteStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
super(settings, client);
protected RestDeleteStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
super(settings);
if (registerDefaultHandlers) {
controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this);
}
@ -49,7 +49,7 @@ public class RestDeleteStoredScriptAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, NodeClient client) {
DeleteStoredScriptRequest deleteStoredScriptRequest = new DeleteStoredScriptRequest(getScriptLang(request), request.param("id"));
client.admin().cluster().deleteStoredScript(deleteStoredScriptRequest, new AcknowledgedRestListener<>(channel));
}

View File

@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.cluster.storedscripts;
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -38,12 +38,12 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestGetStoredScriptAction extends BaseRestHandler {
@Inject
public RestGetStoredScriptAction(Settings settings, RestController controller, Client client) {
this(settings, controller, true, client);
public RestGetStoredScriptAction(Settings settings, RestController controller) {
this(settings, controller, true);
}
protected RestGetStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
super(settings, client);
protected RestGetStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
super(settings);
if (registerDefaultHandlers) {
controller.registerHandler(GET, "/_scripts/{lang}/{id}", this);
}
@ -58,7 +58,7 @@ public class RestGetStoredScriptAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, NodeClient client) {
final GetStoredScriptRequest getRequest = new GetStoredScriptRequest(getScriptLang(request), request.param("id"));
client.admin().cluster().getStoredScript(getRequest, new RestBuilderListener<GetStoredScriptResponse>(channel) {
@Override

View File

@ -19,7 +19,7 @@
package org.elasticsearch.rest.action.admin.cluster.storedscripts;
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -34,12 +34,12 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestPutStoredScriptAction extends BaseRestHandler {
@Inject
public RestPutStoredScriptAction(Settings settings, RestController controller, Client client) {
this(settings, controller, true, client);
public RestPutStoredScriptAction(Settings settings, RestController controller) {
this(settings, controller, true);
}
protected RestPutStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
super(settings, client);
protected RestPutStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
super(settings);
if (registerDefaultHandlers) {
controller.registerHandler(POST, "/_scripts/{lang}/{id}", this);
controller.registerHandler(PUT, "/_scripts/{lang}/{id}", this);
@ -51,7 +51,7 @@ public class RestPutStoredScriptAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, NodeClient client) {
PutStoredScriptRequest putRequest = new PutStoredScriptRequest(getScriptLang(request), request.param("id"));
putRequest.script(request.content());
client.admin().cluster().putStoredScript(putRequest, new AcknowledgedRestListener<>(channel));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.tasks;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -35,13 +35,13 @@ import org.elasticsearch.rest.action.support.RestToXContentListener;
public class RestPendingClusterTasksAction extends BaseRestHandler {
@Inject
public RestPendingClusterTasksAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestPendingClusterTasksAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));

View File

@ -20,7 +20,7 @@
package org.elasticsearch.rest.action.admin.indices;
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.RestToXContentListener;
public class RestRolloverIndexAction extends BaseRestHandler {
@Inject
public RestRolloverIndexAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestRolloverIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover", this);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover/{new_index}", this);
}
@SuppressWarnings({"unchecked"})
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
RolloverRequest rolloverIndexRequest = new RolloverRequest(request.param("index"), request.param("new_index"));
if (request.hasContent()) {
rolloverIndexRequest.source(request.content());

View File

@ -20,7 +20,7 @@
package org.elasticsearch.rest.action.admin.indices;
import org.elasticsearch.action.admin.indices.shrink.ShrinkRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestShrinkIndexAction extends BaseRestHandler {
@Inject
public RestShrinkIndexAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestShrinkIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_shrink/{target}", this);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_shrink/{target}", this);
}
@SuppressWarnings({"unchecked"})
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
if (request.param("target") == null) {
throw new IllegalArgumentException("no target index");
}

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.alias;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.AliasAction;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -46,13 +46,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestIndicesAliasesAction extends BaseRestHandler {
@Inject
public RestIndicesAliasesAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestIndicesAliasesAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_aliases", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));
try (XContentParser parser = XContentFactory.xContent(request.content()).createParser(request.content())) {

View File

@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.alias.delete;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -37,14 +37,14 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestIndexDeleteAliasesAction extends BaseRestHandler {
@Inject
public RestIndexDeleteAliasesAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestIndexDeleteAliasesAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(DELETE, "/{index}/_alias/{name}", this);
controller.registerHandler(DELETE, "/{index}/_aliases/{name}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final String[] aliases = Strings.splitStringByCommaToArray(request.param("name"));
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();

View File

@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.AliasMetaData;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -50,14 +50,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetAliasesAction extends BaseRestHandler {
@Inject
public RestGetAliasesAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestGetAliasesAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_alias/{name}", this);
controller.registerHandler(GET, "/{index}/_alias/{name}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] aliases = request.paramAsStringArrayOrEmptyIfAll("name");
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);

View File

@ -24,7 +24,7 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.inject.Inject;
@ -44,15 +44,15 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestAliasesExistAction extends BaseRestHandler {
@Inject
public RestAliasesExistAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestAliasesExistAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(HEAD, "/_alias/{name}", this);
controller.registerHandler(HEAD, "/{index}/_alias/{name}", this);
controller.registerHandler(HEAD, "/{index}/_alias", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] aliases = request.paramAsStringArray("name", Strings.EMPTY_ARRAY);
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.indices.alias.put;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.AliasAction;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestIndexPutAliasAction extends BaseRestHandler {
@Inject
public RestIndexPutAliasAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestIndexPutAliasAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(PUT, "/{index}/_alias/{name}", this);
controller.registerHandler(PUT, "/_alias/{name}", this);
controller.registerHandler(PUT, "/{index}/_aliases/{name}", this);
@ -62,7 +62,7 @@ public class RestIndexPutAliasAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
String alias = request.param("name");
Map<String, Object> filter = null;

View File

@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.analyze;
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.bytes.BytesReference;
@ -60,8 +60,8 @@ public class RestAnalyzeAction extends BaseRestHandler {
}
@Inject
public RestAnalyzeAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestAnalyzeAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_analyze", this);
controller.registerHandler(GET, "/{index}/_analyze", this);
controller.registerHandler(POST, "/_analyze", this);
@ -69,7 +69,7 @@ public class RestAnalyzeAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] texts = request.paramAsStringArrayOrEmptyIfAll("text");

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.cache.clear;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.Strings;
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestClearIndicesCacheAction extends BaseRestHandler {
@Inject
public RestClearIndicesCacheAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestClearIndicesCacheAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_cache/clear", this);
controller.registerHandler(POST, "/{index}/_cache/clear", this);
@ -60,7 +60,7 @@ public class RestClearIndicesCacheAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(Strings.splitStringByCommaToArray(request.param("index")));
clearIndicesCacheRequest.indicesOptions(IndicesOptions.fromRequest(request, clearIndicesCacheRequest.indicesOptions()));
fromRequest(request, clearIndicesCacheRequest, parseFieldMatcher);

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.close;
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestCloseIndexAction extends BaseRestHandler {
@Inject
public RestCloseIndexAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestCloseIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.POST, "/_close", this);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_close", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
closeIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", closeIndexRequest.masterNodeTimeout()));
closeIndexRequest.timeout(request.paramAsTime("timeout", closeIndexRequest.timeout()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.indices.create;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -36,15 +36,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestCreateIndexAction extends BaseRestHandler {
@Inject
public RestCreateIndexAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestCreateIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.PUT, "/{index}", this);
controller.registerHandler(RestRequest.Method.POST, "/{index}", this);
}
@SuppressWarnings({"unchecked"})
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index"));
if (request.hasContent()) {
createIndexRequest.source(request.content());

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.delete;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestDeleteIndexAction extends BaseRestHandler {
@Inject
public RestDeleteIndexAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestDeleteIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.DELETE, "/", this);
controller.registerHandler(RestRequest.Method.DELETE, "/{index}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
deleteIndexRequest.timeout(request.paramAsTime("timeout", deleteIndexRequest.timeout()));
deleteIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexRequest.masterNodeTimeout()));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.exists.indices;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.inject.Inject;
@ -45,13 +45,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestIndicesExistsAction extends BaseRestHandler {
@Inject
public RestIndicesExistsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestIndicesExistsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(HEAD, "/{index}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
IndicesExistsRequest indicesExistsRequest = new IndicesExistsRequest(Strings.splitStringByCommaToArray(request.param("index")));
indicesExistsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesExistsRequest.indicesOptions()));
indicesExistsRequest.local(request.paramAsBoolean("local", indicesExistsRequest.local()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.indices.exists.types;
import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest;
import org.elasticsearch.action.admin.indices.exists.types.TypesExistsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.inject.Inject;
@ -44,13 +44,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestTypesExistsAction extends BaseRestHandler {
@Inject
public RestTypesExistsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestTypesExistsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(HEAD, "/{index}/{type}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
TypesExistsRequest typesExistsRequest = new TypesExistsRequest(
Strings.splitStringByCommaToArray(request.param("index")), Strings.splitStringByCommaToArray(request.param("type"))
);

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.flush;
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestFlushAction extends BaseRestHandler {
@Inject
public RestFlushAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestFlushAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_flush", this);
controller.registerHandler(POST, "/{index}/_flush", this);
@ -56,7 +56,7 @@ public class RestFlushAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
FlushRequest flushRequest = new FlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
flushRequest.indicesOptions(IndicesOptions.fromRequest(request, flushRequest.indicesOptions()));
flushRequest.force(request.paramAsBoolean("force", flushRequest.force()));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.flush;
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
import org.elasticsearch.action.admin.indices.flush.SyncedFlushResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestSyncedFlushAction extends BaseRestHandler {
@Inject
public RestSyncedFlushAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestSyncedFlushAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_flush/synced", this);
controller.registerHandler(POST, "/{index}/_flush/synced", this);
@ -54,7 +54,7 @@ public class RestSyncedFlushAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.lenientExpandOpen());
SyncedFlushRequest syncedFlushRequest = new SyncedFlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
syncedFlushRequest.indicesOptions(indicesOptions);

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.forcemerge;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -45,14 +45,14 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestForceMergeAction extends BaseRestHandler {
@Inject
public RestForceMergeAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestForceMergeAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_forcemerge", this);
controller.registerHandler(POST, "/{index}/_forcemerge", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
ForceMergeRequest mergeRequest = new ForceMergeRequest(Strings.splitStringByCommaToArray(request.param("index")));
mergeRequest.indicesOptions(IndicesOptions.fromRequest(request, mergeRequest.indicesOptions()));
mergeRequest.maxNumSegments(request.paramAsInt("max_num_segments", mergeRequest.maxNumSegments()));

View File

@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.AliasMetaData;
import org.elasticsearch.cluster.metadata.MappingMetaData;
import org.elasticsearch.common.Strings;
@ -57,8 +57,8 @@ public class RestGetIndicesAction extends BaseRestHandler {
private final SettingsFilter settingsFilter;
@Inject
public RestGetIndicesAction(Settings settings, RestController controller, Client client, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter) {
super(settings, client);
public RestGetIndicesAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter) {
super(settings);
this.indexScopedSettings = indexScopedSettings;
controller.registerHandler(GET, "/{index}", this);
controller.registerHandler(GET, "/{index}/{type}", this);
@ -66,7 +66,7 @@ public class RestGetIndicesAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
String[] featureParams = request.paramAsStringArray("type", null);
// Work out if the indices is a list of features

View File

@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsReques
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetFieldMappingAction extends BaseRestHandler {
@Inject
public RestGetFieldMappingAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestGetFieldMappingAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_mapping/field/{fields}", this);
controller.registerHandler(GET, "/_mapping/{type}/field/{fields}", this);
controller.registerHandler(GET, "/{index}/_mapping/field/{fields}", this);
@ -60,7 +60,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
final String[] fields = Strings.splitStringByCommaToArray(request.param("fields"));

View File

@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.MappingMetaData;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.ImmutableOpenMap;
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetMappingAction extends BaseRestHandler {
@Inject
public RestGetMappingAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestGetMappingAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/{index}/{type}/_mapping", this);
controller.registerHandler(GET, "/{index}/_mappings/{type}", this);
controller.registerHandler(GET, "/{index}/_mapping/{type}", this);
@ -59,7 +59,7 @@ public class RestGetMappingAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
GetMappingsRequest getMappingsRequest = new GetMappingsRequest();

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.mapping.put;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -43,8 +43,8 @@ public class RestPutMappingAction extends BaseRestHandler {
@Inject
public RestPutMappingAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestPutMappingAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(PUT, "/{index}/_mapping/", this);
controller.registerHandler(PUT, "/{index}/{type}/_mapping", this);
controller.registerHandler(PUT, "/{index}/_mapping/{type}", this);
@ -68,7 +68,7 @@ public class RestPutMappingAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
PutMappingRequest putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index")));
putMappingRequest.type(request.param("type"));
putMappingRequest.source(request.content().toUtf8());

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.open;
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestOpenIndexAction extends BaseRestHandler {
@Inject
public RestOpenIndexAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestOpenIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.POST, "/_open", this);
controller.registerHandler(RestRequest.Method.POST, "/{index}/_open", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
OpenIndexRequest openIndexRequest = new OpenIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.recovery;
import org.elasticsearch.action.admin.indices.recovery.RecoveryRequest;
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -44,14 +44,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestRecoveryAction extends BaseRestHandler {
@Inject
public RestRecoveryAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestRecoveryAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_recovery", this);
controller.registerHandler(GET, "/{index}/_recovery", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
recoveryRequest.detailed(request.paramAsBoolean("detailed", false));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.refresh;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestRefreshAction extends BaseRestHandler {
@Inject
public RestRefreshAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestRefreshAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_refresh", this);
controller.registerHandler(POST, "/{index}/_refresh", this);
@ -56,7 +56,7 @@ public class RestRefreshAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
RefreshRequest refreshRequest = new RefreshRequest(Strings.splitStringByCommaToArray(request.param("index")));
refreshRequest.indicesOptions(IndicesOptions.fromRequest(request, refreshRequest.indicesOptions()));
client.admin().indices().refresh(refreshRequest, new RestBuilderListener<RefreshResponse>(channel) {

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.segments;
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentResponse;
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -44,14 +44,14 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestIndicesSegmentsAction extends BaseRestHandler {
@Inject
public RestIndicesSegmentsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestIndicesSegmentsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_segments", this);
controller.registerHandler(GET, "/{index}/_segments", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(Strings.splitStringByCommaToArray(request.param("index")));
indicesSegmentsRequest.verbose(request.paramAsBoolean("verbose", false));
indicesSegmentsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesSegmentsRequest.indicesOptions()));

View File

@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.IndexScopedSettings;
@ -47,8 +47,8 @@ public class RestGetSettingsAction extends BaseRestHandler {
private final SettingsFilter settingsFilter;
@Inject
public RestGetSettingsAction(Settings settings, RestController controller, Client client, IndexScopedSettings indexScopedSettings, final SettingsFilter settingsFilter) {
super(settings, client);
public RestGetSettingsAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, final SettingsFilter settingsFilter) {
super(settings);
this.indexScopedSettings = indexScopedSettings;
controller.registerHandler(GET, "/{index}/_settings/{name}", this);
controller.registerHandler(GET, "/_settings/{name}", this);
@ -57,7 +57,7 @@ public class RestGetSettingsAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] names = request.paramAsStringArrayOrEmptyIfAll("name");
final boolean renderDefaults = request.paramAsBoolean("include_defaults", false);
GetSettingsRequest getSettingsRequest = new GetSettingsRequest()

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.indices.settings;
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -53,14 +53,14 @@ public class RestUpdateSettingsAction extends BaseRestHandler {
"allow_no_indices"));
@Inject
public RestUpdateSettingsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestUpdateSettingsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_settings", this);
controller.registerHandler(RestRequest.Method.PUT, "/_settings", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(Strings.splitStringByCommaToArray(request.param("index")));
updateSettingsRequest.timeout(request.paramAsTime("timeout", updateSettingsRequest.timeout()));
updateSettingsRequest.setPreserveExisting(request.paramAsBoolean("preserve_existing", updateSettingsRequest.isPreserveExisting()));

View File

@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresAction;
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest;
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -45,14 +45,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestIndicesShardStoresAction extends BaseRestHandler {
@Inject
public RestIndicesShardStoresAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestIndicesShardStoresAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_shard_stores", this);
controller.registerHandler(GET, "/{index}/_shard_stores", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
IndicesShardStoresRequest indicesShardStoresRequest = new IndicesShardStoresRequest(Strings.splitStringByCommaToArray(request.param("index")));
if (request.hasParam("status")) {
indicesShardStoresRequest.shardStatuses(Strings.splitStringByCommaToArray(request.param("status")));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.stats;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestIndicesStatsAction extends BaseRestHandler {
@Inject
public RestIndicesStatsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestIndicesStatsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_stats", this);
controller.registerHandler(GET, "/_stats/{metric}", this);
controller.registerHandler(GET, "/_stats/{metric}/{indexMetric}", this);
@ -56,7 +56,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
indicesStatsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesStatsRequest.indicesOptions()));
indicesStatsRequest.indices(Strings.splitStringByCommaToArray(request.param("index")));

View File

@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.template.delete;
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -35,13 +35,13 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestDeleteIndexTemplateAction extends BaseRestHandler {
@Inject
public RestDeleteIndexTemplateAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestDeleteIndexTemplateAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name"));
deleteIndexTemplateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexTemplateRequest.masterNodeTimeout()));
client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new AcknowledgedRestListener<DeleteIndexTemplateResponse>(channel));

View File

@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.template.get;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -49,15 +49,15 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetIndexTemplateAction extends BaseRestHandler {
@Inject
public RestGetIndexTemplateAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestGetIndexTemplateAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_template", this);
controller.registerHandler(GET, "/_template/{name}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] names = Strings.splitStringByCommaToArray(request.param("name"));
GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(names);

View File

@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.template.head;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -42,14 +42,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestHeadIndexTemplateAction extends BaseRestHandler {
@Inject
public RestHeadIndexTemplateAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestHeadIndexTemplateAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(HEAD, "/_template/{name}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(request.param("name"));
getIndexTemplatesRequest.local(request.paramAsBoolean("local", getIndexTemplatesRequest.local()));
getIndexTemplatesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexTemplatesRequest.masterNodeTimeout()));

View File

@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.template.put;
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestPutIndexTemplateAction extends BaseRestHandler {
@Inject
public RestPutIndexTemplateAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestPutIndexTemplateAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.PUT, "/_template/{name}", this);
controller.registerHandler(RestRequest.Method.POST, "/_template/{name}", this);
}
@SuppressWarnings({"unchecked"})
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
putRequest.template(request.param("template", putRequest.template()));
putRequest.order(request.paramAsInt("order", putRequest.order()));

View File

@ -23,7 +23,8 @@ import org.elasticsearch.Version;
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse;
import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeRequest;
import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.inject.Inject;
@ -48,8 +49,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestUpgradeAction extends BaseRestHandler {
@Inject
public RestUpgradeAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestUpgradeAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_upgrade", this);
controller.registerHandler(POST, "/{index}/_upgrade", this);
@ -58,7 +59,7 @@ public class RestUpgradeAction extends BaseRestHandler {
}
@Override
protected void handleRequest(RestRequest request, RestChannel channel, Client client) throws Exception {
public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
if (request.method().equals(RestRequest.Method.GET)) {
handleGet(request, channel, client);
} else if (request.method().equals(RestRequest.Method.POST)) {
@ -66,7 +67,7 @@ public class RestUpgradeAction extends BaseRestHandler {
}
}
void handleGet(final RestRequest request, RestChannel channel, Client client) {
void handleGet(final RestRequest request, RestChannel channel, NodeClient client) {
client.admin().indices().prepareUpgradeStatus(Strings.splitStringByCommaToArray(request.param("index")))
.execute(new RestBuilderListener<UpgradeStatusResponse>(channel) {
@Override
@ -79,7 +80,7 @@ public class RestUpgradeAction extends BaseRestHandler {
});
}
void handlePost(final RestRequest request, RestChannel channel, Client client) {
void handlePost(final RestRequest request, RestChannel channel, NodeClient client) {
UpgradeRequest upgradeReq = new UpgradeRequest(Strings.splitStringByCommaToArray(request.param("index")));
upgradeReq.upgradeOnlyAncientSegments(request.paramAsBoolean("only_ancient_segments", false));
client.admin().indices().upgrade(upgradeReq, new RestBuilderListener<UpgradeResponse>(channel) {

View File

@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.validate.query.QueryExplanation;
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -55,8 +55,8 @@ public class RestValidateQueryAction extends BaseRestHandler {
private final IndicesQueriesRegistry indicesQueriesRegistry;
@Inject
public RestValidateQueryAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings, client);
public RestValidateQueryAction(Settings settings, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings);
controller.registerHandler(GET, "/_validate/query", this);
controller.registerHandler(POST, "/_validate/query", this);
controller.registerHandler(GET, "/{index}/_validate/query", this);
@ -67,7 +67,7 @@ public class RestValidateQueryAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(Strings.splitStringByCommaToArray(request.param("index")));
validateQueryRequest.indicesOptions(IndicesOptions.fromRequest(request, validateQueryRequest.indicesOptions()));
validateQueryRequest.explain(request.paramAsBoolean("explain", false));

View File

@ -24,7 +24,7 @@ import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.bulk.BulkShardRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.Requests;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
@ -56,8 +56,8 @@ public class RestBulkAction extends BaseRestHandler {
private final boolean allowExplicitIndex;
@Inject
public RestBulkAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestBulkAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/_bulk", this);
controller.registerHandler(PUT, "/_bulk", this);
@ -70,7 +70,7 @@ public class RestBulkAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
BulkRequest bulkRequest = Requests.bulkRequest();
String defaultIndex = request.param("index");
String defaultType = request.param("type");

View File

@ -18,7 +18,7 @@
*/
package org.elasticsearch.rest.action.cat;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.io.UTF8StreamWriter;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
@ -38,18 +38,18 @@ import static org.elasticsearch.rest.action.support.RestTable.pad;
*/
public abstract class AbstractCatAction extends BaseRestHandler {
public AbstractCatAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public AbstractCatAction(Settings settings, RestController controller) {
super(settings);
}
protected abstract void doRequest(final RestRequest request, final RestChannel channel, final Client client);
protected abstract void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client);
protected abstract void documentation(StringBuilder sb);
protected abstract Table getTableWithHeader(final RestRequest request);
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
boolean helpWanted = request.paramAsBoolean("help", false);
if (helpWanted) {
Table table = getTableWithHeader(request);

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.AliasMetaData;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table;
@ -44,15 +44,15 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestAliasAction extends AbstractCatAction {
@Inject
public RestAliasAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestAliasAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/aliases", this);
controller.registerHandler(GET, "/_cat/aliases/{alias}", this);
}
@Override
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
protected void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final GetAliasesRequest getAliasesRequest = request.hasParam("alias") ?
new GetAliasesRequest(request.param("alias")) :
new GetAliasesRequest();

View File

@ -26,7 +26,7 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.common.Strings;
@ -48,8 +48,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestAllocationAction extends AbstractCatAction {
@Inject
public RestAllocationAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestAllocationAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/allocation", this);
controller.registerHandler(GET, "/_cat/allocation/{nodes}", this);
}
@ -60,7 +60,7 @@ public class RestAllocationAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] nodes = Strings.splitStringByCommaToArray(request.param("nodes", "data:true"));
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.clear().routingTable(true);

View File

@ -19,7 +19,7 @@
package org.elasticsearch.rest.action.cat;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -40,8 +40,8 @@ public class RestCatAction extends BaseRestHandler {
private final String HELP;
@Inject
public RestCatAction(Settings settings, RestController controller, Set<AbstractCatAction> catActions, Client client) {
super(settings, client);
public RestCatAction(Settings settings, RestController controller, Set<AbstractCatAction> catActions) {
super(settings);
controller.registerHandler(GET, "/_cat", this);
StringBuilder sb = new StringBuilder();
sb.append(CAT_NL);
@ -52,7 +52,7 @@ public class RestCatAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
channel.sendResponse(new BytesRestResponse(RestStatus.OK, HELP));
}
}

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.bytes.BytesArray;
@ -45,8 +45,8 @@ public class RestCountAction extends AbstractCatAction {
private final IndicesQueriesRegistry indicesQueriesRegistry;
@Inject
public RestCountAction(Settings settings, RestController restController, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings, controller, client);
public RestCountAction(Settings settings, RestController restController, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings, controller);
restController.registerHandler(GET, "/_cat/count", this);
restController.registerHandler(GET, "/_cat/count/{index}", this);
this.indicesQueriesRegistry = indicesQueriesRegistry;
@ -59,7 +59,7 @@ public class RestCountAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
SearchRequest countRequest = new SearchRequest(indices);
String source = request.param("source");

View File

@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectLongCursor;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -43,14 +43,14 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestFielddataAction extends AbstractCatAction {
@Inject
public RestFielddataAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestFielddataAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/fielddata", this);
controller.registerHandler(GET, "/_cat/fielddata/{fields}", this);
}
@Override
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
protected void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
nodesStatsRequest.clear();
nodesStatsRequest.indices(true);

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestHealthAction extends AbstractCatAction {
@Inject
public RestHealthAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestHealthAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/health", this);
}
@ -50,7 +50,7 @@ public class RestHealthAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
ClusterHealthRequest clusterHealthRequest = new ClusterHealthRequest();
client.admin().cluster().health(clusterHealthRequest, new RestResponseListener<ClusterHealthResponse>(channel) {

View File

@ -27,7 +27,7 @@ import org.elasticsearch.action.admin.indices.stats.IndexStats;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.client.Requests;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.health.ClusterIndexHealth;
@ -57,8 +57,8 @@ public class RestIndicesAction extends AbstractCatAction {
private final IndexNameExpressionResolver indexNameExpressionResolver;
@Inject
public RestIndicesAction(Settings settings, RestController controller, Client client, IndexNameExpressionResolver indexNameExpressionResolver) {
super(settings, controller, client);
public RestIndicesAction(Settings settings, RestController controller, IndexNameExpressionResolver indexNameExpressionResolver) {
super(settings, controller);
this.indexNameExpressionResolver = indexNameExpressionResolver;
controller.registerHandler(GET, "/_cat/indices", this);
controller.registerHandler(GET, "/_cat/indices/{index}", this);
@ -71,7 +71,7 @@ public class RestIndicesAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.clear().indices(indices).metaData(true);

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Table;
@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestMasterAction extends AbstractCatAction {
@Inject
public RestMasterAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestMasterAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/master", this);
}
@ -50,7 +50,7 @@ public class RestMasterAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.clear().nodes(true);
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));

View File

@ -24,7 +24,7 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Strings;
@ -47,8 +47,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestNodeAttrsAction extends AbstractCatAction {
@Inject
public RestNodeAttrsAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestNodeAttrsAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/nodeattrs", this);
}
@ -58,7 +58,7 @@ public class RestNodeAttrsAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.clear().nodes(true);
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));

View File

@ -27,7 +27,7 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Strings;
@ -72,8 +72,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestNodesAction extends AbstractCatAction {
@Inject
public RestNodesAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestNodesAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/nodes", this);
}
@ -83,7 +83,7 @@ public class RestNodesAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.clear().nodes(true);
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.service.PendingClusterTask;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.inject.Inject;
@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestPendingClusterTasksAction extends AbstractCatAction {
@Inject
public RestPendingClusterTasksAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestPendingClusterTasksAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/pending_tasks", this);
}
@ -48,7 +48,7 @@ public class RestPendingClusterTasksAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));

View File

@ -24,7 +24,7 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Table;
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestPluginsAction extends AbstractCatAction {
@Inject
public RestPluginsAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestPluginsAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/plugins", this);
}
@ -55,7 +55,7 @@ public class RestPluginsAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.clear().nodes(true);
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));

View File

@ -23,7 +23,7 @@ import org.apache.lucene.util.CollectionUtil;
import org.elasticsearch.action.admin.indices.recovery.RecoveryRequest;
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.inject.Inject;
@ -51,8 +51,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestRecoveryAction extends AbstractCatAction {
@Inject
public RestRecoveryAction(Settings settings, RestController restController, RestController controller, Client client) {
super(settings, controller, client);
public RestRecoveryAction(Settings settings, RestController restController, RestController controller) {
super(settings, controller);
restController.registerHandler(GET, "/_cat/recovery", this);
restController.registerHandler(GET, "/_cat/recovery/{index}", this);
}
@ -64,7 +64,7 @@ public class RestRecoveryAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
recoveryRequest.activeOnly(request.paramAsBoolean("active_only", false));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.inject.Inject;
@ -40,13 +40,13 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
*/
public class RestRepositoriesAction extends AbstractCatAction {
@Inject
public RestRepositoriesAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestRepositoriesAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/repositories", this);
}
@Override
protected void doRequest(RestRequest request, RestChannel channel, Client client) {
protected void doRequest(RestRequest request, RestChannel channel, NodeClient client) {
GetRepositoriesRequest getRepositoriesRequest = new GetRepositoriesRequest();
getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local()));
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));

View File

@ -26,7 +26,7 @@ import org.elasticsearch.action.admin.indices.segments.IndexShardSegments;
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentResponse;
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
import org.elasticsearch.action.admin.indices.segments.ShardSegments;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table;
@ -49,14 +49,14 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestSegmentsAction extends AbstractCatAction {
@Inject
public RestSegmentsAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestSegmentsAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/segments", this);
controller.registerHandler(GET, "/_cat/segments/{index}", this);
}
@Override
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
protected void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();

View File

@ -25,7 +25,7 @@ import org.elasticsearch.action.admin.indices.stats.CommonStats;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.action.admin.indices.stats.ShardStats;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.UnassignedInfo;
@ -49,8 +49,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestShardsAction extends AbstractCatAction {
@Inject
public RestShardsAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestShardsAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/shards", this);
controller.registerHandler(GET, "/_cat/shards/{index}", this);
}
@ -62,7 +62,7 @@ public class RestShardsAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.cat;
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Table;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -47,13 +47,13 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
*/
public class RestSnapshotAction extends AbstractCatAction {
@Inject
public RestSnapshotAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestSnapshotAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/snapshots/{repository}", this);
}
@Override
protected void doRequest(final RestRequest request, RestChannel channel, Client client) {
protected void doRequest(final RestRequest request, RestChannel channel, NodeClient client) {
GetSnapshotsRequest getSnapshotsRequest = new GetSnapshotsRequest()
.repository(request.param("repository"))
.snapshots(new String[]{GetSnapshotsRequest.ALL_SNAPSHOTS});

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
import org.elasticsearch.action.admin.cluster.node.tasks.list.TaskGroup;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.service.ClusterService;
@ -51,8 +51,8 @@ public class RestTasksAction extends AbstractCatAction {
private final ClusterService clusterService;
@Inject
public RestTasksAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
super(settings, controller, client);
public RestTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/tasks", this);
this.clusterService = clusterService;
}
@ -63,7 +63,7 @@ public class RestTasksAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
client.admin().cluster().listTasks(generateListTasksRequest(request), new RestResponseListener<ListTasksResponse>(channel) {
@Override
public RestResponse buildResponse(ListTasksResponse listTasksResponse) throws Exception {

View File

@ -27,7 +27,7 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.Strings;
@ -108,8 +108,8 @@ public class RestThreadPoolAction extends AbstractCatAction {
}
@Inject
public RestThreadPoolAction(Settings settings, RestController controller, Client client) {
super(settings, controller, client);
public RestThreadPoolAction(Settings settings, RestController controller) {
super(settings, controller);
controller.registerHandler(GET, "/_cat/thread_pool", this);
}
@ -119,7 +119,7 @@ public class RestThreadPoolAction extends AbstractCatAction {
}
@Override
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
clusterStateRequest.clear().nodes(true);
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.count;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.inject.Inject;
@ -53,8 +53,8 @@ public class RestCountAction extends BaseRestHandler {
private final IndicesQueriesRegistry indicesQueriesRegistry;
@Inject
public RestCountAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings, client);
public RestCountAction(Settings settings, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings);
controller.registerHandler(POST, "/_count", this);
controller.registerHandler(GET, "/_count", this);
controller.registerHandler(POST, "/{index}/_count", this);
@ -65,7 +65,7 @@ public class RestCountAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
SearchRequest countRequest = new SearchRequest(Strings.splitStringByCommaToArray(request.param("index")));
countRequest.indicesOptions(IndicesOptions.fromRequest(request, countRequest.indicesOptions()));
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().size(0);

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.delete;
import org.elasticsearch.action.WriteConsistencyLevel;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.VersionType;
@ -40,13 +40,13 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteAction extends BaseRestHandler {
@Inject
public RestDeleteAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestDeleteAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(DELETE, "/{index}/{type}/{id}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
DeleteRequest deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id"));
deleteRequest.routing(request.param("routing"));
deleteRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.explain;
import org.apache.lucene.search.Explanation;
import org.elasticsearch.action.explain.ExplainRequest;
import org.elasticsearch.action.explain.ExplainResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.inject.Inject;
@ -56,15 +56,15 @@ public class RestExplainAction extends BaseRestHandler {
private final IndicesQueriesRegistry indicesQueriesRegistry;
@Inject
public RestExplainAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings, client);
public RestExplainAction(Settings settings, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
super(settings);
this.indicesQueriesRegistry = indicesQueriesRegistry;
controller.registerHandler(GET, "/{index}/{type}/{id}/_explain", this);
controller.registerHandler(POST, "/{index}/{type}/{id}/_explain", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final ExplainRequest explainRequest = new ExplainRequest(request.param("index"), request.param("type"), request.param("id"));
explainRequest.parent(request.param("parent"));
explainRequest.routing(request.param("routing"));

View File

@ -23,7 +23,7 @@ import org.elasticsearch.action.fieldstats.FieldStats;
import org.elasticsearch.action.fieldstats.FieldStatsRequest;
import org.elasticsearch.action.fieldstats.FieldStatsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -49,8 +49,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestFieldStatsAction extends BaseRestHandler {
@Inject
public RestFieldStatsAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestFieldStatsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_field_stats", this);
controller.registerHandler(POST, "/_field_stats", this);
controller.registerHandler(GET, "/{index}/_field_stats", this);
@ -59,7 +59,7 @@ public class RestFieldStatsAction extends BaseRestHandler {
@Override
public void handleRequest(final RestRequest request,
final RestChannel channel, final Client client) throws Exception {
final RestChannel channel, final NodeClient client) throws Exception {
if (RestActions.hasBodyContent(request) && request.hasParam("fields")) {
throw new IllegalArgumentException("can't specify a request body and [fields] request parameter, " +
"either specify a request body or the [fields] request parameter");

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.get;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -47,13 +47,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetAction extends BaseRestHandler {
@Inject
public RestGetAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestGetAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/{index}/{type}/{id}", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
getRequest.operationThreaded(true);
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.get;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -47,13 +47,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetSourceAction extends BaseRestHandler {
@Inject
public RestGetSourceAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestGetSourceAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/{index}/{type}/{id}/_source", this);
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
getRequest.operationThreaded(true);
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.get;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.inject.Inject;
@ -49,8 +49,8 @@ public abstract class RestHeadAction extends BaseRestHandler {
public static class Document extends RestHeadAction {
@Inject
public Document(Settings settings, RestController controller, Client client) {
super(settings, client, false);
public Document(Settings settings, RestController controller) {
super(settings, false);
controller.registerHandler(HEAD, "/{index}/{type}/{id}", this);
}
}
@ -61,8 +61,8 @@ public abstract class RestHeadAction extends BaseRestHandler {
public static class Source extends RestHeadAction {
@Inject
public Source(Settings settings, RestController controller, Client client) {
super(settings, client, true);
public Source(Settings settings, RestController controller) {
super(settings, true);
controller.registerHandler(HEAD, "/{index}/{type}/{id}/_source", this);
}
}
@ -73,17 +73,16 @@ public abstract class RestHeadAction extends BaseRestHandler {
* All subclasses must be registered in {@link org.elasticsearch.common.network.NetworkModule}.
*
* @param settings injected settings
* @param client injected client
* @param source {@code false} to check for {@link GetResponse#isExists()}.
* {@code true} to also check for {@link GetResponse#isSourceEmpty()}.
*/
public RestHeadAction(Settings settings, Client client, boolean source) {
super(settings, client);
public RestHeadAction(Settings settings, boolean source) {
super(settings);
this.source = source;
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
getRequest.operationThreaded(true);
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.get;
import org.elasticsearch.action.get.MultiGetRequest;
import org.elasticsearch.action.get.MultiGetResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
@ -41,8 +41,8 @@ public class RestMultiGetAction extends BaseRestHandler {
private final boolean allowExplicitIndex;
@Inject
public RestMultiGetAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestMultiGetAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_mget", this);
controller.registerHandler(POST, "/_mget", this);
controller.registerHandler(GET, "/{index}/_mget", this);
@ -54,7 +54,7 @@ public class RestMultiGetAction extends BaseRestHandler {
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
MultiGetRequest multiGetRequest = new MultiGetRequest();
multiGetRequest.refresh(request.paramAsBoolean("refresh", multiGetRequest.refresh()));
multiGetRequest.preference(request.param("preference"));

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.index;
import org.elasticsearch.action.WriteConsistencyLevel;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -46,30 +46,30 @@ import static org.elasticsearch.rest.RestStatus.BAD_REQUEST;
public class RestIndexAction extends BaseRestHandler {
@Inject
public RestIndexAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestIndexAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation
controller.registerHandler(PUT, "/{index}/{type}/{id}", this);
controller.registerHandler(POST, "/{index}/{type}/{id}", this);
CreateHandler createHandler = new CreateHandler(settings, controller, client);
CreateHandler createHandler = new CreateHandler(settings, controller);
controller.registerHandler(PUT, "/{index}/{type}/{id}/_create", createHandler);
controller.registerHandler(POST, "/{index}/{type}/{id}/_create", createHandler);
}
final class CreateHandler extends BaseRestHandler {
protected CreateHandler(Settings settings, RestController controller, Client client) {
super(settings, client);
protected CreateHandler(Settings settings, RestController controller) {
super(settings);
}
@Override
public void handleRequest(RestRequest request, RestChannel channel, final Client client) {
public void handleRequest(RestRequest request, RestChannel channel, final NodeClient client) {
request.params().put("op_type", "create");
RestIndexAction.this.handleRequest(request, channel, client);
}
}
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
IndexRequest indexRequest = new IndexRequest(request.param("index"), request.param("type"), request.param("id"));
indexRequest.routing(request.param("routing"));
indexRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing

View File

@ -20,7 +20,7 @@
package org.elasticsearch.rest.action.ingest;
import org.elasticsearch.action.ingest.DeletePipelineRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
@ -32,13 +32,13 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestDeletePipelineAction extends BaseRestHandler {
@Inject
public RestDeletePipelineAction(Settings settings, RestController controller, Client client) {
super(settings, client);
public RestDeletePipelineAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.DELETE, "/_ingest/pipeline/{id}", this);
}
@Override
protected void handleRequest(RestRequest restRequest, RestChannel channel, Client client) throws Exception {
public void handleRequest(RestRequest restRequest, RestChannel channel, NodeClient client) throws Exception {
DeletePipelineRequest request = new DeletePipelineRequest(restRequest.param("id"));
request.masterNodeTimeout(restRequest.paramAsTime("master_timeout", request.masterNodeTimeout()));
request.timeout(restRequest.paramAsTime("timeout", request.timeout()));

Some files were not shown because too many files have changed in this diff Show More