Merge pull request #19170 from rjernst/rest_handler_client
Changed rest handler interface to take NodeClient
This commit is contained in:
commit
8275ab497b
|
@ -19,6 +19,12 @@
|
||||||
|
|
||||||
package org.elasticsearch.http;
|
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.Nullable;
|
||||||
import org.elasticsearch.common.breaker.CircuitBreaker;
|
import org.elasticsearch.common.breaker.CircuitBreaker;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
|
@ -39,11 +45,6 @@ import org.elasticsearch.rest.RestRequest;
|
||||||
import org.elasticsearch.rest.RestResponse;
|
import org.elasticsearch.rest.RestResponse;
|
||||||
import org.elasticsearch.rest.RestStatus;
|
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.FORBIDDEN;
|
||||||
import static org.elasticsearch.rest.RestStatus.INTERNAL_SERVER_ERROR;
|
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 NodeService nodeService;
|
||||||
|
|
||||||
|
private final NodeClient client;
|
||||||
|
|
||||||
private final CircuitBreakerService circuitBreakerService;
|
private final CircuitBreakerService circuitBreakerService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public HttpServer(Settings settings, HttpServerTransport transport, RestController restController, NodeService nodeService,
|
public HttpServer(Settings settings, HttpServerTransport transport, RestController restController, NodeService nodeService,
|
||||||
CircuitBreakerService circuitBreakerService) {
|
NodeClient client, CircuitBreakerService circuitBreakerService) {
|
||||||
super(settings);
|
super(settings);
|
||||||
this.transport = transport;
|
this.transport = transport;
|
||||||
this.restController = restController;
|
this.restController = restController;
|
||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
|
this.client = client;
|
||||||
this.circuitBreakerService = circuitBreakerService;
|
this.circuitBreakerService = circuitBreakerService;
|
||||||
nodeService.setHttpServer(this);
|
nodeService.setHttpServer(this);
|
||||||
transport.httpServerAdapter(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
|
// iff we could reserve bytes for the request we need to send the response also over this channel
|
||||||
responseChannel = new ResourceHandlingHttpChannel(channel, circuitBreakerService, contentLength);
|
responseChannel = new ResourceHandlingHttpChannel(channel, circuitBreakerService, contentLength);
|
||||||
restController.dispatchRequest(request, responseChannel, threadContext);
|
restController.dispatchRequest(request, responseChannel, client, threadContext);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
restController.sendErrorResponse(request, responseChannel, t);
|
restController.sendErrorResponse(request, responseChannel, t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,6 +284,7 @@ public class Node implements Closeable {
|
||||||
modules.add(b -> {
|
modules.add(b -> {
|
||||||
b.bind(PluginsService.class).toInstance(pluginsService);
|
b.bind(PluginsService.class).toInstance(pluginsService);
|
||||||
b.bind(Client.class).toInstance(client);
|
b.bind(Client.class).toInstance(client);
|
||||||
|
b.bind(NodeClient.class).toInstance(client);
|
||||||
b.bind(Environment.class).toInstance(environment);
|
b.bind(Environment.class).toInstance(environment);
|
||||||
b.bind(ThreadPool.class).toInstance(threadPool);
|
b.bind(ThreadPool.class).toInstance(threadPool);
|
||||||
b.bind(NodeEnvironment.class).toInstance(nodeEnvironment);
|
b.bind(NodeEnvironment.class).toInstance(nodeEnvironment);
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package org.elasticsearch.rest;
|
package org.elasticsearch.rest;
|
||||||
|
|
||||||
import org.elasticsearch.client.Client;
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
import org.elasticsearch.common.ParseFieldMatcher;
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
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 abstract class BaseRestHandler extends AbstractComponent implements RestHandler {
|
||||||
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX =
|
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX =
|
||||||
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope);
|
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope);
|
||||||
private final Client client;
|
|
||||||
protected final ParseFieldMatcher parseFieldMatcher;
|
protected final ParseFieldMatcher parseFieldMatcher;
|
||||||
|
|
||||||
protected BaseRestHandler(Settings settings, Client client) {
|
protected BaseRestHandler(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
this.client = client;
|
|
||||||
this.parseFieldMatcher = new ParseFieldMatcher(settings);
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.rest;
|
package org.elasticsearch.rest;
|
||||||
|
|
||||||
|
import org.elasticsearch.client.node.NodeClient;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||||
|
@ -150,7 +151,7 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
|
||||||
return (handler != null) ? handler.canTripCircuitBreaker() : true;
|
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)) {
|
if (!checkRequestParameters(request, channel)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -162,10 +163,10 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (filters.length == 0) {
|
if (filters.length == 0) {
|
||||||
executeHandler(request, channel);
|
executeHandler(request, channel, client);
|
||||||
} else {
|
} else {
|
||||||
ControllerFilterChain filterChain = new ControllerFilterChain(handlerFilter);
|
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;
|
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);
|
final RestHandler handler = getHandler(request);
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
handler.handleRequest(request, channel);
|
handler.handleRequest(request, channel, client);
|
||||||
} else {
|
} else {
|
||||||
if (request.method() == RestRequest.Method.OPTIONS) {
|
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)
|
// 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
|
@Override
|
||||||
public void continueProcessing(RestRequest request, RestChannel channel) {
|
public void continueProcessing(RestRequest request, RestChannel channel, NodeClient client) {
|
||||||
try {
|
try {
|
||||||
int loc = index.getAndIncrement();
|
int loc = index.getAndIncrement();
|
||||||
if (loc > filters.length) {
|
if (loc > filters.length) {
|
||||||
throw new IllegalStateException("filter continueProcessing was called more than expected");
|
throw new IllegalStateException("filter continueProcessing was called more than expected");
|
||||||
} else if (loc == filters.length) {
|
} else if (loc == filters.length) {
|
||||||
executionFilter.process(request, channel, this);
|
executionFilter.process(request, channel, client, this);
|
||||||
} else {
|
} else {
|
||||||
RestFilter preProcessor = filters[loc];
|
RestFilter preProcessor = filters[loc];
|
||||||
preProcessor.process(request, channel, this);
|
preProcessor.process(request, channel, client, this);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
try {
|
try {
|
||||||
|
@ -285,8 +286,8 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
|
||||||
class RestHandlerFilter extends RestFilter {
|
class RestHandlerFilter extends RestFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(RestRequest request, RestChannel channel, RestFilterChain filterChain) throws Exception {
|
public void process(RestRequest request, RestChannel channel, NodeClient client, RestFilterChain filterChain) throws Exception {
|
||||||
executeHandler(request, channel);
|
executeHandler(request, channel, client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ package org.elasticsearch.rest;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
|
||||||
|
import org.elasticsearch.client.node.NodeClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A filter allowing to filter rest operations.
|
* 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
|
* Process the rest request. Using the channel to send a response, or the filter chain to continue
|
||||||
* processing the request.
|
* 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.elasticsearch.rest;
|
package org.elasticsearch.rest;
|
||||||
|
|
||||||
|
import org.elasticsearch.client.node.NodeClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A filter chain allowing to continue and process the rest request.
|
* 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
|
* Continue processing the request. Should only be called if a response has not been sent
|
||||||
* through the channel.
|
* through the channel.
|
||||||
*/
|
*/
|
||||||
void continueProcessing(RestRequest request, RestChannel channel);
|
void continueProcessing(RestRequest request, RestChannel channel, NodeClient client);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,21 @@
|
||||||
|
|
||||||
package org.elasticsearch.rest;
|
package org.elasticsearch.rest;
|
||||||
|
|
||||||
|
import org.elasticsearch.client.node.NodeClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for REST requests
|
* Handler for REST requests
|
||||||
*/
|
*/
|
||||||
public interface RestHandler {
|
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() {
|
default boolean canTripCircuitBreaker() {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -19,11 +19,12 @@
|
||||||
|
|
||||||
package org.elasticsearch.rest.action.admin.cluster.allocation;
|
package org.elasticsearch.rest.action.admin.cluster.allocation;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.elasticsearch.ExceptionsHelper;
|
import org.elasticsearch.ExceptionsHelper;
|
||||||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
|
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
|
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.node.NodeClient;
|
||||||
import org.elasticsearch.client.Requests;
|
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
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.RestActions;
|
||||||
import org.elasticsearch.rest.action.support.RestBuilderListener;
|
import org.elasticsearch.rest.action.support.RestBuilderListener;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class handling cluster allocation explanation at the REST level
|
* Class handling cluster allocation explanation at the REST level
|
||||||
*/
|
*/
|
||||||
public class RestClusterAllocationExplainAction extends BaseRestHandler {
|
public class RestClusterAllocationExplainAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClusterAllocationExplainAction(Settings settings, RestController controller, Client client) {
|
public RestClusterAllocationExplainAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/allocation/explain", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/allocation/explain", this);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/_cluster/allocation/explain", this);
|
controller.registerHandler(RestRequest.Method.POST, "/_cluster/allocation/explain", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
ClusterAllocationExplainRequest req;
|
||||||
if (RestActions.hasBodyContent(request) == false) {
|
if (RestActions.hasBodyContent(request) == false) {
|
||||||
// Empty request signals "explain the first unassigned shard you find"
|
// Empty request signals "explain the first unassigned shard you find"
|
||||||
|
|
|
@ -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.ClusterHealthRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
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.cluster.health.ClusterHealthStatus;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -42,15 +42,15 @@ import static org.elasticsearch.client.Requests.clusterHealthRequest;
|
||||||
public class RestClusterHealthAction extends BaseRestHandler {
|
public class RestClusterHealthAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClusterHealthAction(Settings settings, RestController controller, Client client) {
|
public RestClusterHealthAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
|
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/health", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/health", this);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/health/{index}", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/health/{index}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 clusterHealthRequest = clusterHealthRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local()));
|
clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local()));
|
||||||
clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout()));
|
clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -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.NodeHotThreads;
|
||||||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequest;
|
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -42,8 +42,8 @@ import org.elasticsearch.rest.action.support.RestResponseListener;
|
||||||
public class RestNodesHotThreadsAction extends BaseRestHandler {
|
public class RestNodesHotThreadsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestNodesHotThreadsAction(Settings settings, RestController controller, Client client) {
|
public RestNodesHotThreadsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hotthreads", this);
|
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/hot_threads", this);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/{nodeId}/hotthreads", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/{nodeId}/hotthreads", this);
|
||||||
|
@ -56,7 +56,7 @@ public class RestNodesHotThreadsAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
|
||||||
NodesHotThreadsRequest nodesHotThreadsRequest = new NodesHotThreadsRequest(nodesIds);
|
NodesHotThreadsRequest nodesHotThreadsRequest = new NodesHotThreadsRequest(nodesIds);
|
||||||
nodesHotThreadsRequest.threads(request.paramAsInt("threads", nodesHotThreadsRequest.threads()));
|
nodesHotThreadsRequest.threads(request.paramAsInt("threads", nodesHotThreadsRequest.threads()));
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package org.elasticsearch.rest.action.admin.cluster.node.info;
|
package org.elasticsearch.rest.action.admin.cluster.node.info;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
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");
|
private final static Set<String> ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "os", "plugins", "process", "settings", "thread_pool", "transport", "ingest", "indices");
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestNodesInfoAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
|
public RestNodesInfoAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_nodes", this);
|
controller.registerHandler(GET, "/_nodes", this);
|
||||||
// this endpoint is used for metrics, not for nodeIds, like /_nodes/fs
|
// this endpoint is used for metrics, not for nodeIds, like /_nodes/fs
|
||||||
controller.registerHandler(GET, "/_nodes/{nodeId}", this);
|
controller.registerHandler(GET, "/_nodes/{nodeId}", this);
|
||||||
|
@ -59,7 +59,7 @@ public class RestNodesInfoAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
String[] nodeIds;
|
||||||
Set<String> metrics;
|
Set<String> metrics;
|
||||||
|
|
||||||
|
|
|
@ -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.cluster.node.stats.NodesStatsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestNodesStatsAction extends BaseRestHandler {
|
public class RestNodesStatsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestNodesStatsAction(Settings settings, RestController controller, Client client) {
|
public RestNodesStatsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_nodes/stats", this);
|
controller.registerHandler(GET, "/_nodes/stats", this);
|
||||||
controller.registerHandler(GET, "/_nodes/{nodeId}/stats", this);
|
controller.registerHandler(GET, "/_nodes/{nodeId}/stats", this);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class RestNodesStatsAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
|
||||||
Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));
|
Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.tasks;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest;
|
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksResponse;
|
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.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -42,15 +42,15 @@ public class RestCancelTasksAction extends BaseRestHandler {
|
||||||
private final ClusterService clusterService;
|
private final ClusterService clusterService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestCancelTasksAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
|
public RestCancelTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
this.clusterService = clusterService;
|
this.clusterService = clusterService;
|
||||||
controller.registerHandler(POST, "/_tasks/_cancel", this);
|
controller.registerHandler(POST, "/_tasks/_cancel", this);
|
||||||
controller.registerHandler(POST, "/_tasks/{taskId}/_cancel", this);
|
controller.registerHandler(POST, "/_tasks/{taskId}/_cancel", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
|
||||||
TaskId taskId = new TaskId(request.param("taskId"));
|
TaskId taskId = new TaskId(request.param("taskId"));
|
||||||
String[] actions = Strings.splitStringByCommaToArray(request.param("actions"));
|
String[] actions = Strings.splitStringByCommaToArray(request.param("actions"));
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package org.elasticsearch.rest.action.admin.cluster.node.tasks;
|
package org.elasticsearch.rest.action.admin.cluster.node.tasks;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
|
@ -35,13 +35,13 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestGetTaskAction extends BaseRestHandler {
|
public class RestGetTaskAction extends BaseRestHandler {
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetTaskAction(Settings settings, RestController controller, Client client) {
|
public RestGetTaskAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_tasks/{taskId}", this);
|
controller.registerHandler(GET, "/_tasks/{taskId}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
TaskId taskId = new TaskId(request.param("taskId"));
|
||||||
boolean waitForCompletion = request.paramAsBoolean("wait_for_completion", false);
|
boolean waitForCompletion = request.paramAsBoolean("wait_for_completion", false);
|
||||||
TimeValue timeout = request.paramAsTime("timeout", null);
|
TimeValue timeout = request.paramAsTime("timeout", null);
|
||||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.tasks;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
|
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
|
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.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -42,8 +42,8 @@ public class RestListTasksAction extends BaseRestHandler {
|
||||||
private final ClusterService clusterService;
|
private final ClusterService clusterService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestListTasksAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
|
public RestListTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
this.clusterService = clusterService;
|
this.clusterService = clusterService;
|
||||||
controller.registerHandler(GET, "/_tasks", this);
|
controller.registerHandler(GET, "/_tasks", this);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class RestListTasksAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
ActionListener<ListTasksResponse> listener = nodeSettingListener(clusterService, new RestToXContentListener<>(channel));
|
||||||
client.admin().cluster().listTasks(generateListTasksRequest(request), listener);
|
client.admin().cluster().listTasks(generateListTasksRequest(request), listener);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.DeleteRepositoryRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||||
public class RestDeleteRepositoryAction extends BaseRestHandler {
|
public class RestDeleteRepositoryAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestDeleteRepositoryAction(Settings settings, RestController controller, Client client) {
|
public RestDeleteRepositoryAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(DELETE, "/_snapshot/{repository}", this);
|
controller.registerHandler(DELETE, "/_snapshot/{repository}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 deleteRepositoryRequest = deleteRepositoryRequest(request.param("repository"));
|
||||||
deleteRepositoryRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteRepositoryRequest.masterNodeTimeout()));
|
deleteRepositoryRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteRepositoryRequest.masterNodeTimeout()));
|
||||||
deleteRepositoryRequest.timeout(request.paramAsTime("timeout", deleteRepositoryRequest.timeout()));
|
deleteRepositoryRequest.timeout(request.paramAsTime("timeout", deleteRepositoryRequest.timeout()));
|
||||||
|
|
|
@ -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.GetRepositoriesRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
|
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.RepositoriesMetaData;
|
||||||
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
|
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -49,15 +49,15 @@ public class RestGetRepositoriesAction extends BaseRestHandler {
|
||||||
private final SettingsFilter settingsFilter;
|
private final SettingsFilter settingsFilter;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetRepositoriesAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
|
public RestGetRepositoriesAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_snapshot", this);
|
controller.registerHandler(GET, "/_snapshot", this);
|
||||||
controller.registerHandler(GET, "/_snapshot/{repository}", this);
|
controller.registerHandler(GET, "/_snapshot/{repository}", this);
|
||||||
this.settingsFilter = settingsFilter;
|
this.settingsFilter = settingsFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
final String[] repositories = request.paramAsStringArray("repository", Strings.EMPTY_ARRAY);
|
||||||
GetRepositoriesRequest getRepositoriesRequest = getRepositoryRequest(repositories);
|
GetRepositoriesRequest getRepositoriesRequest = getRepositoryRequest(repositories);
|
||||||
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
|
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -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.PutRepositoryRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -40,15 +40,15 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||||
public class RestPutRepositoryAction extends BaseRestHandler {
|
public class RestPutRepositoryAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestPutRepositoryAction(Settings settings, RestController controller, Client client) {
|
public RestPutRepositoryAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(PUT, "/_snapshot/{repository}", this);
|
controller.registerHandler(PUT, "/_snapshot/{repository}", this);
|
||||||
controller.registerHandler(POST, "/_snapshot/{repository}", this);
|
controller.registerHandler(POST, "/_snapshot/{repository}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@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 putRepositoryRequest = putRepositoryRequest(request.param("repository"));
|
||||||
putRepositoryRequest.source(request.content().toUtf8());
|
putRepositoryRequest.source(request.content().toUtf8());
|
||||||
putRepositoryRequest.verify(request.paramAsBoolean("verify", true));
|
putRepositoryRequest.verify(request.paramAsBoolean("verify", true));
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package org.elasticsearch.rest.action.admin.cluster.repositories.verify;
|
package org.elasticsearch.rest.action.admin.cluster.repositories.verify;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -35,13 +35,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||||
public class RestVerifyRepositoryAction extends BaseRestHandler {
|
public class RestVerifyRepositoryAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestVerifyRepositoryAction(Settings settings, RestController controller, Client client) {
|
public RestVerifyRepositoryAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_snapshot/{repository}/_verify", this);
|
controller.registerHandler(POST, "/_snapshot/{repository}/_verify", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 verifyRepositoryRequest = verifyRepositoryRequest(request.param("repository"));
|
||||||
verifyRepositoryRequest.masterNodeTimeout(request.paramAsTime("master_timeout", verifyRepositoryRequest.masterNodeTimeout()));
|
verifyRepositoryRequest.masterNodeTimeout(request.paramAsTime("master_timeout", verifyRepositoryRequest.masterNodeTimeout()));
|
||||||
verifyRepositoryRequest.timeout(request.paramAsTime("timeout", verifyRepositoryRequest.timeout()));
|
verifyRepositoryRequest.timeout(request.paramAsTime("timeout", verifyRepositoryRequest.timeout()));
|
||||||
|
|
|
@ -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.ClusterRerouteRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse;
|
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.client.Requests;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.cluster.routing.allocation.command.AllocationCommandRegistry;
|
import org.elasticsearch.cluster.routing.allocation.command.AllocationCommandRegistry;
|
||||||
|
@ -65,16 +65,16 @@ public class RestClusterRerouteAction extends BaseRestHandler {
|
||||||
private final AllocationCommandRegistry registry;
|
private final AllocationCommandRegistry registry;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClusterRerouteAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter,
|
public RestClusterRerouteAction(Settings settings, RestController controller, SettingsFilter settingsFilter,
|
||||||
AllocationCommandRegistry registry) {
|
AllocationCommandRegistry registry) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
this.settingsFilter = settingsFilter;
|
this.settingsFilter = settingsFilter;
|
||||||
this.registry = registry;
|
this.registry = registry;
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this);
|
controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
ClusterRerouteRequest clusterRerouteRequest = createRequest(request, registry, parseFieldMatcher);
|
||||||
client.admin().cluster().reroute(clusterRerouteRequest, new AcknowledgedRestListener<ClusterRerouteResponse>(channel) {
|
client.admin().cluster().reroute(clusterRerouteRequest, new AcknowledgedRestListener<ClusterRerouteResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
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.client.Requests;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -50,15 +50,15 @@ public class RestClusterGetSettingsAction extends BaseRestHandler {
|
||||||
private final SettingsFilter settingsFilter;
|
private final SettingsFilter settingsFilter;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClusterGetSettingsAction(Settings settings, RestController controller, Client client, ClusterSettings clusterSettings, SettingsFilter settingsFilter) {
|
public RestClusterGetSettingsAction(Settings settings, RestController controller, ClusterSettings clusterSettings, SettingsFilter settingsFilter) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
this.clusterSettings = clusterSettings;
|
this.clusterSettings = clusterSettings;
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this);
|
||||||
this.settingsFilter = settingsFilter;
|
this.settingsFilter = settingsFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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()
|
ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest()
|
||||||
.routingTable(false)
|
.routingTable(false)
|
||||||
.nodes(false);
|
.nodes(false);
|
||||||
|
|
|
@ -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.ClusterUpdateSettingsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
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.client.Requests;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -42,13 +42,13 @@ import java.util.Map;
|
||||||
public class RestClusterUpdateSettingsAction extends BaseRestHandler {
|
public class RestClusterUpdateSettingsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClusterUpdateSettingsAction(Settings settings, RestController controller, Client client) {
|
public RestClusterUpdateSettingsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this);
|
controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest();
|
||||||
clusterUpdateSettingsRequest.timeout(request.paramAsTime("timeout", clusterUpdateSettingsRequest.timeout()));
|
clusterUpdateSettingsRequest.timeout(request.paramAsTime("timeout", clusterUpdateSettingsRequest.timeout()));
|
||||||
clusterUpdateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterUpdateSettingsRequest.masterNodeTimeout()));
|
clusterUpdateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterUpdateSettingsRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -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.ClusterSearchShardsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse;
|
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.client.Requests;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||||
public class RestClusterSearchShardsAction extends BaseRestHandler {
|
public class RestClusterSearchShardsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClusterSearchShardsAction(Settings settings, RestController controller, Client client) {
|
public RestClusterSearchShardsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_search_shards", this);
|
controller.registerHandler(GET, "/_search_shards", this);
|
||||||
controller.registerHandler(POST, "/_search_shards", this);
|
controller.registerHandler(POST, "/_search_shards", this);
|
||||||
controller.registerHandler(GET, "/{index}/_search_shards", this);
|
controller.registerHandler(GET, "/{index}/_search_shards", this);
|
||||||
|
@ -52,7 +52,7 @@ public class RestClusterSearchShardsAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final ClusterSearchShardsRequest clusterSearchShardsRequest = Requests.clusterSearchShardsRequest(indices);
|
final ClusterSearchShardsRequest clusterSearchShardsRequest = Requests.clusterSearchShardsRequest(indices);
|
||||||
clusterSearchShardsRequest.local(request.paramAsBoolean("local", clusterSearchShardsRequest.local()));
|
clusterSearchShardsRequest.local(request.paramAsBoolean("local", clusterSearchShardsRequest.local()));
|
||||||
|
|
|
@ -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.CreateSnapshotRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -40,14 +40,14 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||||
public class RestCreateSnapshotAction extends BaseRestHandler {
|
public class RestCreateSnapshotAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestCreateSnapshotAction(Settings settings, RestController controller, Client client) {
|
public RestCreateSnapshotAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this);
|
controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this);
|
||||||
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}", this);
|
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 createSnapshotRequest = createSnapshotRequest(request.param("repository"), request.param("snapshot"));
|
||||||
createSnapshotRequest.source(request.content().toUtf8());
|
createSnapshotRequest.source(request.content().toUtf8());
|
||||||
createSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createSnapshotRequest.masterNodeTimeout()));
|
createSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createSnapshotRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -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.DeleteSnapshotRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||||
public class RestDeleteSnapshotAction extends BaseRestHandler {
|
public class RestDeleteSnapshotAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestDeleteSnapshotAction(Settings settings, RestController controller, Client client) {
|
public RestDeleteSnapshotAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this);
|
controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 deleteSnapshotRequest = deleteSnapshotRequest(request.param("repository"), request.param("snapshot"));
|
||||||
deleteSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteSnapshotRequest.masterNodeTimeout()));
|
deleteSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteSnapshotRequest.masterNodeTimeout()));
|
||||||
client.admin().cluster().deleteSnapshot(deleteSnapshotRequest, new AcknowledgedRestListener<DeleteSnapshotResponse>(channel));
|
client.admin().cluster().deleteSnapshot(deleteSnapshotRequest, new AcknowledgedRestListener<DeleteSnapshotResponse>(channel));
|
||||||
|
|
|
@ -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.GetSnapshotsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -40,14 +40,14 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestGetSnapshotsAction extends BaseRestHandler {
|
public class RestGetSnapshotsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetSnapshotsAction(Settings settings, RestController controller, Client client) {
|
public RestGetSnapshotsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this);
|
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@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 repository = request.param("repository");
|
||||||
String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);
|
String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);
|
||||||
|
|
||||||
|
|
|
@ -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.RestoreSnapshotRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||||
public class RestRestoreSnapshotAction extends BaseRestHandler {
|
public class RestRestoreSnapshotAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestRestoreSnapshotAction(Settings settings, RestController controller, Client client) {
|
public RestRestoreSnapshotAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this);
|
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 restoreSnapshotRequest = restoreSnapshotRequest(request.param("repository"), request.param("snapshot"));
|
||||||
restoreSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", restoreSnapshotRequest.masterNodeTimeout()));
|
restoreSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", restoreSnapshotRequest.masterNodeTimeout()));
|
||||||
restoreSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false));
|
restoreSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false));
|
||||||
|
|
|
@ -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.SnapshotsStatusRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -40,15 +40,15 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestSnapshotsStatusAction extends BaseRestHandler {
|
public class RestSnapshotsStatusAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestSnapshotsStatusAction(Settings settings, RestController controller, Client client) {
|
public RestSnapshotsStatusAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}/_status", this);
|
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}/_status", this);
|
||||||
controller.registerHandler(GET, "/_snapshot/{repository}/_status", this);
|
controller.registerHandler(GET, "/_snapshot/{repository}/_status", this);
|
||||||
controller.registerHandler(GET, "/_snapshot/_status", this);
|
controller.registerHandler(GET, "/_snapshot/_status", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 repository = request.param("repository", "_all");
|
||||||
String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);
|
String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);
|
||||||
if (snapshots.length == 1 && "_all".equalsIgnoreCase(snapshots[0])) {
|
if (snapshots.length == 1 && "_all".equalsIgnoreCase(snapshots[0])) {
|
||||||
|
|
|
@ -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.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.client.Requests;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -50,8 +50,8 @@ public class RestClusterStateAction extends BaseRestHandler {
|
||||||
private final SettingsFilter settingsFilter;
|
private final SettingsFilter settingsFilter;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClusterStateAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
|
public RestClusterStateAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state", this);
|
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}", this);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}/{indices}", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}/{indices}", this);
|
||||||
|
@ -60,7 +60,7 @@ public class RestClusterStateAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest();
|
||||||
clusterStateRequest.indicesOptions(IndicesOptions.fromRequest(request, clusterStateRequest.indicesOptions()));
|
clusterStateRequest.indicesOptions(IndicesOptions.fromRequest(request, clusterStateRequest.indicesOptions()));
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package org.elasticsearch.rest.action.admin.cluster.stats;
|
package org.elasticsearch.rest.action.admin.cluster.stats;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -35,14 +35,14 @@ import org.elasticsearch.rest.action.support.RestActions.NodesResponseRestListen
|
||||||
public class RestClusterStatsAction extends BaseRestHandler {
|
public class RestClusterStatsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClusterStatsAction(Settings settings, RestController controller, Client client) {
|
public RestClusterStatsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats", this);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats/nodes/{nodeId}", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats/nodes/{nodeId}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 clusterStatsRequest = new ClusterStatsRequest().nodesIds(request.paramAsStringArray("nodeId", null));
|
||||||
clusterStatsRequest.timeout(request.param("timeout"));
|
clusterStatsRequest.timeout(request.param("timeout"));
|
||||||
client.admin().cluster().clusterStats(clusterStatsRequest, new NodesResponseRestListener<>(channel));
|
client.admin().cluster().clusterStats(clusterStatsRequest, new NodesResponseRestListener<>(channel));
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
package org.elasticsearch.rest.action.admin.cluster.storedscripts;
|
package org.elasticsearch.rest.action.admin.cluster.storedscripts;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -33,12 +33,12 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||||
public class RestDeleteStoredScriptAction extends BaseRestHandler {
|
public class RestDeleteStoredScriptAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestDeleteStoredScriptAction(Settings settings, RestController controller, Client client) {
|
public RestDeleteStoredScriptAction(Settings settings, RestController controller) {
|
||||||
this(settings, controller, true, client);
|
this(settings, controller, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RestDeleteStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
|
protected RestDeleteStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
if (registerDefaultHandlers) {
|
if (registerDefaultHandlers) {
|
||||||
controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this);
|
controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class RestDeleteStoredScriptAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
DeleteStoredScriptRequest deleteStoredScriptRequest = new DeleteStoredScriptRequest(getScriptLang(request), request.param("id"));
|
||||||
client.admin().cluster().deleteStoredScript(deleteStoredScriptRequest, new AcknowledgedRestListener<>(channel));
|
client.admin().cluster().deleteStoredScript(deleteStoredScriptRequest, new AcknowledgedRestListener<>(channel));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.GetStoredScriptRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
@ -38,12 +38,12 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestGetStoredScriptAction extends BaseRestHandler {
|
public class RestGetStoredScriptAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetStoredScriptAction(Settings settings, RestController controller, Client client) {
|
public RestGetStoredScriptAction(Settings settings, RestController controller) {
|
||||||
this(settings, controller, true, client);
|
this(settings, controller, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RestGetStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
|
protected RestGetStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
if (registerDefaultHandlers) {
|
if (registerDefaultHandlers) {
|
||||||
controller.registerHandler(GET, "/_scripts/{lang}/{id}", this);
|
controller.registerHandler(GET, "/_scripts/{lang}/{id}", this);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class RestGetStoredScriptAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
final GetStoredScriptRequest getRequest = new GetStoredScriptRequest(getScriptLang(request), request.param("id"));
|
||||||
client.admin().cluster().getStoredScript(getRequest, new RestBuilderListener<GetStoredScriptResponse>(channel) {
|
client.admin().cluster().getStoredScript(getRequest, new RestBuilderListener<GetStoredScriptResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
package org.elasticsearch.rest.action.admin.cluster.storedscripts;
|
package org.elasticsearch.rest.action.admin.cluster.storedscripts;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -34,12 +34,12 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||||
public class RestPutStoredScriptAction extends BaseRestHandler {
|
public class RestPutStoredScriptAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestPutStoredScriptAction(Settings settings, RestController controller, Client client) {
|
public RestPutStoredScriptAction(Settings settings, RestController controller) {
|
||||||
this(settings, controller, true, client);
|
this(settings, controller, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RestPutStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
|
protected RestPutStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
if (registerDefaultHandlers) {
|
if (registerDefaultHandlers) {
|
||||||
controller.registerHandler(POST, "/_scripts/{lang}/{id}", this);
|
controller.registerHandler(POST, "/_scripts/{lang}/{id}", this);
|
||||||
controller.registerHandler(PUT, "/_scripts/{lang}/{id}", this);
|
controller.registerHandler(PUT, "/_scripts/{lang}/{id}", this);
|
||||||
|
@ -51,7 +51,7 @@ public class RestPutStoredScriptAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
PutStoredScriptRequest putRequest = new PutStoredScriptRequest(getScriptLang(request), request.param("id"));
|
||||||
putRequest.script(request.content());
|
putRequest.script(request.content());
|
||||||
client.admin().cluster().putStoredScript(putRequest, new AcknowledgedRestListener<>(channel));
|
client.admin().cluster().putStoredScript(putRequest, new AcknowledgedRestListener<>(channel));
|
||||||
|
|
|
@ -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.PendingClusterTasksRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -35,13 +35,13 @@ import org.elasticsearch.rest.action.support.RestToXContentListener;
|
||||||
public class RestPendingClusterTasksAction extends BaseRestHandler {
|
public class RestPendingClusterTasksAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestPendingClusterTasksAction(Settings settings, RestController controller, Client client) {
|
public RestPendingClusterTasksAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this);
|
controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 pendingClusterTasksRequest = new PendingClusterTasksRequest();
|
||||||
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
|
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
|
||||||
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
|
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package org.elasticsearch.rest.action.admin.indices;
|
package org.elasticsearch.rest.action.admin.indices;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.RestToXContentListener;
|
||||||
public class RestRolloverIndexAction extends BaseRestHandler {
|
public class RestRolloverIndexAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestRolloverIndexAction(Settings settings, RestController controller, Client client) {
|
public RestRolloverIndexAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover", this);
|
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover", this);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover/{new_index}", this);
|
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover/{new_index}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked"})
|
||||||
@Override
|
@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"));
|
RolloverRequest rolloverIndexRequest = new RolloverRequest(request.param("index"), request.param("new_index"));
|
||||||
if (request.hasContent()) {
|
if (request.hasContent()) {
|
||||||
rolloverIndexRequest.source(request.content());
|
rolloverIndexRequest.source(request.content());
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package org.elasticsearch.rest.action.admin.indices;
|
package org.elasticsearch.rest.action.admin.indices;
|
||||||
|
|
||||||
import org.elasticsearch.action.admin.indices.shrink.ShrinkRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
||||||
public class RestShrinkIndexAction extends BaseRestHandler {
|
public class RestShrinkIndexAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestShrinkIndexAction(Settings settings, RestController controller, Client client) {
|
public RestShrinkIndexAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_shrink/{target}", this);
|
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_shrink/{target}", this);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_shrink/{target}", this);
|
controller.registerHandler(RestRequest.Method.POST, "/{index}/_shrink/{target}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked"})
|
||||||
@Override
|
@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) {
|
if (request.param("target") == null) {
|
||||||
throw new IllegalArgumentException("no target index");
|
throw new IllegalArgumentException("no target index");
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
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.cluster.metadata.AliasAction;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -46,13 +46,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||||
public class RestIndicesAliasesAction extends BaseRestHandler {
|
public class RestIndicesAliasesAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndicesAliasesAction(Settings settings, RestController controller, Client client) {
|
public RestIndicesAliasesAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_aliases", this);
|
controller.registerHandler(POST, "/_aliases", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 indicesAliasesRequest = new IndicesAliasesRequest();
|
||||||
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
||||||
try (XContentParser parser = XContentFactory.xContent(request.content()).createParser(request.content())) {
|
try (XContentParser parser = XContentFactory.xContent(request.content()).createParser(request.content())) {
|
||||||
|
|
|
@ -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.IndicesAliasesRequest;
|
||||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -37,14 +37,14 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||||
public class RestIndexDeleteAliasesAction extends BaseRestHandler {
|
public class RestIndexDeleteAliasesAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndexDeleteAliasesAction(Settings settings, RestController controller, Client client) {
|
public RestIndexDeleteAliasesAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(DELETE, "/{index}/_alias/{name}", this);
|
controller.registerHandler(DELETE, "/{index}/_alias/{name}", this);
|
||||||
controller.registerHandler(DELETE, "/{index}/_aliases/{name}", this);
|
controller.registerHandler(DELETE, "/{index}/_aliases/{name}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final String[] aliases = Strings.splitStringByCommaToArray(request.param("name"));
|
final String[] aliases = Strings.splitStringByCommaToArray(request.param("name"));
|
||||||
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
||||||
|
|
|
@ -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.GetAliasesRequest;
|
||||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.AliasMetaData;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -50,14 +50,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestGetAliasesAction extends BaseRestHandler {
|
public class RestGetAliasesAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetAliasesAction(Settings settings, RestController controller, Client client) {
|
public RestGetAliasesAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_alias/{name}", this);
|
controller.registerHandler(GET, "/_alias/{name}", this);
|
||||||
controller.registerHandler(GET, "/{index}/_alias/{name}", this);
|
controller.registerHandler(GET, "/{index}/_alias/{name}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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[] aliases = request.paramAsStringArrayOrEmptyIfAll("name");
|
||||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);
|
final GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);
|
||||||
|
|
|
@ -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.exists.AliasesExistResponse;
|
||||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -44,15 +44,15 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestAliasesExistAction extends BaseRestHandler {
|
public class RestAliasesExistAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestAliasesExistAction(Settings settings, RestController controller, Client client) {
|
public RestAliasesExistAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(HEAD, "/_alias/{name}", this);
|
controller.registerHandler(HEAD, "/_alias/{name}", this);
|
||||||
controller.registerHandler(HEAD, "/{index}/_alias/{name}", this);
|
controller.registerHandler(HEAD, "/{index}/_alias/{name}", this);
|
||||||
controller.registerHandler(HEAD, "/{index}/_alias", this);
|
controller.registerHandler(HEAD, "/{index}/_alias", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
String[] aliases = request.paramAsStringArray("name", Strings.EMPTY_ARRAY);
|
||||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);
|
GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);
|
||||||
|
|
|
@ -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;
|
||||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
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.cluster.metadata.AliasAction;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||||
public class RestIndexPutAliasAction extends BaseRestHandler {
|
public class RestIndexPutAliasAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndexPutAliasAction(Settings settings, RestController controller, Client client) {
|
public RestIndexPutAliasAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(PUT, "/{index}/_alias/{name}", this);
|
controller.registerHandler(PUT, "/{index}/_alias/{name}", this);
|
||||||
controller.registerHandler(PUT, "/_alias/{name}", this);
|
controller.registerHandler(PUT, "/_alias/{name}", this);
|
||||||
controller.registerHandler(PUT, "/{index}/_aliases/{name}", this);
|
controller.registerHandler(PUT, "/{index}/_aliases/{name}", this);
|
||||||
|
@ -62,7 +62,7 @@ public class RestIndexPutAliasAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
String alias = request.param("name");
|
String alias = request.param("name");
|
||||||
Map<String, Object> filter = null;
|
Map<String, Object> filter = null;
|
||||||
|
|
|
@ -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.AnalyzeRequest;
|
||||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
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.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
import org.elasticsearch.common.ParseFieldMatcher;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
|
@ -60,8 +60,8 @@ public class RestAnalyzeAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestAnalyzeAction(Settings settings, RestController controller, Client client) {
|
public RestAnalyzeAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_analyze", this);
|
controller.registerHandler(GET, "/_analyze", this);
|
||||||
controller.registerHandler(GET, "/{index}/_analyze", this);
|
controller.registerHandler(GET, "/{index}/_analyze", this);
|
||||||
controller.registerHandler(POST, "/_analyze", this);
|
controller.registerHandler(POST, "/_analyze", this);
|
||||||
|
@ -69,7 +69,7 @@ public class RestAnalyzeAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
String[] texts = request.paramAsStringArrayOrEmptyIfAll("text");
|
||||||
|
|
||||||
|
|
|
@ -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.ClearIndicesCacheRequest;
|
||||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
import org.elasticsearch.common.ParseFieldMatcher;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
||||||
public class RestClearIndicesCacheAction extends BaseRestHandler {
|
public class RestClearIndicesCacheAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestClearIndicesCacheAction(Settings settings, RestController controller, Client client) {
|
public RestClearIndicesCacheAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_cache/clear", this);
|
controller.registerHandler(POST, "/_cache/clear", this);
|
||||||
controller.registerHandler(POST, "/{index}/_cache/clear", this);
|
controller.registerHandler(POST, "/{index}/_cache/clear", this);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class RestClearIndicesCacheAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 clearIndicesCacheRequest = new ClearIndicesCacheRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
clearIndicesCacheRequest.indicesOptions(IndicesOptions.fromRequest(request, clearIndicesCacheRequest.indicesOptions()));
|
clearIndicesCacheRequest.indicesOptions(IndicesOptions.fromRequest(request, clearIndicesCacheRequest.indicesOptions()));
|
||||||
fromRequest(request, clearIndicesCacheRequest, parseFieldMatcher);
|
fromRequest(request, clearIndicesCacheRequest, parseFieldMatcher);
|
||||||
|
|
|
@ -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.CloseIndexRequest;
|
||||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
||||||
public class RestCloseIndexAction extends BaseRestHandler {
|
public class RestCloseIndexAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestCloseIndexAction(Settings settings, RestController controller, Client client) {
|
public RestCloseIndexAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/_close", this);
|
controller.registerHandler(RestRequest.Method.POST, "/_close", this);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_close", this);
|
controller.registerHandler(RestRequest.Method.POST, "/{index}/_close", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 closeIndexRequest = new CloseIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
closeIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", closeIndexRequest.masterNodeTimeout()));
|
closeIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", closeIndexRequest.masterNodeTimeout()));
|
||||||
closeIndexRequest.timeout(request.paramAsTime("timeout", closeIndexRequest.timeout()));
|
closeIndexRequest.timeout(request.paramAsTime("timeout", closeIndexRequest.timeout()));
|
||||||
|
|
|
@ -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.CreateIndexRequest;
|
||||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -36,15 +36,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
||||||
public class RestCreateIndexAction extends BaseRestHandler {
|
public class RestCreateIndexAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestCreateIndexAction(Settings settings, RestController controller, Client client) {
|
public RestCreateIndexAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}", this);
|
controller.registerHandler(RestRequest.Method.PUT, "/{index}", this);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/{index}", this);
|
controller.registerHandler(RestRequest.Method.POST, "/{index}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked"})
|
||||||
@Override
|
@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"));
|
CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index"));
|
||||||
if (request.hasContent()) {
|
if (request.hasContent()) {
|
||||||
createIndexRequest.source(request.content());
|
createIndexRequest.source(request.content());
|
||||||
|
|
|
@ -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.DeleteIndexRequest;
|
||||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
||||||
public class RestDeleteIndexAction extends BaseRestHandler {
|
public class RestDeleteIndexAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestDeleteIndexAction(Settings settings, RestController controller, Client client) {
|
public RestDeleteIndexAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.DELETE, "/", this);
|
controller.registerHandler(RestRequest.Method.DELETE, "/", this);
|
||||||
controller.registerHandler(RestRequest.Method.DELETE, "/{index}", this);
|
controller.registerHandler(RestRequest.Method.DELETE, "/{index}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 deleteIndexRequest = new DeleteIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
deleteIndexRequest.timeout(request.paramAsTime("timeout", deleteIndexRequest.timeout()));
|
deleteIndexRequest.timeout(request.paramAsTime("timeout", deleteIndexRequest.timeout()));
|
||||||
deleteIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexRequest.masterNodeTimeout()));
|
deleteIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -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.IndicesExistsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
|
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -45,13 +45,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestIndicesExistsAction extends BaseRestHandler {
|
public class RestIndicesExistsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndicesExistsAction(Settings settings, RestController controller, Client client) {
|
public RestIndicesExistsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(HEAD, "/{index}", this);
|
controller.registerHandler(HEAD, "/{index}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 indicesExistsRequest = new IndicesExistsRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
indicesExistsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesExistsRequest.indicesOptions()));
|
indicesExistsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesExistsRequest.indicesOptions()));
|
||||||
indicesExistsRequest.local(request.paramAsBoolean("local", indicesExistsRequest.local()));
|
indicesExistsRequest.local(request.paramAsBoolean("local", indicesExistsRequest.local()));
|
||||||
|
|
|
@ -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.TypesExistsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.exists.types.TypesExistsResponse;
|
import org.elasticsearch.action.admin.indices.exists.types.TypesExistsResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -44,13 +44,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestTypesExistsAction extends BaseRestHandler {
|
public class RestTypesExistsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestTypesExistsAction(Settings settings, RestController controller, Client client) {
|
public RestTypesExistsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(HEAD, "/{index}/{type}", this);
|
controller.registerHandler(HEAD, "/{index}/{type}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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(
|
TypesExistsRequest typesExistsRequest = new TypesExistsRequest(
|
||||||
Strings.splitStringByCommaToArray(request.param("index")), Strings.splitStringByCommaToArray(request.param("type"))
|
Strings.splitStringByCommaToArray(request.param("index")), Strings.splitStringByCommaToArray(request.param("type"))
|
||||||
);
|
);
|
||||||
|
|
|
@ -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.FlushRequest;
|
||||||
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
||||||
public class RestFlushAction extends BaseRestHandler {
|
public class RestFlushAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestFlushAction(Settings settings, RestController controller, Client client) {
|
public RestFlushAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_flush", this);
|
controller.registerHandler(POST, "/_flush", this);
|
||||||
controller.registerHandler(POST, "/{index}/_flush", this);
|
controller.registerHandler(POST, "/{index}/_flush", this);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class RestFlushAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 flushRequest = new FlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
flushRequest.indicesOptions(IndicesOptions.fromRequest(request, flushRequest.indicesOptions()));
|
flushRequest.indicesOptions(IndicesOptions.fromRequest(request, flushRequest.indicesOptions()));
|
||||||
flushRequest.force(request.paramAsBoolean("force", flushRequest.force()));
|
flushRequest.force(request.paramAsBoolean("force", flushRequest.force()));
|
||||||
|
|
|
@ -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.SyncedFlushRequest;
|
||||||
import org.elasticsearch.action.admin.indices.flush.SyncedFlushResponse;
|
import org.elasticsearch.action.admin.indices.flush.SyncedFlushResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||||
public class RestSyncedFlushAction extends BaseRestHandler {
|
public class RestSyncedFlushAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestSyncedFlushAction(Settings settings, RestController controller, Client client) {
|
public RestSyncedFlushAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_flush/synced", this);
|
controller.registerHandler(POST, "/_flush/synced", this);
|
||||||
controller.registerHandler(POST, "/{index}/_flush/synced", this);
|
controller.registerHandler(POST, "/{index}/_flush/synced", this);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class RestSyncedFlushAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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());
|
IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.lenientExpandOpen());
|
||||||
SyncedFlushRequest syncedFlushRequest = new SyncedFlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
SyncedFlushRequest syncedFlushRequest = new SyncedFlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
syncedFlushRequest.indicesOptions(indicesOptions);
|
syncedFlushRequest.indicesOptions(indicesOptions);
|
||||||
|
|
|
@ -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.ForceMergeRequest;
|
||||||
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
|
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -45,14 +45,14 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
||||||
public class RestForceMergeAction extends BaseRestHandler {
|
public class RestForceMergeAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestForceMergeAction(Settings settings, RestController controller, Client client) {
|
public RestForceMergeAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_forcemerge", this);
|
controller.registerHandler(POST, "/_forcemerge", this);
|
||||||
controller.registerHandler(POST, "/{index}/_forcemerge", this);
|
controller.registerHandler(POST, "/{index}/_forcemerge", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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")));
|
ForceMergeRequest mergeRequest = new ForceMergeRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
mergeRequest.indicesOptions(IndicesOptions.fromRequest(request, mergeRequest.indicesOptions()));
|
mergeRequest.indicesOptions(IndicesOptions.fromRequest(request, mergeRequest.indicesOptions()));
|
||||||
mergeRequest.maxNumSegments(request.paramAsInt("max_num_segments", mergeRequest.maxNumSegments()));
|
mergeRequest.maxNumSegments(request.paramAsInt("max_num_segments", mergeRequest.maxNumSegments()));
|
||||||
|
|
|
@ -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.GetIndexRequest.Feature;
|
||||||
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
|
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.AliasMetaData;
|
||||||
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -57,8 +57,8 @@ public class RestGetIndicesAction extends BaseRestHandler {
|
||||||
private final SettingsFilter settingsFilter;
|
private final SettingsFilter settingsFilter;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetIndicesAction(Settings settings, RestController controller, Client client, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter) {
|
public RestGetIndicesAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
this.indexScopedSettings = indexScopedSettings;
|
this.indexScopedSettings = indexScopedSettings;
|
||||||
controller.registerHandler(GET, "/{index}", this);
|
controller.registerHandler(GET, "/{index}", this);
|
||||||
controller.registerHandler(GET, "/{index}/{type}", this);
|
controller.registerHandler(GET, "/{index}/{type}", this);
|
||||||
|
@ -66,7 +66,7 @@ public class RestGetIndicesAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
String[] featureParams = request.paramAsStringArray("type", null);
|
String[] featureParams = request.paramAsStringArray("type", null);
|
||||||
// Work out if the indices is a list of features
|
// Work out if the indices is a list of features
|
||||||
|
|
|
@ -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;
|
||||||
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData;
|
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestGetFieldMappingAction extends BaseRestHandler {
|
public class RestGetFieldMappingAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetFieldMappingAction(Settings settings, RestController controller, Client client) {
|
public RestGetFieldMappingAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_mapping/field/{fields}", this);
|
controller.registerHandler(GET, "/_mapping/field/{fields}", this);
|
||||||
controller.registerHandler(GET, "/_mapping/{type}/field/{fields}", this);
|
controller.registerHandler(GET, "/_mapping/{type}/field/{fields}", this);
|
||||||
controller.registerHandler(GET, "/{index}/_mapping/field/{fields}", this);
|
controller.registerHandler(GET, "/{index}/_mapping/field/{fields}", this);
|
||||||
|
@ -60,7 +60,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
|
final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
|
||||||
final String[] fields = Strings.splitStringByCommaToArray(request.param("fields"));
|
final String[] fields = Strings.splitStringByCommaToArray(request.param("fields"));
|
||||||
|
|
|
@ -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.GetMappingsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.cluster.metadata.MappingMetaData;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||||
|
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestGetMappingAction extends BaseRestHandler {
|
public class RestGetMappingAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetMappingAction(Settings settings, RestController controller, Client client) {
|
public RestGetMappingAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/{index}/{type}/_mapping", this);
|
controller.registerHandler(GET, "/{index}/{type}/_mapping", this);
|
||||||
controller.registerHandler(GET, "/{index}/_mappings/{type}", this);
|
controller.registerHandler(GET, "/{index}/_mappings/{type}", this);
|
||||||
controller.registerHandler(GET, "/{index}/_mapping/{type}", this);
|
controller.registerHandler(GET, "/{index}/_mapping/{type}", this);
|
||||||
|
@ -59,7 +59,7 @@ public class RestGetMappingAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
|
final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
|
||||||
GetMappingsRequest getMappingsRequest = new GetMappingsRequest();
|
GetMappingsRequest getMappingsRequest = new GetMappingsRequest();
|
||||||
|
|
|
@ -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.PutMappingRequest;
|
||||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -43,8 +43,8 @@ public class RestPutMappingAction extends BaseRestHandler {
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestPutMappingAction(Settings settings, RestController controller, Client client) {
|
public RestPutMappingAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(PUT, "/{index}/_mapping/", this);
|
controller.registerHandler(PUT, "/{index}/_mapping/", this);
|
||||||
controller.registerHandler(PUT, "/{index}/{type}/_mapping", this);
|
controller.registerHandler(PUT, "/{index}/{type}/_mapping", this);
|
||||||
controller.registerHandler(PUT, "/{index}/_mapping/{type}", this);
|
controller.registerHandler(PUT, "/{index}/_mapping/{type}", this);
|
||||||
|
@ -68,7 +68,7 @@ public class RestPutMappingAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
putMappingRequest.type(request.param("type"));
|
putMappingRequest.type(request.param("type"));
|
||||||
putMappingRequest.source(request.content().toUtf8());
|
putMappingRequest.source(request.content().toUtf8());
|
||||||
|
|
|
@ -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.OpenIndexRequest;
|
||||||
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
||||||
public class RestOpenIndexAction extends BaseRestHandler {
|
public class RestOpenIndexAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestOpenIndexAction(Settings settings, RestController controller, Client client) {
|
public RestOpenIndexAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/_open", this);
|
controller.registerHandler(RestRequest.Method.POST, "/_open", this);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_open", this);
|
controller.registerHandler(RestRequest.Method.POST, "/{index}/_open", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 openIndexRequest = new OpenIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
|
openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
|
||||||
openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));
|
openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -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.RecoveryRequest;
|
||||||
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -44,14 +44,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestRecoveryAction extends BaseRestHandler {
|
public class RestRecoveryAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestRecoveryAction(Settings settings, RestController controller, Client client) {
|
public RestRecoveryAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_recovery", this);
|
controller.registerHandler(GET, "/_recovery", this);
|
||||||
controller.registerHandler(GET, "/{index}/_recovery", this);
|
controller.registerHandler(GET, "/{index}/_recovery", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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")));
|
final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
|
recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
|
||||||
|
|
|
@ -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.RefreshRequest;
|
||||||
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
|
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
||||||
public class RestRefreshAction extends BaseRestHandler {
|
public class RestRefreshAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestRefreshAction(Settings settings, RestController controller, Client client) {
|
public RestRefreshAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_refresh", this);
|
controller.registerHandler(POST, "/_refresh", this);
|
||||||
controller.registerHandler(POST, "/{index}/_refresh", this);
|
controller.registerHandler(POST, "/{index}/_refresh", this);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class RestRefreshAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 refreshRequest = new RefreshRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
refreshRequest.indicesOptions(IndicesOptions.fromRequest(request, refreshRequest.indicesOptions()));
|
refreshRequest.indicesOptions(IndicesOptions.fromRequest(request, refreshRequest.indicesOptions()));
|
||||||
client.admin().indices().refresh(refreshRequest, new RestBuilderListener<RefreshResponse>(channel) {
|
client.admin().indices().refresh(refreshRequest, new RestBuilderListener<RefreshResponse>(channel) {
|
||||||
|
|
|
@ -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.IndicesSegmentResponse;
|
||||||
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
|
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -44,14 +44,14 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
||||||
public class RestIndicesSegmentsAction extends BaseRestHandler {
|
public class RestIndicesSegmentsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndicesSegmentsAction(Settings settings, RestController controller, Client client) {
|
public RestIndicesSegmentsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_segments", this);
|
controller.registerHandler(GET, "/_segments", this);
|
||||||
controller.registerHandler(GET, "/{index}/_segments", this);
|
controller.registerHandler(GET, "/{index}/_segments", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 indicesSegmentsRequest = new IndicesSegmentsRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
indicesSegmentsRequest.verbose(request.paramAsBoolean("verbose", false));
|
indicesSegmentsRequest.verbose(request.paramAsBoolean("verbose", false));
|
||||||
indicesSegmentsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesSegmentsRequest.indicesOptions()));
|
indicesSegmentsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesSegmentsRequest.indicesOptions()));
|
||||||
|
|
|
@ -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.GetSettingsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||||
|
@ -47,8 +47,8 @@ public class RestGetSettingsAction extends BaseRestHandler {
|
||||||
private final SettingsFilter settingsFilter;
|
private final SettingsFilter settingsFilter;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetSettingsAction(Settings settings, RestController controller, Client client, IndexScopedSettings indexScopedSettings, final SettingsFilter settingsFilter) {
|
public RestGetSettingsAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, final SettingsFilter settingsFilter) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
this.indexScopedSettings = indexScopedSettings;
|
this.indexScopedSettings = indexScopedSettings;
|
||||||
controller.registerHandler(GET, "/{index}/_settings/{name}", this);
|
controller.registerHandler(GET, "/{index}/_settings/{name}", this);
|
||||||
controller.registerHandler(GET, "/_settings/{name}", this);
|
controller.registerHandler(GET, "/_settings/{name}", this);
|
||||||
|
@ -57,7 +57,7 @@ public class RestGetSettingsAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 String[] names = request.paramAsStringArrayOrEmptyIfAll("name");
|
||||||
final boolean renderDefaults = request.paramAsBoolean("include_defaults", false);
|
final boolean renderDefaults = request.paramAsBoolean("include_defaults", false);
|
||||||
GetSettingsRequest getSettingsRequest = new GetSettingsRequest()
|
GetSettingsRequest getSettingsRequest = new GetSettingsRequest()
|
||||||
|
|
|
@ -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.admin.indices.settings.put.UpdateSettingsRequest;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -53,14 +53,14 @@ public class RestUpdateSettingsAction extends BaseRestHandler {
|
||||||
"allow_no_indices"));
|
"allow_no_indices"));
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestUpdateSettingsAction(Settings settings, RestController controller, Client client) {
|
public RestUpdateSettingsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_settings", this);
|
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_settings", this);
|
||||||
controller.registerHandler(RestRequest.Method.PUT, "/_settings", this);
|
controller.registerHandler(RestRequest.Method.PUT, "/_settings", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 updateSettingsRequest = updateSettingsRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
updateSettingsRequest.timeout(request.paramAsTime("timeout", updateSettingsRequest.timeout()));
|
updateSettingsRequest.timeout(request.paramAsTime("timeout", updateSettingsRequest.timeout()));
|
||||||
updateSettingsRequest.setPreserveExisting(request.paramAsBoolean("preserve_existing", updateSettingsRequest.isPreserveExisting()));
|
updateSettingsRequest.setPreserveExisting(request.paramAsBoolean("preserve_existing", updateSettingsRequest.isPreserveExisting()));
|
||||||
|
|
|
@ -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.IndicesShardStoresRequest;
|
||||||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresResponse;
|
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -45,14 +45,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestIndicesShardStoresAction extends BaseRestHandler {
|
public class RestIndicesShardStoresAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndicesShardStoresAction(Settings settings, RestController controller, Client client) {
|
public RestIndicesShardStoresAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_shard_stores", this);
|
controller.registerHandler(GET, "/_shard_stores", this);
|
||||||
controller.registerHandler(GET, "/{index}/_shard_stores", this);
|
controller.registerHandler(GET, "/{index}/_shard_stores", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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")));
|
IndicesShardStoresRequest indicesShardStoresRequest = new IndicesShardStoresRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
if (request.hasParam("status")) {
|
if (request.hasParam("status")) {
|
||||||
indicesShardStoresRequest.shardStatuses(Strings.splitStringByCommaToArray(request.param("status")));
|
indicesShardStoresRequest.shardStatuses(Strings.splitStringByCommaToArray(request.param("status")));
|
||||||
|
|
|
@ -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.IndicesStatsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
||||||
public class RestIndicesStatsAction extends BaseRestHandler {
|
public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndicesStatsAction(Settings settings, RestController controller, Client client) {
|
public RestIndicesStatsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_stats", this);
|
controller.registerHandler(GET, "/_stats", this);
|
||||||
controller.registerHandler(GET, "/_stats/{metric}", this);
|
controller.registerHandler(GET, "/_stats/{metric}", this);
|
||||||
controller.registerHandler(GET, "/_stats/{metric}/{indexMetric}", this);
|
controller.registerHandler(GET, "/_stats/{metric}/{indexMetric}", this);
|
||||||
|
@ -56,7 +56,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 indicesStatsRequest = new IndicesStatsRequest();
|
||||||
indicesStatsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesStatsRequest.indicesOptions()));
|
indicesStatsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesStatsRequest.indicesOptions()));
|
||||||
indicesStatsRequest.indices(Strings.splitStringByCommaToArray(request.param("index")));
|
indicesStatsRequest.indices(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
|
|
|
@ -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.DeleteIndexTemplateRequest;
|
||||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -35,13 +35,13 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
||||||
public class RestDeleteIndexTemplateAction extends BaseRestHandler {
|
public class RestDeleteIndexTemplateAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestDeleteIndexTemplateAction(Settings settings, RestController controller, Client client) {
|
public RestDeleteIndexTemplateAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this);
|
controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name"));
|
||||||
deleteIndexTemplateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexTemplateRequest.masterNodeTimeout()));
|
deleteIndexTemplateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexTemplateRequest.masterNodeTimeout()));
|
||||||
client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new AcknowledgedRestListener<DeleteIndexTemplateResponse>(channel));
|
client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new AcknowledgedRestListener<DeleteIndexTemplateResponse>(channel));
|
||||||
|
|
|
@ -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.GetIndexTemplatesRequest;
|
||||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
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.cluster.metadata.IndexTemplateMetaData;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -49,15 +49,15 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestGetIndexTemplateAction extends BaseRestHandler {
|
public class RestGetIndexTemplateAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetIndexTemplateAction(Settings settings, RestController controller, Client client) {
|
public RestGetIndexTemplateAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
|
|
||||||
controller.registerHandler(GET, "/_template", this);
|
controller.registerHandler(GET, "/_template", this);
|
||||||
controller.registerHandler(GET, "/_template/{name}", this);
|
controller.registerHandler(GET, "/_template/{name}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
final String[] names = Strings.splitStringByCommaToArray(request.param("name"));
|
||||||
|
|
||||||
GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(names);
|
GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(names);
|
||||||
|
|
|
@ -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.GetIndexTemplatesRequest;
|
||||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
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.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -42,14 +42,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestHeadIndexTemplateAction extends BaseRestHandler {
|
public class RestHeadIndexTemplateAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestHeadIndexTemplateAction(Settings settings, RestController controller, Client client) {
|
public RestHeadIndexTemplateAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
|
|
||||||
controller.registerHandler(HEAD, "/_template/{name}", this);
|
controller.registerHandler(HEAD, "/_template/{name}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 getIndexTemplatesRequest = new GetIndexTemplatesRequest(request.param("name"));
|
||||||
getIndexTemplatesRequest.local(request.paramAsBoolean("local", getIndexTemplatesRequest.local()));
|
getIndexTemplatesRequest.local(request.paramAsBoolean("local", getIndexTemplatesRequest.local()));
|
||||||
getIndexTemplatesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexTemplatesRequest.masterNodeTimeout()));
|
getIndexTemplatesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexTemplatesRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -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.PutIndexTemplateRequest;
|
||||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
||||||
public class RestPutIndexTemplateAction extends BaseRestHandler {
|
public class RestPutIndexTemplateAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestPutIndexTemplateAction(Settings settings, RestController controller, Client client) {
|
public RestPutIndexTemplateAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.PUT, "/_template/{name}", this);
|
controller.registerHandler(RestRequest.Method.PUT, "/_template/{name}", this);
|
||||||
controller.registerHandler(RestRequest.Method.POST, "/_template/{name}", this);
|
controller.registerHandler(RestRequest.Method.POST, "/_template/{name}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked"})
|
||||||
@Override
|
@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"));
|
PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
|
||||||
putRequest.template(request.param("template", putRequest.template()));
|
putRequest.template(request.param("template", putRequest.template()));
|
||||||
putRequest.order(request.paramAsInt("order", putRequest.order()));
|
putRequest.order(request.paramAsInt("order", putRequest.order()));
|
||||||
|
|
|
@ -23,7 +23,8 @@ import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse;
|
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.UpgradeRequest;
|
||||||
import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.collect.Tuple;
|
import org.elasticsearch.common.collect.Tuple;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -48,8 +49,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
||||||
public class RestUpgradeAction extends BaseRestHandler {
|
public class RestUpgradeAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestUpgradeAction(Settings settings, RestController controller, Client client) {
|
public RestUpgradeAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_upgrade", this);
|
controller.registerHandler(POST, "/_upgrade", this);
|
||||||
controller.registerHandler(POST, "/{index}/_upgrade", this);
|
controller.registerHandler(POST, "/{index}/_upgrade", this);
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ public class RestUpgradeAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)) {
|
if (request.method().equals(RestRequest.Method.GET)) {
|
||||||
handleGet(request, channel, client);
|
handleGet(request, channel, client);
|
||||||
} else if (request.method().equals(RestRequest.Method.POST)) {
|
} 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")))
|
client.admin().indices().prepareUpgradeStatus(Strings.splitStringByCommaToArray(request.param("index")))
|
||||||
.execute(new RestBuilderListener<UpgradeStatusResponse>(channel) {
|
.execute(new RestBuilderListener<UpgradeStatusResponse>(channel) {
|
||||||
@Override
|
@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")));
|
UpgradeRequest upgradeReq = new UpgradeRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
upgradeReq.upgradeOnlyAncientSegments(request.paramAsBoolean("only_ancient_segments", false));
|
upgradeReq.upgradeOnlyAncientSegments(request.paramAsBoolean("only_ancient_segments", false));
|
||||||
client.admin().indices().upgrade(upgradeReq, new RestBuilderListener<UpgradeResponse>(channel) {
|
client.admin().indices().upgrade(upgradeReq, new RestBuilderListener<UpgradeResponse>(channel) {
|
||||||
|
|
|
@ -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.ValidateQueryRequest;
|
||||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.ParsingException;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -55,8 +55,8 @@ public class RestValidateQueryAction extends BaseRestHandler {
|
||||||
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestValidateQueryAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
|
public RestValidateQueryAction(Settings settings, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_validate/query", this);
|
controller.registerHandler(GET, "/_validate/query", this);
|
||||||
controller.registerHandler(POST, "/_validate/query", this);
|
controller.registerHandler(POST, "/_validate/query", this);
|
||||||
controller.registerHandler(GET, "/{index}/_validate/query", this);
|
controller.registerHandler(GET, "/{index}/_validate/query", this);
|
||||||
|
@ -67,7 +67,7 @@ public class RestValidateQueryAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 validateQueryRequest = new ValidateQueryRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
validateQueryRequest.indicesOptions(IndicesOptions.fromRequest(request, validateQueryRequest.indicesOptions()));
|
validateQueryRequest.indicesOptions(IndicesOptions.fromRequest(request, validateQueryRequest.indicesOptions()));
|
||||||
validateQueryRequest.explain(request.paramAsBoolean("explain", false));
|
validateQueryRequest.explain(request.paramAsBoolean("explain", false));
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.action.bulk.BulkItemResponse;
|
||||||
import org.elasticsearch.action.bulk.BulkRequest;
|
import org.elasticsearch.action.bulk.BulkRequest;
|
||||||
import org.elasticsearch.action.bulk.BulkResponse;
|
import org.elasticsearch.action.bulk.BulkResponse;
|
||||||
import org.elasticsearch.action.bulk.BulkShardRequest;
|
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.client.Requests;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -56,8 +56,8 @@ public class RestBulkAction extends BaseRestHandler {
|
||||||
private final boolean allowExplicitIndex;
|
private final boolean allowExplicitIndex;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestBulkAction(Settings settings, RestController controller, Client client) {
|
public RestBulkAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
|
|
||||||
controller.registerHandler(POST, "/_bulk", this);
|
controller.registerHandler(POST, "/_bulk", this);
|
||||||
controller.registerHandler(PUT, "/_bulk", this);
|
controller.registerHandler(PUT, "/_bulk", this);
|
||||||
|
@ -70,7 +70,7 @@ public class RestBulkAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
BulkRequest bulkRequest = Requests.bulkRequest();
|
||||||
String defaultIndex = request.param("index");
|
String defaultIndex = request.param("index");
|
||||||
String defaultType = request.param("type");
|
String defaultType = request.param("type");
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.rest.action.cat;
|
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.Table;
|
||||||
import org.elasticsearch.common.io.UTF8StreamWriter;
|
import org.elasticsearch.common.io.UTF8StreamWriter;
|
||||||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
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 abstract class AbstractCatAction extends BaseRestHandler {
|
||||||
|
|
||||||
public AbstractCatAction(Settings settings, RestController controller, Client client) {
|
public AbstractCatAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
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 void documentation(StringBuilder sb);
|
||||||
|
|
||||||
protected abstract Table getTableWithHeader(final RestRequest request);
|
protected abstract Table getTableWithHeader(final RestRequest request);
|
||||||
|
|
||||||
@Override
|
@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);
|
boolean helpWanted = request.paramAsBoolean("help", false);
|
||||||
if (helpWanted) {
|
if (helpWanted) {
|
||||||
Table table = getTableWithHeader(request);
|
Table table = getTableWithHeader(request);
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
|
||||||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
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.cluster.metadata.AliasMetaData;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.Table;
|
import org.elasticsearch.common.Table;
|
||||||
|
@ -44,15 +44,15 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestAliasAction extends AbstractCatAction {
|
public class RestAliasAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestAliasAction(Settings settings, RestController controller, Client client) {
|
public RestAliasAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/aliases", this);
|
controller.registerHandler(GET, "/_cat/aliases", this);
|
||||||
controller.registerHandler(GET, "/_cat/aliases/{alias}", this);
|
controller.registerHandler(GET, "/_cat/aliases/{alias}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@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") ?
|
final GetAliasesRequest getAliasesRequest = request.hasParam("alias") ?
|
||||||
new GetAliasesRequest(request.param("alias")) :
|
new GetAliasesRequest(request.param("alias")) :
|
||||||
new GetAliasesRequest();
|
new GetAliasesRequest();
|
||||||
|
|
|
@ -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.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
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.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -48,8 +48,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestAllocationAction extends AbstractCatAction {
|
public class RestAllocationAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestAllocationAction(Settings settings, RestController controller, Client client) {
|
public RestAllocationAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/allocation", this);
|
controller.registerHandler(GET, "/_cat/allocation", this);
|
||||||
controller.registerHandler(GET, "/_cat/allocation/{nodes}", this);
|
controller.registerHandler(GET, "/_cat/allocation/{nodes}", this);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class RestAllocationAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 String[] nodes = Strings.splitStringByCommaToArray(request.param("nodes", "data:true"));
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().routingTable(true);
|
clusterStateRequest.clear().routingTable(true);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.rest.action.cat;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -40,8 +40,8 @@ public class RestCatAction extends BaseRestHandler {
|
||||||
private final String HELP;
|
private final String HELP;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestCatAction(Settings settings, RestController controller, Set<AbstractCatAction> catActions, Client client) {
|
public RestCatAction(Settings settings, RestController controller, Set<AbstractCatAction> catActions) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_cat", this);
|
controller.registerHandler(GET, "/_cat", this);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(CAT_NL);
|
sb.append(CAT_NL);
|
||||||
|
@ -52,7 +52,7 @@ public class RestCatAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
channel.sendResponse(new BytesRestResponse(RestStatus.OK, HELP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
|
||||||
|
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.Table;
|
import org.elasticsearch.common.Table;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
|
@ -45,8 +45,8 @@ public class RestCountAction extends AbstractCatAction {
|
||||||
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestCountAction(Settings settings, RestController restController, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
|
public RestCountAction(Settings settings, RestController restController, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
restController.registerHandler(GET, "/_cat/count", this);
|
restController.registerHandler(GET, "/_cat/count", this);
|
||||||
restController.registerHandler(GET, "/_cat/count/{index}", this);
|
restController.registerHandler(GET, "/_cat/count/{index}", this);
|
||||||
this.indicesQueriesRegistry = indicesQueriesRegistry;
|
this.indicesQueriesRegistry = indicesQueriesRegistry;
|
||||||
|
@ -59,7 +59,7 @@ public class RestCountAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
SearchRequest countRequest = new SearchRequest(indices);
|
SearchRequest countRequest = new SearchRequest(indices);
|
||||||
String source = request.param("source");
|
String source = request.param("source");
|
||||||
|
|
|
@ -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.NodeStats;
|
||||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
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.Table;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -43,14 +43,14 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestFielddataAction extends AbstractCatAction {
|
public class RestFielddataAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestFielddataAction(Settings settings, RestController controller, Client client) {
|
public RestFielddataAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/fielddata", this);
|
controller.registerHandler(GET, "/_cat/fielddata", this);
|
||||||
controller.registerHandler(GET, "/_cat/fielddata/{fields}", this);
|
controller.registerHandler(GET, "/_cat/fielddata/{fields}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
|
||||||
nodesStatsRequest.clear();
|
nodesStatsRequest.clear();
|
||||||
nodesStatsRequest.indices(true);
|
nodesStatsRequest.indices(true);
|
||||||
|
|
|
@ -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.ClusterHealthRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
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.Table;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestHealthAction extends AbstractCatAction {
|
public class RestHealthAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestHealthAction(Settings settings, RestController controller, Client client) {
|
public RestHealthAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/health", this);
|
controller.registerHandler(GET, "/_cat/health", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class RestHealthAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
ClusterHealthRequest clusterHealthRequest = new ClusterHealthRequest();
|
||||||
|
|
||||||
client.admin().cluster().health(clusterHealthRequest, new RestResponseListener<ClusterHealthResponse>(channel) {
|
client.admin().cluster().health(clusterHealthRequest, new RestResponseListener<ClusterHealthResponse>(channel) {
|
||||||
|
|
|
@ -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.IndicesStatsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.client.Requests;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.cluster.health.ClusterIndexHealth;
|
import org.elasticsearch.cluster.health.ClusterIndexHealth;
|
||||||
|
@ -57,8 +57,8 @@ public class RestIndicesAction extends AbstractCatAction {
|
||||||
private final IndexNameExpressionResolver indexNameExpressionResolver;
|
private final IndexNameExpressionResolver indexNameExpressionResolver;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndicesAction(Settings settings, RestController controller, Client client, IndexNameExpressionResolver indexNameExpressionResolver) {
|
public RestIndicesAction(Settings settings, RestController controller, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
||||||
controller.registerHandler(GET, "/_cat/indices", this);
|
controller.registerHandler(GET, "/_cat/indices", this);
|
||||||
controller.registerHandler(GET, "/_cat/indices/{index}", this);
|
controller.registerHandler(GET, "/_cat/indices/{index}", this);
|
||||||
|
@ -71,7 +71,7 @@ public class RestIndicesAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().indices(indices).metaData(true);
|
clusterStateRequest.clear().indices(indices).metaData(true);
|
||||||
|
|
|
@ -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.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
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.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.common.Table;
|
import org.elasticsearch.common.Table;
|
||||||
|
@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestMasterAction extends AbstractCatAction {
|
public class RestMasterAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestMasterAction(Settings settings, RestController controller, Client client) {
|
public RestMasterAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/master", this);
|
controller.registerHandler(GET, "/_cat/master", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class RestMasterAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
|
|
|
@ -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.node.info.NodesInfoResponse;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
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.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -47,8 +47,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestNodeAttrsAction extends AbstractCatAction {
|
public class RestNodeAttrsAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestNodeAttrsAction(Settings settings, RestController controller, Client client) {
|
public RestNodeAttrsAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/nodeattrs", this);
|
controller.registerHandler(GET, "/_cat/nodeattrs", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class RestNodeAttrsAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
|
|
|
@ -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.node.stats.NodesStatsResponse;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
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.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -72,8 +72,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestNodesAction extends AbstractCatAction {
|
public class RestNodesAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestNodesAction(Settings settings, RestController controller, Client client) {
|
public RestNodesAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/nodes", this);
|
controller.registerHandler(GET, "/_cat/nodes", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class RestNodesAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
|
|
|
@ -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.PendingClusterTasksRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
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.cluster.service.PendingClusterTask;
|
||||||
import org.elasticsearch.common.Table;
|
import org.elasticsearch.common.Table;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
|
|
||||||
public class RestPendingClusterTasksAction extends AbstractCatAction {
|
public class RestPendingClusterTasksAction extends AbstractCatAction {
|
||||||
@Inject
|
@Inject
|
||||||
public RestPendingClusterTasksAction(Settings settings, RestController controller, Client client) {
|
public RestPendingClusterTasksAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/pending_tasks", this);
|
controller.registerHandler(GET, "/_cat/pending_tasks", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class RestPendingClusterTasksAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 pendingClusterTasksRequest = new PendingClusterTasksRequest();
|
||||||
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
|
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
|
||||||
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
|
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
|
||||||
|
|
|
@ -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.node.info.NodesInfoResponse;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
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.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.common.Table;
|
import org.elasticsearch.common.Table;
|
||||||
|
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestPluginsAction extends AbstractCatAction {
|
public class RestPluginsAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestPluginsAction(Settings settings, RestController controller, Client client) {
|
public RestPluginsAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/plugins", this);
|
controller.registerHandler(GET, "/_cat/plugins", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class RestPluginsAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
|
|
|
@ -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.RecoveryRequest;
|
||||||
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.Table;
|
import org.elasticsearch.common.Table;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -51,8 +51,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestRecoveryAction extends AbstractCatAction {
|
public class RestRecoveryAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestRecoveryAction(Settings settings, RestController restController, RestController controller, Client client) {
|
public RestRecoveryAction(Settings settings, RestController restController, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
restController.registerHandler(GET, "/_cat/recovery", this);
|
restController.registerHandler(GET, "/_cat/recovery", this);
|
||||||
restController.registerHandler(GET, "/_cat/recovery/{index}", this);
|
restController.registerHandler(GET, "/_cat/recovery/{index}", this);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class RestRecoveryAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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")));
|
final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
|
recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
|
||||||
recoveryRequest.activeOnly(request.paramAsBoolean("active_only", false));
|
recoveryRequest.activeOnly(request.paramAsBoolean("active_only", false));
|
||||||
|
|
|
@ -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.GetRepositoriesRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
|
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.cluster.metadata.RepositoryMetaData;
|
||||||
import org.elasticsearch.common.Table;
|
import org.elasticsearch.common.Table;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -40,13 +40,13 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
*/
|
*/
|
||||||
public class RestRepositoriesAction extends AbstractCatAction {
|
public class RestRepositoriesAction extends AbstractCatAction {
|
||||||
@Inject
|
@Inject
|
||||||
public RestRepositoriesAction(Settings settings, RestController controller, Client client) {
|
public RestRepositoriesAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/repositories", this);
|
controller.registerHandler(GET, "/_cat/repositories", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doRequest(RestRequest request, RestChannel channel, Client client) {
|
protected void doRequest(RestRequest request, RestChannel channel, NodeClient client) {
|
||||||
GetRepositoriesRequest getRepositoriesRequest = new GetRepositoriesRequest();
|
GetRepositoriesRequest getRepositoriesRequest = new GetRepositoriesRequest();
|
||||||
getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local()));
|
getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local()));
|
||||||
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
|
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
|
||||||
|
|
|
@ -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.IndicesSegmentResponse;
|
||||||
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
|
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.segments.ShardSegments;
|
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.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.Table;
|
import org.elasticsearch.common.Table;
|
||||||
|
@ -49,14 +49,14 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestSegmentsAction extends AbstractCatAction {
|
public class RestSegmentsAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestSegmentsAction(Settings settings, RestController controller, Client client) {
|
public RestSegmentsAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/segments", this);
|
controller.registerHandler(GET, "/_cat/segments", this);
|
||||||
controller.registerHandler(GET, "/_cat/segments/{index}", this);
|
controller.registerHandler(GET, "/_cat/segments/{index}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
|
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
|
|
|
@ -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.IndicesStatsRequest;
|
||||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||||
import org.elasticsearch.action.admin.indices.stats.ShardStats;
|
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.metadata.IndexMetaData;
|
||||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||||
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
import org.elasticsearch.cluster.routing.UnassignedInfo;
|
||||||
|
@ -49,8 +49,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestShardsAction extends AbstractCatAction {
|
public class RestShardsAction extends AbstractCatAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestShardsAction(Settings settings, RestController controller, Client client) {
|
public RestShardsAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/shards", this);
|
controller.registerHandler(GET, "/_cat/shards", this);
|
||||||
controller.registerHandler(GET, "/_cat/shards/{index}", this);
|
controller.registerHandler(GET, "/_cat/shards/{index}", this);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class RestShardsAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
|
|
|
@ -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.GetSnapshotsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
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.Table;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -47,13 +47,13 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
*/
|
*/
|
||||||
public class RestSnapshotAction extends AbstractCatAction {
|
public class RestSnapshotAction extends AbstractCatAction {
|
||||||
@Inject
|
@Inject
|
||||||
public RestSnapshotAction(Settings settings, RestController controller, Client client) {
|
public RestSnapshotAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/snapshots/{repository}", this);
|
controller.registerHandler(GET, "/_cat/snapshots/{repository}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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()
|
GetSnapshotsRequest getSnapshotsRequest = new GetSnapshotsRequest()
|
||||||
.repository(request.param("repository"))
|
.repository(request.param("repository"))
|
||||||
.snapshots(new String[]{GetSnapshotsRequest.ALL_SNAPSHOTS});
|
.snapshots(new String[]{GetSnapshotsRequest.ALL_SNAPSHOTS});
|
||||||
|
|
|
@ -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.ListTasksResponse;
|
||||||
import org.elasticsearch.action.admin.cluster.node.tasks.list.TaskGroup;
|
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.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
|
@ -51,8 +51,8 @@ public class RestTasksAction extends AbstractCatAction {
|
||||||
private final ClusterService clusterService;
|
private final ClusterService clusterService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestTasksAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
|
public RestTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/tasks", this);
|
controller.registerHandler(GET, "/_cat/tasks", this);
|
||||||
this.clusterService = clusterService;
|
this.clusterService = clusterService;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class RestTasksAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
client.admin().cluster().listTasks(generateListTasksRequest(request), new RestResponseListener<ListTasksResponse>(channel) {
|
||||||
@Override
|
@Override
|
||||||
public RestResponse buildResponse(ListTasksResponse listTasksResponse) throws Exception {
|
public RestResponse buildResponse(ListTasksResponse listTasksResponse) throws Exception {
|
||||||
|
|
|
@ -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.node.stats.NodesStatsResponse;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
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.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -108,8 +108,8 @@ public class RestThreadPoolAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestThreadPoolAction(Settings settings, RestController controller, Client client) {
|
public RestThreadPoolAction(Settings settings, RestController controller) {
|
||||||
super(settings, controller, client);
|
super(settings, controller);
|
||||||
controller.registerHandler(GET, "/_cat/thread_pool", this);
|
controller.registerHandler(GET, "/_cat/thread_pool", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class RestThreadPoolAction extends AbstractCatAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||||
clusterStateRequest.clear().nodes(true);
|
clusterStateRequest.clear().nodes(true);
|
||||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.count;
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -53,8 +53,8 @@ public class RestCountAction extends BaseRestHandler {
|
||||||
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestCountAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
|
public RestCountAction(Settings settings, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/_count", this);
|
controller.registerHandler(POST, "/_count", this);
|
||||||
controller.registerHandler(GET, "/_count", this);
|
controller.registerHandler(GET, "/_count", this);
|
||||||
controller.registerHandler(POST, "/{index}/_count", this);
|
controller.registerHandler(POST, "/{index}/_count", this);
|
||||||
|
@ -65,7 +65,7 @@ public class RestCountAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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")));
|
SearchRequest countRequest = new SearchRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||||
countRequest.indicesOptions(IndicesOptions.fromRequest(request, countRequest.indicesOptions()));
|
countRequest.indicesOptions(IndicesOptions.fromRequest(request, countRequest.indicesOptions()));
|
||||||
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().size(0);
|
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().size(0);
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.delete;
|
||||||
|
|
||||||
import org.elasticsearch.action.WriteConsistencyLevel;
|
import org.elasticsearch.action.WriteConsistencyLevel;
|
||||||
import org.elasticsearch.action.delete.DeleteRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.index.VersionType;
|
import org.elasticsearch.index.VersionType;
|
||||||
|
@ -40,13 +40,13 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||||
public class RestDeleteAction extends BaseRestHandler {
|
public class RestDeleteAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestDeleteAction(Settings settings, RestController controller, Client client) {
|
public RestDeleteAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(DELETE, "/{index}/{type}/{id}", this);
|
controller.registerHandler(DELETE, "/{index}/{type}/{id}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 deleteRequest = new DeleteRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
deleteRequest.routing(request.param("routing"));
|
deleteRequest.routing(request.param("routing"));
|
||||||
deleteRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
deleteRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
||||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.explain;
|
||||||
import org.apache.lucene.search.Explanation;
|
import org.apache.lucene.search.Explanation;
|
||||||
import org.elasticsearch.action.explain.ExplainRequest;
|
import org.elasticsearch.action.explain.ExplainRequest;
|
||||||
import org.elasticsearch.action.explain.ExplainResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -56,15 +56,15 @@ public class RestExplainAction extends BaseRestHandler {
|
||||||
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestExplainAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
|
public RestExplainAction(Settings settings, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
this.indicesQueriesRegistry = indicesQueriesRegistry;
|
this.indicesQueriesRegistry = indicesQueriesRegistry;
|
||||||
controller.registerHandler(GET, "/{index}/{type}/{id}/_explain", this);
|
controller.registerHandler(GET, "/{index}/{type}/{id}/_explain", this);
|
||||||
controller.registerHandler(POST, "/{index}/{type}/{id}/_explain", this);
|
controller.registerHandler(POST, "/{index}/{type}/{id}/_explain", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
final ExplainRequest explainRequest = new ExplainRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
explainRequest.parent(request.param("parent"));
|
explainRequest.parent(request.param("parent"));
|
||||||
explainRequest.routing(request.param("routing"));
|
explainRequest.routing(request.param("routing"));
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.action.fieldstats.FieldStats;
|
||||||
import org.elasticsearch.action.fieldstats.FieldStatsRequest;
|
import org.elasticsearch.action.fieldstats.FieldStatsRequest;
|
||||||
import org.elasticsearch.action.fieldstats.FieldStatsResponse;
|
import org.elasticsearch.action.fieldstats.FieldStatsResponse;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -49,8 +49,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
||||||
public class RestFieldStatsAction extends BaseRestHandler {
|
public class RestFieldStatsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestFieldStatsAction(Settings settings, RestController controller, Client client) {
|
public RestFieldStatsAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_field_stats", this);
|
controller.registerHandler(GET, "/_field_stats", this);
|
||||||
controller.registerHandler(POST, "/_field_stats", this);
|
controller.registerHandler(POST, "/_field_stats", this);
|
||||||
controller.registerHandler(GET, "/{index}/_field_stats", this);
|
controller.registerHandler(GET, "/{index}/_field_stats", this);
|
||||||
|
@ -59,7 +59,7 @@ public class RestFieldStatsAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleRequest(final RestRequest request,
|
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")) {
|
if (RestActions.hasBodyContent(request) && request.hasParam("fields")) {
|
||||||
throw new IllegalArgumentException("can't specify a request body and [fields] request parameter, " +
|
throw new IllegalArgumentException("can't specify a request body and [fields] request parameter, " +
|
||||||
"either specify a request body or the [fields] request parameter");
|
"either specify a request body or the [fields] request parameter");
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.get;
|
||||||
|
|
||||||
import org.elasticsearch.action.get.GetRequest;
|
import org.elasticsearch.action.get.GetRequest;
|
||||||
import org.elasticsearch.action.get.GetResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -47,13 +47,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestGetAction extends BaseRestHandler {
|
public class RestGetAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetAction(Settings settings, RestController controller, Client client) {
|
public RestGetAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/{index}/{type}/{id}", this);
|
controller.registerHandler(GET, "/{index}/{type}/{id}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
getRequest.operationThreaded(true);
|
getRequest.operationThreaded(true);
|
||||||
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
||||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.get;
|
||||||
import org.elasticsearch.action.ActionRequestValidationException;
|
import org.elasticsearch.action.ActionRequestValidationException;
|
||||||
import org.elasticsearch.action.get.GetRequest;
|
import org.elasticsearch.action.get.GetRequest;
|
||||||
import org.elasticsearch.action.get.GetResponse;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
@ -47,13 +47,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestGetSourceAction extends BaseRestHandler {
|
public class RestGetSourceAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetSourceAction(Settings settings, RestController controller, Client client) {
|
public RestGetSourceAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/{index}/{type}/{id}/_source", this);
|
controller.registerHandler(GET, "/{index}/{type}/{id}/_source", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
getRequest.operationThreaded(true);
|
getRequest.operationThreaded(true);
|
||||||
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.get;
|
||||||
|
|
||||||
import org.elasticsearch.action.get.GetRequest;
|
import org.elasticsearch.action.get.GetRequest;
|
||||||
import org.elasticsearch.action.get.GetResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -49,8 +49,8 @@ public abstract class RestHeadAction extends BaseRestHandler {
|
||||||
public static class Document extends RestHeadAction {
|
public static class Document extends RestHeadAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Document(Settings settings, RestController controller, Client client) {
|
public Document(Settings settings, RestController controller) {
|
||||||
super(settings, client, false);
|
super(settings, false);
|
||||||
controller.registerHandler(HEAD, "/{index}/{type}/{id}", this);
|
controller.registerHandler(HEAD, "/{index}/{type}/{id}", this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,8 @@ public abstract class RestHeadAction extends BaseRestHandler {
|
||||||
public static class Source extends RestHeadAction {
|
public static class Source extends RestHeadAction {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Source(Settings settings, RestController controller, Client client) {
|
public Source(Settings settings, RestController controller) {
|
||||||
super(settings, client, true);
|
super(settings, true);
|
||||||
controller.registerHandler(HEAD, "/{index}/{type}/{id}/_source", this);
|
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}.
|
* All subclasses must be registered in {@link org.elasticsearch.common.network.NetworkModule}.
|
||||||
*
|
*
|
||||||
* @param settings injected settings
|
* @param settings injected settings
|
||||||
* @param client injected client
|
|
||||||
* @param source {@code false} to check for {@link GetResponse#isExists()}.
|
* @param source {@code false} to check for {@link GetResponse#isExists()}.
|
||||||
* {@code true} to also check for {@link GetResponse#isSourceEmpty()}.
|
* {@code true} to also check for {@link GetResponse#isSourceEmpty()}.
|
||||||
*/
|
*/
|
||||||
public RestHeadAction(Settings settings, Client client, boolean source) {
|
public RestHeadAction(Settings settings, boolean source) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
getRequest.operationThreaded(true);
|
getRequest.operationThreaded(true);
|
||||||
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh()));
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.get;
|
||||||
|
|
||||||
import org.elasticsearch.action.get.MultiGetRequest;
|
import org.elasticsearch.action.get.MultiGetRequest;
|
||||||
import org.elasticsearch.action.get.MultiGetResponse;
|
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.Strings;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -41,8 +41,8 @@ public class RestMultiGetAction extends BaseRestHandler {
|
||||||
private final boolean allowExplicitIndex;
|
private final boolean allowExplicitIndex;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestMultiGetAction(Settings settings, RestController controller, Client client) {
|
public RestMultiGetAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(GET, "/_mget", this);
|
controller.registerHandler(GET, "/_mget", this);
|
||||||
controller.registerHandler(POST, "/_mget", this);
|
controller.registerHandler(POST, "/_mget", this);
|
||||||
controller.registerHandler(GET, "/{index}/_mget", this);
|
controller.registerHandler(GET, "/{index}/_mget", this);
|
||||||
|
@ -54,7 +54,7 @@ public class RestMultiGetAction extends BaseRestHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 multiGetRequest = new MultiGetRequest();
|
||||||
multiGetRequest.refresh(request.paramAsBoolean("refresh", multiGetRequest.refresh()));
|
multiGetRequest.refresh(request.paramAsBoolean("refresh", multiGetRequest.refresh()));
|
||||||
multiGetRequest.preference(request.param("preference"));
|
multiGetRequest.preference(request.param("preference"));
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.index;
|
||||||
|
|
||||||
import org.elasticsearch.action.WriteConsistencyLevel;
|
import org.elasticsearch.action.WriteConsistencyLevel;
|
||||||
import org.elasticsearch.action.index.IndexRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
@ -46,30 +46,30 @@ import static org.elasticsearch.rest.RestStatus.BAD_REQUEST;
|
||||||
public class RestIndexAction extends BaseRestHandler {
|
public class RestIndexAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestIndexAction(Settings settings, RestController controller, Client client) {
|
public RestIndexAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation
|
controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation
|
||||||
controller.registerHandler(PUT, "/{index}/{type}/{id}", this);
|
controller.registerHandler(PUT, "/{index}/{type}/{id}", this);
|
||||||
controller.registerHandler(POST, "/{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(PUT, "/{index}/{type}/{id}/_create", createHandler);
|
||||||
controller.registerHandler(POST, "/{index}/{type}/{id}/_create", createHandler);
|
controller.registerHandler(POST, "/{index}/{type}/{id}/_create", createHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
final class CreateHandler extends BaseRestHandler {
|
final class CreateHandler extends BaseRestHandler {
|
||||||
protected CreateHandler(Settings settings, RestController controller, Client client) {
|
protected CreateHandler(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
request.params().put("op_type", "create");
|
||||||
RestIndexAction.this.handleRequest(request, channel, client);
|
RestIndexAction.this.handleRequest(request, channel, client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 indexRequest = new IndexRequest(request.param("index"), request.param("type"), request.param("id"));
|
||||||
indexRequest.routing(request.param("routing"));
|
indexRequest.routing(request.param("routing"));
|
||||||
indexRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
indexRequest.parent(request.param("parent")); // order is important, set it after routing, so it will set the routing
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package org.elasticsearch.rest.action.ingest;
|
package org.elasticsearch.rest.action.ingest;
|
||||||
|
|
||||||
import org.elasticsearch.action.ingest.DeletePipelineRequest;
|
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.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BaseRestHandler;
|
import org.elasticsearch.rest.BaseRestHandler;
|
||||||
|
@ -32,13 +32,13 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
||||||
public class RestDeletePipelineAction extends BaseRestHandler {
|
public class RestDeletePipelineAction extends BaseRestHandler {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RestDeletePipelineAction(Settings settings, RestController controller, Client client) {
|
public RestDeletePipelineAction(Settings settings, RestController controller) {
|
||||||
super(settings, client);
|
super(settings);
|
||||||
controller.registerHandler(RestRequest.Method.DELETE, "/_ingest/pipeline/{id}", this);
|
controller.registerHandler(RestRequest.Method.DELETE, "/_ingest/pipeline/{id}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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"));
|
DeletePipelineRequest request = new DeletePipelineRequest(restRequest.param("id"));
|
||||||
request.masterNodeTimeout(restRequest.paramAsTime("master_timeout", request.masterNodeTimeout()));
|
request.masterNodeTimeout(restRequest.paramAsTime("master_timeout", request.masterNodeTimeout()));
|
||||||
request.timeout(restRequest.paramAsTime("timeout", request.timeout()));
|
request.timeout(restRequest.paramAsTime("timeout", request.timeout()));
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue