Internal: refactor copy headers mechanism

The functionality of copying headers in the REST layer (from REST requests to transport requests) remains the same. Made it a bit nicer by introducing a RestClientFactory component that is a singleton and allows to register useful headers without requiring static methods.

Plugins just have to inject the RestClientFactory now, and call its `addRelevantHeaders` method that is not static anymore.

Relates to #6513
Closes #7594
This commit is contained in:
javanna 2014-09-04 17:53:48 +02:00 committed by Luca Cavanna
parent 6f763bded9
commit 5bea31cb96
105 changed files with 449 additions and 498 deletions

View File

@ -19,151 +19,31 @@
package org.elasticsearch.rest; package org.elasticsearch.rest;
import com.google.common.collect.Sets;
import org.elasticsearch.action.*;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.FilterClient;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import java.util.Collections;
import java.util.Set;
/** /**
* Base handler for REST requests. * Base handler for REST requests.
* *
* This handler makes sure that the headers & context of the handled {@link RestRequest requests} are copied over to * This handler makes sure that the headers & context of the handled {@link RestRequest requests} are copied over to
* the transport requests executed by the associated client. While the context is fully copied over, not all the headers * the transport requests executed by the associated client. While the context is fully copied over, not all the headers
* are copied, but a selected few. It is possible to control what header are copied over by registering them using * are copied, but a selected few. It is possible to control what headers are copied over by registering them using
* {@link #addUsefulHeaders(String...)} * {@link RestClientFactory#addRelevantHeaders(String...)}
*/ */
public abstract class BaseRestHandler extends AbstractComponent implements RestHandler { public abstract class BaseRestHandler extends AbstractComponent implements RestHandler {
private static Set<String> usefulHeaders = Sets.newCopyOnWriteArraySet(); private final RestClientFactory restClientFactory;
/** protected BaseRestHandler(Settings settings, RestClientFactory restClientFactory) {
* Controls which REST headers get copied over from a {@link org.elasticsearch.rest.RestRequest} to
* its corresponding {@link org.elasticsearch.transport.TransportRequest}(s).
*
* By default no headers get copied but it is possible to extend this behaviour via plugins by calling this method.
*/
public static void addUsefulHeaders(String... headers) {
Collections.addAll(usefulHeaders, headers);
}
static Set<String> usefulHeaders() {
return usefulHeaders;
}
private final Client client;
protected BaseRestHandler(Settings settings, Client client) {
super(settings); super(settings);
this.client = client; this.restClientFactory = restClientFactory;
} }
@Override @Override
public final void handleRequest(RestRequest request, RestChannel channel) throws Exception { public final void handleRequest(RestRequest request, RestChannel channel) throws Exception {
handleRequest(request, channel, new HeadersAndContextCopyClient(client, request, usefulHeaders)); handleRequest(request, channel, restClientFactory.client(request));
} }
protected abstract void handleRequest(RestRequest request, RestChannel channel, Client client) throws Exception; protected abstract void handleRequest(RestRequest request, RestChannel channel, Client client) throws Exception;
static final class HeadersAndContextCopyClient extends FilterClient {
private final RestRequest restRequest;
private final IndicesAdmin indicesAdmin;
private final ClusterAdmin clusterAdmin;
private final Set<String> headers;
HeadersAndContextCopyClient(Client in, RestRequest restRequest, Set<String> headers) {
super(in);
this.restRequest = restRequest;
this.indicesAdmin = new IndicesAdmin(in.admin().indices(), restRequest, headers);
this.clusterAdmin = new ClusterAdmin(in.admin().cluster(), restRequest, headers);
this.headers = headers;
}
private static void copyHeadersAndContext(ActionRequest actionRequest, RestRequest restRequest, Set<String> headers) {
for (String usefulHeader : headers) {
String headerValue = restRequest.header(usefulHeader);
if (headerValue != null) {
actionRequest.putHeader(usefulHeader, headerValue);
}
}
actionRequest.copyContextFrom(restRequest);
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>> ActionFuture<Response> execute(Action<Request, Response, RequestBuilder, Client> action, Request request) {
copyHeadersAndContext(request, restRequest, headers);
return super.execute(action, request);
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>> void execute(Action<Request, Response, RequestBuilder, Client> action, Request request, ActionListener<Response> listener) {
copyHeadersAndContext(request, restRequest, headers);
super.execute(action, request, listener);
}
@Override
public ClusterAdminClient cluster() {
return clusterAdmin;
}
@Override
public IndicesAdminClient indices() {
return indicesAdmin;
}
private static final class ClusterAdmin extends FilterClient.ClusterAdmin {
private final RestRequest restRequest;
private final Set<String> headers;
private ClusterAdmin(ClusterAdminClient in, RestRequest restRequest, Set<String> headers) {
super(in);
this.restRequest = restRequest;
this.headers = headers;
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, ClusterAdminClient>> ActionFuture<Response> execute(Action<Request, Response, RequestBuilder, ClusterAdminClient> action, Request request) {
copyHeadersAndContext(request, restRequest, headers);
return super.execute(action, request);
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, ClusterAdminClient>> void execute(Action<Request, Response, RequestBuilder, ClusterAdminClient> action, Request request, ActionListener<Response> listener) {
copyHeadersAndContext(request, restRequest, headers);
super.execute(action, request, listener);
}
}
private final class IndicesAdmin extends FilterClient.IndicesAdmin {
private final RestRequest restRequest;
private final Set<String> headers;
private IndicesAdmin(IndicesAdminClient in, RestRequest restRequest, Set<String> headers) {
super(in);
this.restRequest = restRequest;
this.headers = headers;
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, IndicesAdminClient>> ActionFuture<Response> execute(Action<Request, Response, RequestBuilder, IndicesAdminClient> action, Request request) {
copyHeadersAndContext(request, restRequest, headers);
return super.execute(action, request);
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, IndicesAdminClient>> void execute(Action<Request, Response, RequestBuilder, IndicesAdminClient> action, Request request, ActionListener<Response> listener) {
copyHeadersAndContext(request, restRequest, headers);
super.execute(action, request, listener);
}
}
}
} }

View File

@ -0,0 +1,164 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.rest;
import com.google.common.collect.Sets;
import org.elasticsearch.action.*;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.FilterClient;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.common.inject.Inject;
import java.util.Collections;
import java.util.Set;
/**
* Client factory that returns a proper {@link Client} given a {@link org.elasticsearch.rest.RestRequest}.
* Makes it possible to register useful headers that will be copied over from REST requests
* to corresponding transport requests at execution time.
*/
public final class RestClientFactory {
private Set<String> relevantHeaders = Sets.newCopyOnWriteArraySet();
private final Client client;
@Inject
public RestClientFactory(Client client) {
this.client = client;
}
/**
* Returns a proper {@link Client client} given the provided {@link org.elasticsearch.rest.RestRequest}
*/
public Client client(RestRequest restRequest) {
return relevantHeaders.size() == 0 ? client : new HeadersAndContextCopyClient(client, restRequest, relevantHeaders);
}
/**
* Controls which REST headers get copied over from a {@link org.elasticsearch.rest.RestRequest} to
* its corresponding {@link org.elasticsearch.transport.TransportRequest}(s).
*
* By default no headers get copied but it is possible to extend this behaviour via plugins by calling this method.
*/
public void addRelevantHeaders(String... headers) {
Collections.addAll(relevantHeaders, headers);
}
Set<String> relevantHeaders() {
return relevantHeaders;
}
static final class HeadersAndContextCopyClient extends FilterClient {
private final RestRequest restRequest;
private final IndicesAdmin indicesAdmin;
private final ClusterAdmin clusterAdmin;
private final Set<String> headers;
HeadersAndContextCopyClient(Client in, RestRequest restRequest, Set<String> headers) {
super(in);
this.restRequest = restRequest;
this.indicesAdmin = new IndicesAdmin(in.admin().indices(), restRequest, headers);
this.clusterAdmin = new ClusterAdmin(in.admin().cluster(), restRequest, headers);
this.headers = headers;
}
private static void copyHeadersAndContext(ActionRequest actionRequest, RestRequest restRequest, Set<String> headers) {
for (String usefulHeader : headers) {
String headerValue = restRequest.header(usefulHeader);
if (headerValue != null) {
actionRequest.putHeader(usefulHeader, headerValue);
}
}
actionRequest.copyContextFrom(restRequest);
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>> ActionFuture<Response> execute(Action<Request, Response, RequestBuilder, Client> action, Request request) {
copyHeadersAndContext(request, restRequest, headers);
return super.execute(action, request);
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>> void execute(Action<Request, Response, RequestBuilder, Client> action, Request request, ActionListener<Response> listener) {
copyHeadersAndContext(request, restRequest, headers);
super.execute(action, request, listener);
}
@Override
public ClusterAdminClient cluster() {
return clusterAdmin;
}
@Override
public IndicesAdminClient indices() {
return indicesAdmin;
}
private static final class ClusterAdmin extends FilterClient.ClusterAdmin {
private final RestRequest restRequest;
private final Set<String> headers;
private ClusterAdmin(ClusterAdminClient in, RestRequest restRequest, Set<String> headers) {
super(in);
this.restRequest = restRequest;
this.headers = headers;
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, ClusterAdminClient>> ActionFuture<Response> execute(Action<Request, Response, RequestBuilder, ClusterAdminClient> action, Request request) {
copyHeadersAndContext(request, restRequest, headers);
return super.execute(action, request);
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, ClusterAdminClient>> void execute(Action<Request, Response, RequestBuilder, ClusterAdminClient> action, Request request, ActionListener<Response> listener) {
copyHeadersAndContext(request, restRequest, headers);
super.execute(action, request, listener);
}
}
private final class IndicesAdmin extends FilterClient.IndicesAdmin {
private final RestRequest restRequest;
private final Set<String> headers;
private IndicesAdmin(IndicesAdminClient in, RestRequest restRequest, Set<String> headers) {
super(in);
this.restRequest = restRequest;
this.headers = headers;
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, IndicesAdminClient>> ActionFuture<Response> execute(Action<Request, Response, RequestBuilder, IndicesAdminClient> action, Request request) {
copyHeadersAndContext(request, restRequest, headers);
return super.execute(action, request);
}
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, IndicesAdminClient>> void execute(Action<Request, Response, RequestBuilder, IndicesAdminClient> action, Request request, ActionListener<Response> listener) {
copyHeadersAndContext(request, restRequest, headers);
super.execute(action, request, listener);
}
}
}
}

View File

@ -26,10 +26,7 @@ import org.elasticsearch.client.Client;
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;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
import java.util.Locale; import java.util.Locale;
@ -42,8 +39,8 @@ import static org.elasticsearch.client.Requests.clusterHealthRequest;
public class RestClusterHealthAction extends BaseRestHandler { public class RestClusterHealthAction extends BaseRestHandler {
@Inject @Inject
public RestClusterHealthAction(Settings settings, Client client, RestController controller) { public RestClusterHealthAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -36,8 +36,8 @@ import org.elasticsearch.rest.action.support.RestResponseListener;
public class RestNodesHotThreadsAction extends BaseRestHandler { public class RestNodesHotThreadsAction extends BaseRestHandler {
@Inject @Inject
public RestNodesHotThreadsAction(Settings settings, Client client, RestController controller) { public RestNodesHotThreadsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -45,9 +45,9 @@ public class RestNodesInfoAction extends BaseRestHandler {
private final static Set<String> ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "network", "os", "plugins", "process", "settings", "thread_pool", "transport"); private final static Set<String> ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "network", "os", "plugins", "process", "settings", "thread_pool", "transport");
@Inject @Inject
public RestNodesInfoAction(Settings settings, Client client, RestController controller, public RestNodesInfoAction(Settings settings, RestController controller,
SettingsFilter settingsFilter) { SettingsFilter settingsFilter, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -35,8 +35,8 @@ import org.elasticsearch.rest.action.support.RestBuilderListener;
public class RestNodesRestartAction extends BaseRestHandler { public class RestNodesRestartAction extends BaseRestHandler {
@Inject @Inject
public RestNodesRestartAction(Settings settings, Client client, RestController controller) { public RestNodesRestartAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/_restart", this); controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/_restart", this);
controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/{nodeId}/_restart", this); controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/{nodeId}/_restart", this);

View File

@ -36,8 +36,8 @@ import org.elasticsearch.rest.action.support.RestBuilderListener;
public class RestNodesShutdownAction extends BaseRestHandler { public class RestNodesShutdownAction extends BaseRestHandler {
@Inject @Inject
public RestNodesShutdownAction(Settings settings, Client client, RestController controller) { public RestNodesShutdownAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(RestRequest.Method.POST, "/_shutdown", this); controller.registerHandler(RestRequest.Method.POST, "/_shutdown", this);
controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/_shutdown", this); controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/_shutdown", this);

View File

@ -27,10 +27,7 @@ import org.elasticsearch.client.Client;
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;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
import java.util.Set; import java.util.Set;
@ -44,8 +41,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, Client client, RestController controller) { public RestNodesStatsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteRepositoryAction extends BaseRestHandler { public class RestDeleteRepositoryAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteRepositoryAction(Settings settings, Client client, RestController controller) { public RestDeleteRepositoryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/_snapshot/{repository}", this); controller.registerHandler(DELETE, "/_snapshot/{repository}", this);
} }

View File

@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetRepositoriesAction extends BaseRestHandler { public class RestGetRepositoriesAction extends BaseRestHandler {
@Inject @Inject
public RestGetRepositoriesAction(Settings settings, Client client, RestController controller) { public RestGetRepositoriesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_snapshot", this); controller.registerHandler(GET, "/_snapshot", this);
controller.registerHandler(GET, "/_snapshot/{repository}", this); controller.registerHandler(GET, "/_snapshot/{repository}", this);
} }

View File

@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestPutRepositoryAction extends BaseRestHandler { public class RestPutRepositoryAction extends BaseRestHandler {
@Inject @Inject
public RestPutRepositoryAction(Settings settings, Client client, RestController controller) { public RestPutRepositoryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(PUT, "/_snapshot/{repository}", this); controller.registerHandler(PUT, "/_snapshot/{repository}", this);
controller.registerHandler(POST, "/_snapshot/{repository}", this); controller.registerHandler(POST, "/_snapshot/{repository}", this);
} }

View File

@ -40,9 +40,9 @@ public class RestClusterRerouteAction extends BaseRestHandler {
private final SettingsFilter settingsFilter; private final SettingsFilter settingsFilter;
@Inject @Inject
public RestClusterRerouteAction(Settings settings, Client client, RestController controller, public RestClusterRerouteAction(Settings settings, RestController controller,
SettingsFilter settingsFilter) { SettingsFilter settingsFilter, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
this.settingsFilter = settingsFilter; this.settingsFilter = settingsFilter;
controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this); controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this);
} }

View File

@ -34,8 +34,8 @@ import org.elasticsearch.rest.action.support.RestBuilderListener;
public class RestClusterGetSettingsAction extends BaseRestHandler { public class RestClusterGetSettingsAction extends BaseRestHandler {
@Inject @Inject
public RestClusterGetSettingsAction(Settings settings, Client client, RestController controller) { public RestClusterGetSettingsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this); controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this);
} }

View File

@ -38,8 +38,8 @@ import java.util.Map;
public class RestClusterUpdateSettingsAction extends BaseRestHandler { public class RestClusterUpdateSettingsAction extends BaseRestHandler {
@Inject @Inject
public RestClusterUpdateSettingsAction(Settings settings, Client client, RestController controller) { public RestClusterUpdateSettingsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this); controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this);
} }

View File

@ -27,10 +27,7 @@ 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;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
@ -41,8 +38,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, Client client, RestController controller) { public RestClusterSearchShardsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -24,10 +24,7 @@ import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRes
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
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.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
import static org.elasticsearch.client.Requests.createSnapshotRequest; import static org.elasticsearch.client.Requests.createSnapshotRequest;
@ -40,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestCreateSnapshotAction extends BaseRestHandler { public class RestCreateSnapshotAction extends BaseRestHandler {
@Inject @Inject
public RestCreateSnapshotAction(Settings settings, Client client, RestController controller) { public RestCreateSnapshotAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this); controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this);
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_create", this); controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_create", this);
} }

View File

@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteSnapshotAction extends BaseRestHandler { public class RestDeleteSnapshotAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteSnapshotAction(Settings settings, Client client, RestController controller) { public RestDeleteSnapshotAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this); controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this);
} }

View File

@ -25,10 +25,7 @@ import org.elasticsearch.client.Client;
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;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
import static org.elasticsearch.client.Requests.getSnapshotsRequest; import static org.elasticsearch.client.Requests.getSnapshotsRequest;
@ -40,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestGetSnapshotsAction extends BaseRestHandler { public class RestGetSnapshotsAction extends BaseRestHandler {
@Inject @Inject
public RestGetSnapshotsAction(Settings settings, Client client, RestController controller) { public RestGetSnapshotsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this); controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this);
} }

View File

@ -24,10 +24,7 @@ import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotR
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
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.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
import static org.elasticsearch.client.Requests.restoreSnapshotRequest; import static org.elasticsearch.client.Requests.restoreSnapshotRequest;
@ -39,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestRestoreSnapshotAction extends BaseRestHandler { public class RestRestoreSnapshotAction extends BaseRestHandler {
@Inject @Inject
public RestRestoreSnapshotAction(Settings settings, Client client, RestController controller) { public RestRestoreSnapshotAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this); controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this);
} }

View File

@ -25,10 +25,7 @@ import org.elasticsearch.client.Client;
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;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
import static org.elasticsearch.client.Requests.snapshotsStatusRequest; import static org.elasticsearch.client.Requests.snapshotsStatusRequest;
@ -40,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestSnapshotsStatusAction extends BaseRestHandler { public class RestSnapshotsStatusAction extends BaseRestHandler {
@Inject @Inject
public RestSnapshotsStatusAction(Settings settings, Client client, RestController controller) { public RestSnapshotsStatusAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -43,9 +43,9 @@ public class RestClusterStateAction extends BaseRestHandler {
private final SettingsFilter settingsFilter; private final SettingsFilter settingsFilter;
@Inject @Inject
public RestClusterStateAction(Settings settings, Client client, RestController controller, public RestClusterStateAction(Settings settings, RestController controller,
SettingsFilter settingsFilter) { SettingsFilter settingsFilter, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -24,10 +24,7 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
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.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
@ -37,8 +34,8 @@ import org.elasticsearch.rest.action.support.RestToXContentListener;
public class RestClusterStatsAction extends BaseRestHandler { public class RestClusterStatsAction extends BaseRestHandler {
@Inject @Inject
public RestClusterStatsAction(Settings settings, Client client, RestController controller) { public RestClusterStatsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -24,10 +24,7 @@ import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
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.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
/** /**
@ -35,8 +32,8 @@ import org.elasticsearch.rest.action.support.RestToXContentListener;
public class RestPendingClusterTasksAction extends BaseRestHandler { public class RestPendingClusterTasksAction extends BaseRestHandler {
@Inject @Inject
public RestPendingClusterTasksAction(Settings settings, Client client, RestController controller) { public RestPendingClusterTasksAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this); controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this);
} }

View File

@ -42,8 +42,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestIndicesAliasesAction extends BaseRestHandler { public class RestIndicesAliasesAction extends BaseRestHandler {
@Inject @Inject
public RestIndicesAliasesAction(Settings settings, Client client, RestController controller) { public RestIndicesAliasesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(POST, "/_aliases", this); controller.registerHandler(POST, "/_aliases", this);
} }

View File

@ -34,8 +34,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestIndexDeleteAliasesAction extends BaseRestHandler { public class RestIndexDeleteAliasesAction extends BaseRestHandler {
@Inject @Inject
public RestIndexDeleteAliasesAction(Settings settings, Client client, RestController controller) { public RestIndexDeleteAliasesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -45,8 +45,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetAliasesAction extends BaseRestHandler { public class RestGetAliasesAction extends BaseRestHandler {
@Inject @Inject
public RestGetAliasesAction(Settings settings, Client client, RestController controller) { public RestGetAliasesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_alias/", this); controller.registerHandler(GET, "/_alias/", this);
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);

View File

@ -45,8 +45,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetIndicesAliasesAction extends BaseRestHandler { public class RestGetIndicesAliasesAction extends BaseRestHandler {
@Inject @Inject
public RestGetIndicesAliasesAction(Settings settings, Client client, RestController controller) { public RestGetIndicesAliasesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_aliases", this); controller.registerHandler(GET, "/_aliases", this);
controller.registerHandler(GET, "/{index}/_aliases", this); controller.registerHandler(GET, "/{index}/_aliases", this);
controller.registerHandler(GET, "/{index}/_aliases/{name}", this); controller.registerHandler(GET, "/{index}/_aliases/{name}", this);

View File

@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestAliasesExistAction extends BaseRestHandler { public class RestAliasesExistAction extends BaseRestHandler {
@Inject @Inject
public RestAliasesExistAction(Settings settings, Client client, RestController controller) { public RestAliasesExistAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -42,8 +42,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, Client client, RestController controller) { public RestIndexPutAliasAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -24,10 +24,7 @@ import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
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.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.rest.action.support.RestToXContentListener;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
@ -39,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestAnalyzeAction extends BaseRestHandler { public class RestAnalyzeAction extends BaseRestHandler {
@Inject @Inject
public RestAnalyzeAction(Settings settings, Client client, RestController controller) { public RestAnalyzeAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -44,8 +44,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, Client client, RestController controller) { public RestClearIndicesCacheAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -35,8 +35,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestCloseIndexAction extends BaseRestHandler { public class RestCloseIndexAction extends BaseRestHandler {
@Inject @Inject
public RestCloseIndexAction(Settings settings, Client client, RestController controller) { public RestCloseIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -24,10 +24,7 @@ import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
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.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.AcknowledgedRestListener; import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
/** /**
@ -36,8 +33,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestCreateIndexAction extends BaseRestHandler { public class RestCreateIndexAction extends BaseRestHandler {
@Inject @Inject
public RestCreateIndexAction(Settings settings, Client client, RestController controller) { public RestCreateIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -35,8 +35,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestDeleteIndexAction extends BaseRestHandler { public class RestDeleteIndexAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteIndexAction(Settings settings, Client client, RestController controller) { public RestDeleteIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -42,9 +42,9 @@ public class RestIndicesExistsAction extends BaseRestHandler {
private final SettingsFilter settingsFilter; private final SettingsFilter settingsFilter;
@Inject @Inject
public RestIndicesExistsAction(Settings settings, Client client, RestController controller, public RestIndicesExistsAction(Settings settings, RestController controller,
SettingsFilter settingsFilter) { SettingsFilter settingsFilter, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(HEAD, "/{index}", this); controller.registerHandler(HEAD, "/{index}", this);
this.settingsFilter = settingsFilter; this.settingsFilter = settingsFilter;

View File

@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestTypesExistsAction extends BaseRestHandler { public class RestTypesExistsAction extends BaseRestHandler {
@Inject @Inject
public RestTypesExistsAction(Settings settings, Client client, RestController controller) { public RestTypesExistsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(HEAD, "/{index}/{type}", this); controller.registerHandler(HEAD, "/{index}/{type}", this);
} }

View File

@ -41,8 +41,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, Client client, RestController controller) { public RestFlushAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(POST, "/_flush", this); controller.registerHandler(POST, "/_flush", this);
controller.registerHandler(POST, "/{index}/_flush", this); controller.registerHandler(POST, "/{index}/_flush", this);

View File

@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteMappingAction extends BaseRestHandler { public class RestDeleteMappingAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteMappingAction(Settings settings, Client client, RestController controller) { public RestDeleteMappingAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/{index}/{type}/_mapping", this); controller.registerHandler(DELETE, "/{index}/{type}/_mapping", this);
controller.registerHandler(DELETE, "/{index}/{type}", this); controller.registerHandler(DELETE, "/{index}/{type}", this);
controller.registerHandler(DELETE, "/{index}/_mapping/{type}", this); controller.registerHandler(DELETE, "/{index}/_mapping/{type}", this);

View File

@ -46,8 +46,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetFieldMappingAction extends BaseRestHandler { public class RestGetFieldMappingAction extends BaseRestHandler {
@Inject @Inject
public RestGetFieldMappingAction(Settings settings, Client client, RestController controller) { public RestGetFieldMappingAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -46,8 +46,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetMappingAction extends BaseRestHandler { public class RestGetMappingAction extends BaseRestHandler {
@Inject @Inject
public RestGetMappingAction(Settings settings, Client client, RestController controller) { public RestGetMappingAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_mapping", this); controller.registerHandler(GET, "/_mapping", this);
controller.registerHandler(GET, "/{index}/_mapping", this); controller.registerHandler(GET, "/{index}/_mapping", this);
controller.registerHandler(GET, "/{index}/{type}/_mapping", this); controller.registerHandler(GET, "/{index}/{type}/_mapping", this);

View File

@ -40,8 +40,8 @@ public class RestPutMappingAction extends BaseRestHandler {
@Inject @Inject
public RestPutMappingAction(Settings settings, Client client, RestController controller) { public RestPutMappingAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -35,8 +35,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestOpenIndexAction extends BaseRestHandler { public class RestOpenIndexAction extends BaseRestHandler {
@Inject @Inject
public RestOpenIndexAction(Settings settings, Client client, RestController controller) { public RestOpenIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -41,8 +41,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestOptimizeAction extends BaseRestHandler { public class RestOptimizeAction extends BaseRestHandler {
@Inject @Inject
public RestOptimizeAction(Settings settings, Client client, RestController controller) { public RestOptimizeAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(POST, "/_optimize", this); controller.registerHandler(POST, "/_optimize", this);
controller.registerHandler(POST, "/{index}/_optimize", this); controller.registerHandler(POST, "/{index}/_optimize", this);

View File

@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestRecoveryAction extends BaseRestHandler { public class RestRecoveryAction extends BaseRestHandler {
@Inject @Inject
public RestRecoveryAction(Settings settings, Client client, RestController controller) { public RestRecoveryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_recovery", this); controller.registerHandler(GET, "/_recovery", this);
controller.registerHandler(GET, "/{index}/_recovery", this); controller.registerHandler(GET, "/{index}/_recovery", this);
} }

View File

@ -41,8 +41,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, Client client, RestController controller) { public RestRefreshAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(POST, "/_refresh", this); controller.registerHandler(POST, "/_refresh", this);
controller.registerHandler(POST, "/{index}/_refresh", this); controller.registerHandler(POST, "/{index}/_refresh", this);

View File

@ -39,8 +39,8 @@ 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, Client client, RestController controller) { public RestIndicesSegmentsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_segments", this); controller.registerHandler(GET, "/_segments", this);
controller.registerHandler(GET, "/{index}/_segments", this); controller.registerHandler(GET, "/{index}/_segments", this);
} }

View File

@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetSettingsAction extends BaseRestHandler { public class RestGetSettingsAction extends BaseRestHandler {
@Inject @Inject
public RestGetSettingsAction(Settings settings, Client client, RestController controller) { public RestGetSettingsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_settings", this); controller.registerHandler(GET, "/_settings", this);
controller.registerHandler(GET, "/{index}/_settings", this); controller.registerHandler(GET, "/{index}/_settings", this);
controller.registerHandler(GET, "/{index}/_settings/{name}", this); controller.registerHandler(GET, "/{index}/_settings/{name}", this);

View File

@ -40,8 +40,8 @@ import static org.elasticsearch.client.Requests.updateSettingsRequest;
public class RestUpdateSettingsAction extends BaseRestHandler { public class RestUpdateSettingsAction extends BaseRestHandler {
@Inject @Inject
public RestUpdateSettingsAction(Settings settings, Client client, RestController controller) { public RestUpdateSettingsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -41,8 +41,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, Client client, RestController controller) { public RestIndicesStatsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -32,8 +32,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestDeleteIndexTemplateAction extends BaseRestHandler { public class RestDeleteIndexTemplateAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteIndexTemplateAction(Settings settings, Client client, RestController controller) { public RestDeleteIndexTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this); controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this);
} }

View File

@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetIndexTemplateAction extends BaseRestHandler { public class RestGetIndexTemplateAction extends BaseRestHandler {
@Inject @Inject
public RestGetIndexTemplateAction(Settings settings, Client client, RestController controller) { public RestGetIndexTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_template", this); controller.registerHandler(GET, "/_template", this);
controller.registerHandler(GET, "/_template/{name}", this); controller.registerHandler(GET, "/_template/{name}", this);

View File

@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestHeadIndexTemplateAction extends BaseRestHandler { public class RestHeadIndexTemplateAction extends BaseRestHandler {
@Inject @Inject
public RestHeadIndexTemplateAction(Settings settings, Client client, RestController controller) { public RestHeadIndexTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(HEAD, "/_template/{name}", this); controller.registerHandler(HEAD, "/_template/{name}", this);
} }

View File

@ -32,8 +32,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
public class RestPutIndexTemplateAction extends BaseRestHandler { public class RestPutIndexTemplateAction extends BaseRestHandler {
@Inject @Inject
public RestPutIndexTemplateAction(Settings settings, Client client, RestController controller) { public RestPutIndexTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -44,8 +44,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestValidateQueryAction extends BaseRestHandler { public class RestValidateQueryAction extends BaseRestHandler {
@Inject @Inject
public RestValidateQueryAction(Settings settings, Client client, RestController controller) { public RestValidateQueryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -25,10 +25,7 @@ import org.elasticsearch.client.Client;
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;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.AcknowledgedRestListener; import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.rest.RestRequest.Method.DELETE;
@ -38,8 +35,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteWarmerAction extends BaseRestHandler { public class RestDeleteWarmerAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteWarmerAction(Settings settings, Client client, RestController controller) { public RestDeleteWarmerAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/{index}/_warmer", this); controller.registerHandler(DELETE, "/{index}/_warmer", this);
controller.registerHandler(DELETE, "/{index}/_warmer/{name}", this); controller.registerHandler(DELETE, "/{index}/_warmer/{name}", this);
controller.registerHandler(DELETE, "/{index}/_warmers", this); controller.registerHandler(DELETE, "/{index}/_warmers", this);

View File

@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetWarmerAction extends BaseRestHandler { public class RestGetWarmerAction extends BaseRestHandler {
@Inject @Inject
public RestGetWarmerAction(Settings settings, Client client, RestController controller) { public RestGetWarmerAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_warmer", this); controller.registerHandler(GET, "/_warmer", this);
controller.registerHandler(GET, "/_warmer/{name}", this); controller.registerHandler(GET, "/_warmer/{name}", this);
controller.registerHandler(GET, "/{index}/_warmer", this); controller.registerHandler(GET, "/{index}/_warmer", this);

View File

@ -26,10 +26,7 @@ import org.elasticsearch.client.Client;
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;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.AcknowledgedRestListener; import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.POST;
@ -40,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestPutWarmerAction extends BaseRestHandler { public class RestPutWarmerAction extends BaseRestHandler {
@Inject @Inject
public RestPutWarmerAction(Settings settings, Client client, RestController controller) { public RestPutWarmerAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(PUT, "/_warmer/{name}", this); controller.registerHandler(PUT, "/_warmer/{name}", this);
controller.registerHandler(PUT, "/{index}/_warmer/{name}", this); controller.registerHandler(PUT, "/{index}/_warmer/{name}", this);
controller.registerHandler(PUT, "/{index}/{type}/_warmer/{name}", this); controller.registerHandler(PUT, "/{index}/{type}/_warmer/{name}", this);

View File

@ -52,8 +52,8 @@ import static org.elasticsearch.rest.RestStatus.*;
public class RestBenchAction extends BaseRestHandler { public class RestBenchAction extends BaseRestHandler {
@Inject @Inject
public RestBenchAction(Settings settings, Client client, RestController controller) { public RestBenchAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
// List active benchmarks // List active benchmarks
controller.registerHandler(GET, "/_bench", this); controller.registerHandler(GET, "/_bench", this);

View File

@ -55,8 +55,8 @@ public class RestBulkAction extends BaseRestHandler {
private final boolean allowExplicitIndex; private final boolean allowExplicitIndex;
@Inject @Inject
public RestBulkAction(Settings settings, Client client, RestController controller) { public RestBulkAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(POST, "/_bulk", this); controller.registerHandler(POST, "/_bulk", this);
controller.registerHandler(PUT, "/_bulk", this); controller.registerHandler(PUT, "/_bulk", this);

View File

@ -33,8 +33,8 @@ 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, Client client) { public AbstractCatAction(Settings settings, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
abstract void doRequest(final RestRequest request, final RestChannel channel, final Client client); abstract void doRequest(final RestRequest request, final RestChannel channel, final Client client);

View File

@ -27,10 +27,7 @@ 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;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -44,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestAliasAction extends AbstractCatAction { public class RestAliasAction extends AbstractCatAction {
@Inject @Inject
public RestAliasAction(Settings settings, Client client, RestController controller) { public RestAliasAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -33,10 +33,7 @@ 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;
import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestActionListener; import org.elasticsearch.rest.action.support.RestActionListener;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -47,8 +44,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, Client client, RestController controller) { public RestAllocationAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -35,8 +35,8 @@ public class RestCatAction extends BaseRestHandler {
private final String HELP; private final String HELP;
@Inject @Inject
public RestCatAction(Settings settings, Client client, RestController controller, Set<AbstractCatAction> catActions) { public RestCatAction(Settings settings, RestController controller, Set<AbstractCatAction> catActions, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -27,10 +27,7 @@ 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;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestActions; import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -44,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestCountAction extends AbstractCatAction { public class RestCountAction extends AbstractCatAction {
@Inject @Inject
protected RestCountAction(Settings settings, Client client, RestController restController) { protected RestCountAction(Settings settings, RestController restController, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -29,10 +29,7 @@ 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;
import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -49,8 +46,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestFielddataAction extends AbstractCatAction { public class RestFielddataAction extends AbstractCatAction {
@Inject @Inject
public RestFielddataAction(Settings settings, Client client, RestController controller) { public RestFielddataAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -25,10 +25,7 @@ import org.elasticsearch.client.Client;
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;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
@ -42,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, Client client, RestController controller) { public RestHealthAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_cat/health", this); controller.registerHandler(GET, "/_cat/health", this);
} }

View File

@ -34,10 +34,7 @@ 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;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestActionListener; import org.elasticsearch.rest.action.support.RestActionListener;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -49,8 +46,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestIndicesAction extends AbstractCatAction { public class RestIndicesAction extends AbstractCatAction {
@Inject @Inject
public RestIndicesAction(Settings settings, Client client, RestController controller) { public RestIndicesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -27,10 +27,7 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
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;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -39,8 +36,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, Client client, RestController controller) { public RestMasterAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_cat/master", this); controller.registerHandler(GET, "/_cat/master", this);
} }

View File

@ -35,10 +35,7 @@ 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;
import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestActionListener; import org.elasticsearch.rest.action.support.RestActionListener;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -50,8 +47,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, Client client, RestController controller) { public RestNodesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_cat/nodes", this); controller.registerHandler(GET, "/_cat/nodes", this);
} }

View File

@ -26,10 +26,7 @@ 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;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -37,8 +34,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, Client client, RestController controller) { public RestPendingClusterTasksAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_cat/pending_tasks", this); controller.registerHandler(GET, "/_cat/pending_tasks", this);
} }

View File

@ -31,10 +31,7 @@ import org.elasticsearch.cluster.node.DiscoveryNodes;
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;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestActionListener; import org.elasticsearch.rest.action.support.RestActionListener;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -44,8 +41,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, Client client, RestController controller) { public RestPluginsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_cat/plugins", this); controller.registerHandler(GET, "/_cat/plugins", this);
} }

View File

@ -30,10 +30,7 @@ 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;
import org.elasticsearch.indices.recovery.RecoveryState; import org.elasticsearch.indices.recovery.RecoveryState;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -51,8 +48,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestRecoveryAction extends AbstractCatAction { public class RestRecoveryAction extends AbstractCatAction {
@Inject @Inject
protected RestRecoveryAction(Settings settings, Client client, RestController restController) { protected RestRecoveryAction(Settings settings, RestController restController, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -42,8 +42,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestSegmentsAction extends AbstractCatAction { public class RestSegmentsAction extends AbstractCatAction {
@Inject @Inject
public RestSegmentsAction(Settings settings, Client client, RestController controller) { public RestSegmentsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -30,10 +30,7 @@ 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;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestActionListener; import org.elasticsearch.rest.action.support.RestActionListener;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -43,8 +40,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, Client client, RestController controller) { public RestShardsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -36,10 +36,7 @@ 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;
import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestActionListener; import org.elasticsearch.rest.action.support.RestActionListener;
import org.elasticsearch.rest.action.support.RestResponseListener; import org.elasticsearch.rest.action.support.RestResponseListener;
import org.elasticsearch.rest.action.support.RestTable; import org.elasticsearch.rest.action.support.RestTable;
@ -108,8 +105,8 @@ public class RestThreadPoolAction extends AbstractCatAction {
} }
@Inject @Inject
public RestThreadPoolAction(Settings settings, Client client, RestController controller) { public RestThreadPoolAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_cat/thread_pool", this); controller.registerHandler(GET, "/_cat/thread_pool", this);
} }

View File

@ -45,8 +45,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestCountAction extends BaseRestHandler { public class RestCountAction extends BaseRestHandler {
@Inject @Inject
public RestCountAction(Settings settings, Client client, RestController controller) { public RestCountAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestDeleteAction extends BaseRestHandler { public class RestDeleteAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteAction(Settings settings, Client client, RestController controller) { public RestDeleteAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/{index}/{type}/{id}", this); controller.registerHandler(DELETE, "/{index}/{type}/{id}", this);
} }

View File

@ -46,8 +46,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteByQueryAction extends BaseRestHandler { public class RestDeleteByQueryAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteByQueryAction(Settings settings, Client client, RestController controller) { public RestDeleteByQueryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/{index}/_query", this); controller.registerHandler(DELETE, "/{index}/_query", this);
controller.registerHandler(DELETE, "/{index}/{type}/_query", this); controller.registerHandler(DELETE, "/{index}/{type}/_query", this);
} }

View File

@ -40,8 +40,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
*/ */
public class RestExistsAction extends BaseRestHandler { public class RestExistsAction extends BaseRestHandler {
public RestExistsAction(Settings settings, Client client) { public RestExistsAction(Settings settings, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
@Override @Override

View File

@ -51,8 +51,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestExplainAction extends BaseRestHandler { public class RestExplainAction extends BaseRestHandler {
@Inject @Inject
public RestExplainAction(Settings settings, Client client, RestController controller) { public RestExplainAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
} }

View File

@ -42,8 +42,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetAction extends BaseRestHandler { public class RestGetAction extends BaseRestHandler {
@Inject @Inject
public RestGetAction(Settings settings, Client client, RestController controller) { public RestGetAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/{index}/{type}/{id}", this); controller.registerHandler(GET, "/{index}/{type}/{id}", this);
} }

View File

@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetSourceAction extends BaseRestHandler { public class RestGetSourceAction extends BaseRestHandler {
@Inject @Inject
public RestGetSourceAction(Settings settings, Client client, RestController controller) { public RestGetSourceAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/{index}/{type}/{id}/_source", this); controller.registerHandler(GET, "/{index}/{type}/{id}/_source", this);
} }

View File

@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestHeadAction extends BaseRestHandler { public class RestHeadAction extends BaseRestHandler {
@Inject @Inject
public RestHeadAction(Settings settings, Client client, RestController controller) { public RestHeadAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(HEAD, "/{index}/{type}/{id}", this); controller.registerHandler(HEAD, "/{index}/{type}/{id}", this);
controller.registerHandler(HEAD, "/{index}/{type}/{id}/_source", this); controller.registerHandler(HEAD, "/{index}/{type}/{id}/_source", this);
} }

View File

@ -38,8 +38,8 @@ public class RestMultiGetAction extends BaseRestHandler {
private final boolean allowExplicitIndex; private final boolean allowExplicitIndex;
@Inject @Inject
public RestMultiGetAction(Settings settings, Client client, RestController controller) { public RestMultiGetAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);

View File

@ -46,19 +46,19 @@ import static org.elasticsearch.rest.RestStatus.*;
public class RestIndexAction extends BaseRestHandler { public class RestIndexAction extends BaseRestHandler {
@Inject @Inject
public RestIndexAction(Settings settings, Client client, RestController controller) { public RestIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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, client); CreateHandler createHandler = new CreateHandler(settings, restClientFactory);
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, final Client client) { protected CreateHandler(Settings settings, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
@Override @Override

View File

@ -45,8 +45,8 @@ public class RestMainAction extends BaseRestHandler {
private final ClusterName clusterName; private final ClusterName clusterName;
@Inject @Inject
public RestMainAction(Settings settings, Version version, Client client, RestController controller, ClusterName clusterName) { public RestMainAction(Settings settings, Version version, RestController controller, ClusterName clusterName, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
this.version = version; this.version = version;
this.clusterName = clusterName; this.clusterName = clusterName;
controller.registerHandler(GET, "/", this); controller.registerHandler(GET, "/", this);

View File

@ -40,8 +40,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestMoreLikeThisAction extends BaseRestHandler { public class RestMoreLikeThisAction extends BaseRestHandler {
@Inject @Inject
public RestMoreLikeThisAction(Settings settings, Client client, RestController controller) { public RestMoreLikeThisAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/{index}/{type}/{id}/_mlt", this); controller.registerHandler(GET, "/{index}/{type}/{id}/_mlt", this);
controller.registerHandler(POST, "/{index}/{type}/{id}/_mlt", this); controller.registerHandler(POST, "/{index}/{type}/{id}/_mlt", this);
} }

View File

@ -40,8 +40,8 @@ public class RestMultiPercolateAction extends BaseRestHandler {
private final boolean allowExplicitIndex; private final boolean allowExplicitIndex;
@Inject @Inject
public RestMultiPercolateAction(Settings settings, Client client, RestController controller) { public RestMultiPercolateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(POST, "/_mpercolate", this); controller.registerHandler(POST, "/_mpercolate", this);
controller.registerHandler(POST, "/{index}/_mpercolate", this); controller.registerHandler(POST, "/{index}/_mpercolate", this);
controller.registerHandler(POST, "/{index}/{type}/_mpercolate", this); controller.registerHandler(POST, "/{index}/{type}/_mpercolate", this);

View File

@ -40,20 +40,20 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestPercolateAction extends BaseRestHandler { public class RestPercolateAction extends BaseRestHandler {
@Inject @Inject
public RestPercolateAction(Settings settings, Client client, RestController controller) { public RestPercolateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/{index}/{type}/_percolate", this); controller.registerHandler(GET, "/{index}/{type}/_percolate", this);
controller.registerHandler(POST, "/{index}/{type}/_percolate", this); controller.registerHandler(POST, "/{index}/{type}/_percolate", this);
RestPercolateExistingDocHandler existingDocHandler = new RestPercolateExistingDocHandler(settings, client); RestPercolateExistingDocHandler existingDocHandler = new RestPercolateExistingDocHandler(settings, restClientFactory);
controller.registerHandler(GET, "/{index}/{type}/{id}/_percolate", existingDocHandler); controller.registerHandler(GET, "/{index}/{type}/{id}/_percolate", existingDocHandler);
controller.registerHandler(POST, "/{index}/{type}/{id}/_percolate", existingDocHandler); controller.registerHandler(POST, "/{index}/{type}/{id}/_percolate", existingDocHandler);
RestCountPercolateDocHandler countHandler = new RestCountPercolateDocHandler(settings, client); RestCountPercolateDocHandler countHandler = new RestCountPercolateDocHandler(settings, restClientFactory);
controller.registerHandler(GET, "/{index}/{type}/_percolate/count", countHandler); controller.registerHandler(GET, "/{index}/{type}/_percolate/count", countHandler);
controller.registerHandler(POST, "/{index}/{type}/_percolate/count", countHandler); controller.registerHandler(POST, "/{index}/{type}/_percolate/count", countHandler);
RestCountPercolateExistingDocHandler countExistingDocHandler = new RestCountPercolateExistingDocHandler(settings, client); RestCountPercolateExistingDocHandler countExistingDocHandler = new RestCountPercolateExistingDocHandler(settings, restClientFactory);
controller.registerHandler(GET, "/{index}/{type}/{id}/_percolate/count", countExistingDocHandler); controller.registerHandler(GET, "/{index}/{type}/{id}/_percolate/count", countExistingDocHandler);
controller.registerHandler(POST, "/{index}/{type}/{id}/_percolate/count", countExistingDocHandler); controller.registerHandler(POST, "/{index}/{type}/{id}/_percolate/count", countExistingDocHandler);
} }
@ -107,8 +107,8 @@ public class RestPercolateAction extends BaseRestHandler {
final class RestCountPercolateDocHandler extends BaseRestHandler { final class RestCountPercolateDocHandler extends BaseRestHandler {
private RestCountPercolateDocHandler(Settings settings, final Client client) { private RestCountPercolateDocHandler(Settings settings, final RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
@Override @Override
@ -121,8 +121,8 @@ public class RestPercolateAction extends BaseRestHandler {
final class RestPercolateExistingDocHandler extends BaseRestHandler { final class RestPercolateExistingDocHandler extends BaseRestHandler {
protected RestPercolateExistingDocHandler(Settings settings, final Client client) { protected RestPercolateExistingDocHandler(Settings settings, final RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
@Override @Override
@ -134,8 +134,8 @@ public class RestPercolateAction extends BaseRestHandler {
final class RestCountPercolateExistingDocHandler extends BaseRestHandler { final class RestCountPercolateExistingDocHandler extends BaseRestHandler {
protected RestCountPercolateExistingDocHandler(Settings settings, final Client client) { protected RestCountPercolateExistingDocHandler(Settings settings, final RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
@Override @Override

View File

@ -36,13 +36,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestDeleteIndexedScriptAction extends BaseRestHandler { public class RestDeleteIndexedScriptAction extends BaseRestHandler {
@Inject @Inject
public RestDeleteIndexedScriptAction(Settings settings, Client client, RestController controller) { public RestDeleteIndexedScriptAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this); controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this);
} }
protected RestDeleteIndexedScriptAction(Settings settings, Client client) { protected RestDeleteIndexedScriptAction(Settings settings, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
protected String getScriptLang(RestRequest request) { protected String getScriptLang(RestRequest request) {

View File

@ -43,13 +43,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
public class RestGetIndexedScriptAction extends BaseRestHandler { public class RestGetIndexedScriptAction extends BaseRestHandler {
@Inject @Inject
public RestGetIndexedScriptAction(Settings settings, Client client, RestController controller) { public RestGetIndexedScriptAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_scripts/{lang}/{id}", this); controller.registerHandler(GET, "/_scripts/{lang}/{id}", this);
} }
protected RestGetIndexedScriptAction(Settings settings, Client client) { protected RestGetIndexedScriptAction(Settings settings, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
protected String getScriptLang(RestRequest request) { protected String getScriptLang(RestRequest request) {

View File

@ -43,23 +43,23 @@ import static org.elasticsearch.rest.RestStatus.*;
public class RestPutIndexedScriptAction extends BaseRestHandler { public class RestPutIndexedScriptAction extends BaseRestHandler {
@Inject @Inject
public RestPutIndexedScriptAction(Settings settings, Client client, RestController controller) { public RestPutIndexedScriptAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
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);
controller.registerHandler(PUT, "/_scripts/{lang}/{id}/_create", new CreateHandler(settings, client)); controller.registerHandler(PUT, "/_scripts/{lang}/{id}/_create", new CreateHandler(settings, restClientFactory));
controller.registerHandler(POST, "/_scripts/{lang}/{id}/_create", new CreateHandler(settings, client)); controller.registerHandler(POST, "/_scripts/{lang}/{id}/_create", new CreateHandler(settings, restClientFactory));
} }
protected RestPutIndexedScriptAction(Settings settings, Client client) { protected RestPutIndexedScriptAction(Settings settings, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
final class CreateHandler extends BaseRestHandler { final class CreateHandler extends BaseRestHandler {
protected CreateHandler(Settings settings, final Client client) { protected CreateHandler(Settings settings, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
@Override @Override

View File

@ -25,10 +25,7 @@ import org.elasticsearch.client.Client;
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;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestActions; import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestStatusToXContentListener; import org.elasticsearch.rest.action.support.RestStatusToXContentListener;
@ -41,8 +38,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestClearScrollAction extends BaseRestHandler { public class RestClearScrollAction extends BaseRestHandler {
@Inject @Inject
public RestClearScrollAction(Settings settings, Client client, RestController controller) { public RestClearScrollAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/_search/scroll", this); controller.registerHandler(DELETE, "/_search/scroll", this);
controller.registerHandler(DELETE, "/_search/scroll/{scroll_id}", this); controller.registerHandler(DELETE, "/_search/scroll/{scroll_id}", this);

View File

@ -40,8 +40,8 @@ public class RestMultiSearchAction extends BaseRestHandler {
private final boolean allowExplicitIndex; private final boolean allowExplicitIndex;
@Inject @Inject
public RestMultiSearchAction(Settings settings, Client client, RestController controller) { public RestMultiSearchAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_msearch", this); controller.registerHandler(GET, "/_msearch", this);
controller.registerHandler(POST, "/_msearch", this); controller.registerHandler(POST, "/_msearch", this);

View File

@ -29,10 +29,7 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.QueryStringQueryBuilder; import org.elasticsearch.index.query.QueryStringQueryBuilder;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.exists.RestExistsAction; import org.elasticsearch.rest.action.exists.RestExistsAction;
import org.elasticsearch.rest.action.support.RestStatusToXContentListener; import org.elasticsearch.rest.action.support.RestStatusToXContentListener;
import org.elasticsearch.search.Scroll; import org.elasticsearch.search.Scroll;
@ -52,8 +49,8 @@ import static org.elasticsearch.search.suggest.SuggestBuilders.termSuggestion;
public class RestSearchAction extends BaseRestHandler { public class RestSearchAction extends BaseRestHandler {
@Inject @Inject
public RestSearchAction(Settings settings, Client client, RestController controller) { public RestSearchAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_search", this); controller.registerHandler(GET, "/_search", this);
controller.registerHandler(POST, "/_search", this); controller.registerHandler(POST, "/_search", this);
controller.registerHandler(GET, "/{index}/_search", this); controller.registerHandler(GET, "/{index}/_search", this);
@ -67,7 +64,7 @@ public class RestSearchAction extends BaseRestHandler {
controller.registerHandler(GET, "/{index}/{type}/_search/template", this); controller.registerHandler(GET, "/{index}/{type}/_search/template", this);
controller.registerHandler(POST, "/{index}/{type}/_search/template", this); controller.registerHandler(POST, "/{index}/{type}/_search/template", this);
RestExistsAction restExistsAction = new RestExistsAction(settings, client); RestExistsAction restExistsAction = new RestExistsAction(settings, restClientFactory);
controller.registerHandler(GET, "/_search/exists", restExistsAction); controller.registerHandler(GET, "/_search/exists", restExistsAction);
controller.registerHandler(POST, "/_search/exists", restExistsAction); controller.registerHandler(POST, "/_search/exists", restExistsAction);
controller.registerHandler(GET, "/{index}/_search/exists", restExistsAction); controller.registerHandler(GET, "/{index}/_search/exists", restExistsAction);

View File

@ -24,10 +24,7 @@ import org.elasticsearch.action.search.SearchScrollRequest;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
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.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.support.RestActions; import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestStatusToXContentListener; import org.elasticsearch.rest.action.support.RestStatusToXContentListener;
import org.elasticsearch.search.Scroll; import org.elasticsearch.search.Scroll;
@ -42,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
public class RestSearchScrollAction extends BaseRestHandler { public class RestSearchScrollAction extends BaseRestHandler {
@Inject @Inject
public RestSearchScrollAction(Settings settings, Client client, RestController controller) { public RestSearchScrollAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_search/scroll", this); controller.registerHandler(GET, "/_search/scroll", this);
controller.registerHandler(POST, "/_search/scroll", this); controller.registerHandler(POST, "/_search/scroll", this);

View File

@ -43,8 +43,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
public class RestSuggestAction extends BaseRestHandler { public class RestSuggestAction extends BaseRestHandler {
@Inject @Inject
public RestSuggestAction(Settings settings, Client client, RestController controller) { public RestSuggestAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(POST, "/_suggest", this); controller.registerHandler(POST, "/_suggest", this);
controller.registerHandler(GET, "/_suggest", this); controller.registerHandler(GET, "/_suggest", this);
controller.registerHandler(POST, "/{index}/_suggest", this); controller.registerHandler(POST, "/{index}/_suggest", this);

View File

@ -18,9 +18,9 @@
*/ */
package org.elasticsearch.rest.action.template; package org.elasticsearch.rest.action.template;
import org.elasticsearch.client.Client;
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.RestClientFactory;
import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.script.RestDeleteIndexedScriptAction; import org.elasticsearch.rest.action.script.RestDeleteIndexedScriptAction;
@ -30,8 +30,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
public class RestDeleteSearchTemplateAction extends RestDeleteIndexedScriptAction { public class RestDeleteSearchTemplateAction extends RestDeleteIndexedScriptAction {
@Inject @Inject
public RestDeleteSearchTemplateAction(Settings settings, Client client, RestController controller) { public RestDeleteSearchTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(DELETE, "/_search/template/{id}", this); controller.registerHandler(DELETE, "/_search/template/{id}", this);
} }

View File

@ -18,9 +18,9 @@
*/ */
package org.elasticsearch.rest.action.template; package org.elasticsearch.rest.action.template;
import org.elasticsearch.client.Client;
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.RestClientFactory;
import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.script.RestGetIndexedScriptAction; import org.elasticsearch.rest.action.script.RestGetIndexedScriptAction;
@ -33,8 +33,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
public class RestGetSearchTemplateAction extends RestGetIndexedScriptAction { public class RestGetSearchTemplateAction extends RestGetIndexedScriptAction {
@Inject @Inject
public RestGetSearchTemplateAction(Settings settings, Client client, RestController controller) { public RestGetSearchTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
controller.registerHandler(GET, "/_search/template/{id}", this); controller.registerHandler(GET, "/_search/template/{id}", this);
} }

View File

@ -21,10 +21,7 @@ package org.elasticsearch.rest.action.template;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
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.*;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.script.RestPutIndexedScriptAction; import org.elasticsearch.rest.action.script.RestPutIndexedScriptAction;
import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.POST;
@ -36,20 +33,20 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
public class RestPutSearchTemplateAction extends RestPutIndexedScriptAction { public class RestPutSearchTemplateAction extends RestPutIndexedScriptAction {
@Inject @Inject
public RestPutSearchTemplateAction(Settings settings, Client client, RestController controller) { public RestPutSearchTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
//controller.registerHandler(GET, "/template", this); //controller.registerHandler(GET, "/template", this);
controller.registerHandler(POST, "/_search/template/{id}", this); controller.registerHandler(POST, "/_search/template/{id}", this);
controller.registerHandler(PUT, "/_search/template/{id}", this); controller.registerHandler(PUT, "/_search/template/{id}", this);
controller.registerHandler(PUT, "/_search/template/{id}/_create", new CreateHandler(settings, client)); controller.registerHandler(PUT, "/_search/template/{id}/_create", new CreateHandler(settings, restClientFactory));
controller.registerHandler(POST, "/_search/template/{id}/_create", new CreateHandler(settings, client)); controller.registerHandler(POST, "/_search/template/{id}/_create", new CreateHandler(settings, restClientFactory));
} }
final class CreateHandler extends BaseRestHandler { final class CreateHandler extends BaseRestHandler {
protected CreateHandler(Settings settings, final Client client) { protected CreateHandler(Settings settings, RestClientFactory restClientFactory) {
super(settings, client); super(settings, restClientFactory);
} }
@Override @Override

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