Merge branch 'master' into ingest_plugin_api

This commit is contained in:
Ryan Ernst 2016-07-01 09:23:15 -07:00
commit 65c9b0b588
366 changed files with 4166 additions and 3859 deletions

View File

@ -1168,7 +1168,6 @@
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportMultiPercolateAction.java" checks="LineLength" /> <suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportMultiPercolateAction.java" checks="LineLength" />
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportPercolateAction.java" checks="LineLength" /> <suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportPercolateAction.java" checks="LineLength" />
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportShardMultiPercolateAction.java" checks="LineLength" /> <suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportShardMultiPercolateAction.java" checks="LineLength" />
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]RestPercolateAction.java" checks="LineLength" />
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorIT.java" checks="LineLength" /> <suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorIT.java" checks="LineLength" />
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]PercolatorIT.java" checks="LineLength" /> <suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]PercolatorIT.java" checks="LineLength" />
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorRequestTests.java" checks="LineLength" /> <suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorRequestTests.java" checks="LineLength" />
@ -1180,10 +1179,10 @@
<suppress files="plugins[/\\]analysis-kuromoji[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]JapaneseStopTokenFilterFactory.java" checks="LineLength" /> <suppress files="plugins[/\\]analysis-kuromoji[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]JapaneseStopTokenFilterFactory.java" checks="LineLength" />
<suppress files="plugins[/\\]analysis-kuromoji[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]KuromojiAnalysisTests.java" checks="LineLength" /> <suppress files="plugins[/\\]analysis-kuromoji[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]KuromojiAnalysisTests.java" checks="LineLength" />
<suppress files="plugins[/\\]analysis-phonetic[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]PhoneticTokenFilterFactory.java" checks="LineLength" /> <suppress files="plugins[/\\]analysis-phonetic[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]PhoneticTokenFilterFactory.java" checks="LineLength" />
<suppress files="plugins[/\\]discovery-azure[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]azure[/\\]AbstractAzureTestCase.java" checks="LineLength" /> <suppress files="plugins[/\\]discovery-azure-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]azure[/\\]AbstractAzureTestCase.java" checks="LineLength" />
<suppress files="plugins[/\\]discovery-azure[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureMinimumMasterNodesTests.java" checks="LineLength" /> <suppress files="plugins[/\\]discovery-azure-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureMinimumMasterNodesTests.java" checks="LineLength" />
<suppress files="plugins[/\\]discovery-azure[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureSimpleTests.java" checks="LineLength" /> <suppress files="plugins[/\\]discovery-azure-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureSimpleTests.java" checks="LineLength" />
<suppress files="plugins[/\\]discovery-azure[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureTwoStartedNodesTests.java" checks="LineLength" /> <suppress files="plugins[/\\]discovery-azure-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureTwoStartedNodesTests.java" checks="LineLength" />
<suppress files="plugins[/\\]discovery-ec2[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]aws[/\\]AbstractAwsTestCase.java" checks="LineLength" /> <suppress files="plugins[/\\]discovery-ec2[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]aws[/\\]AbstractAwsTestCase.java" checks="LineLength" />
<suppress files="plugins[/\\]discovery-ec2[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]ec2[/\\]AmazonEC2Mock.java" checks="LineLength" /> <suppress files="plugins[/\\]discovery-ec2[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]ec2[/\\]AmazonEC2Mock.java" checks="LineLength" />
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]gce[/\\]GceNetworkTests.java" checks="LineLength" /> <suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]gce[/\\]GceNetworkTests.java" checks="LineLength" />

View File

@ -30,6 +30,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.Index; import org.elasticsearch.index.Index;
import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.transport.TcpTransport;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -496,7 +497,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
org.elasticsearch.index.shard.IndexShardStartedException::new, 23), org.elasticsearch.index.shard.IndexShardStartedException::new, 23),
SEARCH_CONTEXT_MISSING_EXCEPTION(org.elasticsearch.search.SearchContextMissingException.class, SEARCH_CONTEXT_MISSING_EXCEPTION(org.elasticsearch.search.SearchContextMissingException.class,
org.elasticsearch.search.SearchContextMissingException::new, 24), org.elasticsearch.search.SearchContextMissingException::new, 24),
GENERAL_SCRIPT_EXCEPTION(org.elasticsearch.script.GeneralScriptException.class, GENERAL_SCRIPT_EXCEPTION(org.elasticsearch.script.GeneralScriptException.class,
org.elasticsearch.script.GeneralScriptException::new, 25), org.elasticsearch.script.GeneralScriptException::new, 25),
BATCH_OPERATION_EXCEPTION(org.elasticsearch.index.shard.TranslogRecoveryPerformer.BatchOperationException.class, BATCH_OPERATION_EXCEPTION(org.elasticsearch.index.shard.TranslogRecoveryPerformer.BatchOperationException.class,
org.elasticsearch.index.shard.TranslogRecoveryPerformer.BatchOperationException::new, 26), org.elasticsearch.index.shard.TranslogRecoveryPerformer.BatchOperationException::new, 26),
@ -676,8 +677,8 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
org.elasticsearch.indices.IndexAlreadyExistsException::new, 123), org.elasticsearch.indices.IndexAlreadyExistsException::new, 123),
SCRIPT_PARSE_EXCEPTION(org.elasticsearch.script.Script.ScriptParseException.class, SCRIPT_PARSE_EXCEPTION(org.elasticsearch.script.Script.ScriptParseException.class,
org.elasticsearch.script.Script.ScriptParseException::new, 124), org.elasticsearch.script.Script.ScriptParseException::new, 124),
HTTP_ON_TRANSPORT_EXCEPTION(org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.HttpOnTransportException.class, HTTP_ON_TRANSPORT_EXCEPTION(TcpTransport.HttpOnTransportException.class,
org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.HttpOnTransportException::new, 125), TcpTransport.HttpOnTransportException::new, 125),
MAPPER_PARSING_EXCEPTION(org.elasticsearch.index.mapper.MapperParsingException.class, MAPPER_PARSING_EXCEPTION(org.elasticsearch.index.mapper.MapperParsingException.class,
org.elasticsearch.index.mapper.MapperParsingException::new, 126), org.elasticsearch.index.mapper.MapperParsingException::new, 126),
SEARCH_CONTEXT_EXCEPTION(org.elasticsearch.search.SearchContextException.class, SEARCH_CONTEXT_EXCEPTION(org.elasticsearch.search.SearchContextException.class,

View File

@ -24,7 +24,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.ingest.AbstractProcessorFactory; import org.elasticsearch.ingest.ConfigurationUtils;
import org.elasticsearch.ingest.IngestDocument; import org.elasticsearch.ingest.IngestDocument;
import java.io.IOException; import java.io.IOException;
@ -91,7 +91,7 @@ public class SimulateProcessorResult implements Writeable, ToXContent {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(); builder.startObject();
if (processorTag != null) { if (processorTag != null) {
builder.field(AbstractProcessorFactory.TAG_KEY, processorTag); builder.field(ConfigurationUtils.TAG_KEY, processorTag);
} }
if (failure == null) { if (failure == null) {
ingestDocument.toXContent(builder, params); ingestDocument.toXContent(builder, params);

View File

@ -50,8 +50,8 @@ import org.elasticsearch.plugins.PluginsService;
import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.SearchModule;
import org.elasticsearch.threadpool.ExecutorBuilder; import org.elasticsearch.threadpool.ExecutorBuilder;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TcpTransport;
import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.TransportService;
import org.elasticsearch.transport.netty.NettyTransport;
import java.io.Closeable; import java.io.Closeable;
import java.util.ArrayList; import java.util.ArrayList;
@ -107,7 +107,7 @@ public class TransportClient extends AbstractClient {
private PluginsService newPluginService(final Settings settings) { private PluginsService newPluginService(final Settings settings) {
final Settings.Builder settingsBuilder = Settings.builder() final Settings.Builder settingsBuilder = Settings.builder()
.put(NettyTransport.PING_SCHEDULE.getKey(), "5s") // enable by default the transport schedule ping interval .put(TcpTransport.PING_SCHEDULE.getKey(), "5s") // enable by default the transport schedule ping interval
.put(InternalSettingsPreparer.prepareSettings(settings)) .put(InternalSettingsPreparer.prepareSettings(settings))
.put(NetworkService.NETWORK_SERVER.getKey(), false) .put(NetworkService.NETWORK_SERVER.getKey(), false)
.put(CLIENT_TYPE_SETTING_S.getKey(), CLIENT_TYPE); .put(CLIENT_TYPE_SETTING_S.getKey(), CLIENT_TYPE);
@ -142,12 +142,7 @@ public class TransportClient extends AbstractClient {
} }
modules.add(new NetworkModule(networkService, settings, true, namedWriteableRegistry)); modules.add(new NetworkModule(networkService, settings, true, namedWriteableRegistry));
modules.add(b -> b.bind(ThreadPool.class).toInstance(threadPool)); modules.add(b -> b.bind(ThreadPool.class).toInstance(threadPool));
modules.add(new SearchModule(settings, namedWriteableRegistry) { modules.add(new SearchModule(settings, namedWriteableRegistry, true));
@Override
protected void configure() {
// noop
}
});
modules.add(new ActionModule(false, true, settings, null, settingsModule.getClusterSettings(), modules.add(new ActionModule(false, true, settings, null, settingsModule.getClusterSettings(),
pluginsService.filterPlugins(ActionPlugin.class))); pluginsService.filterPlugins(ActionPlugin.class)));

View File

@ -85,7 +85,7 @@ public class FsBlobContainer extends AbstractBlobContainer {
@Override @Override
public void deleteBlob(String blobName) throws IOException { public void deleteBlob(String blobName) throws IOException {
Path blobPath = path.resolve(blobName); Path blobPath = path.resolve(blobName);
Files.deleteIfExists(blobPath); Files.delete(blobPath);
} }
@Override @Override

View File

@ -20,7 +20,6 @@
package org.elasticsearch.common.io; package org.elasticsearch.common.io;
import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.SuppressForbidden;
import org.jboss.netty.buffer.ChannelBuffer;
import java.io.EOFException; import java.io.EOFException;
import java.io.IOException; import java.io.IOException;
@ -159,25 +158,6 @@ public final class Channels {
return bytesRead; return bytesRead;
} }
/**
* Copies bytes from source {@link org.jboss.netty.buffer.ChannelBuffer} to a {@link java.nio.channels.GatheringByteChannel}
*
* @param source ChannelBuffer to copy from
* @param sourceIndex index in <i>source</i> to start copying from
* @param length how many bytes to copy
* @param channel target GatheringByteChannel
*/
public static void writeToChannel(ChannelBuffer source, int sourceIndex, int length, GatheringByteChannel channel) throws IOException {
while (length > 0) {
int written = source.getBytes(sourceIndex, channel, length);
sourceIndex += written;
length -= written;
}
assert length == 0;
}
/** /**
* Writes part of a byte array to a {@link java.nio.channels.WritableByteChannel} * Writes part of a byte array to a {@link java.nio.channels.WritableByteChannel}
* *

View File

@ -1,37 +0,0 @@
/*
* 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.common.netty;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.handler.codec.frame.FrameDecoder;
/**
* A marker to not remove frame decoder from the resulting jar so plugins can use it.
*/
public class KeepFrameDecoder extends FrameDecoder {
public static final KeepFrameDecoder decoder = new KeepFrameDecoder();
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
return null;
}
}

View File

@ -222,6 +222,11 @@ public abstract class TimeZoneRounding extends Rounding {
long roundedUTC; long roundedUTC;
if (isInDSTGap(rounded) == false) { if (isInDSTGap(rounded) == false) {
roundedUTC = timeZone.convertLocalToUTC(rounded, true, utcMillis); roundedUTC = timeZone.convertLocalToUTC(rounded, true, utcMillis);
// check if we crossed DST transition, in this case we want the last rounded value before the transition
long transition = timeZone.previousTransition(utcMillis);
if (transition != utcMillis && transition > roundedUTC) {
roundedUTC = roundKey(transition - 1);
}
} else { } else {
/* /*
* Edge case where the rounded local time is illegal and landed * Edge case where the rounded local time is illegal and landed

View File

@ -89,6 +89,7 @@ import org.elasticsearch.script.ScriptService;
import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.SearchService; import org.elasticsearch.search.SearchService;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TcpTransport;
import org.elasticsearch.transport.Transport; import org.elasticsearch.transport.Transport;
import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.TransportService;
import org.elasticsearch.transport.TransportSettings; import org.elasticsearch.transport.TransportSettings;
@ -279,14 +280,14 @@ public final class ClusterSettings extends AbstractScopedSettings {
TransportSettings.PUBLISH_PORT, TransportSettings.PUBLISH_PORT,
TransportSettings.PORT, TransportSettings.PORT,
NettyTransport.WORKER_COUNT, NettyTransport.WORKER_COUNT,
NettyTransport.CONNECTIONS_PER_NODE_RECOVERY, TcpTransport.CONNECTIONS_PER_NODE_RECOVERY,
NettyTransport.CONNECTIONS_PER_NODE_BULK, TcpTransport.CONNECTIONS_PER_NODE_BULK,
NettyTransport.CONNECTIONS_PER_NODE_REG, TcpTransport.CONNECTIONS_PER_NODE_REG,
NettyTransport.CONNECTIONS_PER_NODE_STATE, TcpTransport.CONNECTIONS_PER_NODE_STATE,
NettyTransport.CONNECTIONS_PER_NODE_PING, TcpTransport.CONNECTIONS_PER_NODE_PING,
NettyTransport.PING_SCHEDULE, TcpTransport.PING_SCHEDULE,
NettyTransport.TCP_BLOCKING_CLIENT, TcpTransport.TCP_BLOCKING_CLIENT,
NettyTransport.TCP_CONNECT_TIMEOUT, TcpTransport.TCP_CONNECT_TIMEOUT,
NettyTransport.NETTY_MAX_CUMULATION_BUFFER_CAPACITY, NettyTransport.NETTY_MAX_CUMULATION_BUFFER_CAPACITY,
NettyTransport.NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS, NettyTransport.NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,
NettyTransport.NETTY_RECEIVE_PREDICTOR_SIZE, NettyTransport.NETTY_RECEIVE_PREDICTOR_SIZE,
@ -294,12 +295,12 @@ public final class ClusterSettings extends AbstractScopedSettings {
NettyTransport.NETTY_RECEIVE_PREDICTOR_MAX, NettyTransport.NETTY_RECEIVE_PREDICTOR_MAX,
NetworkService.NETWORK_SERVER, NetworkService.NETWORK_SERVER,
NettyTransport.NETTY_BOSS_COUNT, NettyTransport.NETTY_BOSS_COUNT,
NettyTransport.TCP_NO_DELAY, TcpTransport.TCP_NO_DELAY,
NettyTransport.TCP_KEEP_ALIVE, TcpTransport.TCP_KEEP_ALIVE,
NettyTransport.TCP_REUSE_ADDRESS, TcpTransport.TCP_REUSE_ADDRESS,
NettyTransport.TCP_SEND_BUFFER_SIZE, TcpTransport.TCP_SEND_BUFFER_SIZE,
NettyTransport.TCP_RECEIVE_BUFFER_SIZE, TcpTransport.TCP_RECEIVE_BUFFER_SIZE,
NettyTransport.TCP_BLOCKING_SERVER, TcpTransport.TCP_BLOCKING_SERVER,
NetworkService.GLOBAL_NETWORK_HOST_SETTING, NetworkService.GLOBAL_NETWORK_HOST_SETTING,
NetworkService.GLOBAL_NETWORK_BINDHOST_SETTING, NetworkService.GLOBAL_NETWORK_BINDHOST_SETTING,
NetworkService.GLOBAL_NETWORK_PUBLISHHOST_SETTING, NetworkService.GLOBAL_NETWORK_PUBLISHHOST_SETTING,

View File

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

View File

@ -19,7 +19,7 @@
package org.elasticsearch.http.netty; package org.elasticsearch.http.netty;
import org.elasticsearch.common.netty.NettyUtils; import org.elasticsearch.transport.netty.NettyUtils;
import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.buffer.CompositeChannelBuffer; import org.jboss.netty.buffer.CompositeChannelBuffer;

View File

@ -24,8 +24,7 @@ import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput; import org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput;
import org.elasticsearch.common.lease.Releasable; import org.elasticsearch.common.lease.Releasable;
import org.elasticsearch.common.netty.NettyUtils; import org.elasticsearch.transport.netty.NettyUtils;
import org.elasticsearch.common.netty.ReleaseChannelFutureListener;
import org.elasticsearch.http.netty.cors.CorsHandler; import org.elasticsearch.http.netty.cors.CorsHandler;
import org.elasticsearch.http.netty.pipelining.OrderedDownstreamChannelEvent; import org.elasticsearch.http.netty.pipelining.OrderedDownstreamChannelEvent;
import org.elasticsearch.http.netty.pipelining.OrderedUpstreamMessageEvent; import org.elasticsearch.http.netty.pipelining.OrderedUpstreamMessageEvent;
@ -128,7 +127,7 @@ public final class NettyHttpChannel extends AbstractRestChannel {
} }
if (content instanceof Releasable) { if (content instanceof Releasable) {
future.addListener(new ReleaseChannelFutureListener((Releasable) content)); future.addListener((x) -> ((Releasable)content).close());
addedReleaseListener = true; addedReleaseListener = true;
} }

View File

@ -21,7 +21,7 @@ package org.elasticsearch.http.netty;
import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.netty.NettyUtils; import org.elasticsearch.transport.netty.NettyUtils;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.support.RestUtils; import org.elasticsearch.rest.support.RestUtils;
import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.Channel;

View File

@ -24,8 +24,8 @@ import com.carrotsearch.hppc.IntSet;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.netty.NettyUtils; import org.elasticsearch.transport.netty.NettyUtils;
import org.elasticsearch.common.netty.OpenChannelsHandler; import org.elasticsearch.transport.netty.OpenChannelsHandler;
import org.elasticsearch.common.network.NetworkAddress; import org.elasticsearch.common.network.NetworkAddress;
import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting;

View File

@ -1,39 +0,0 @@
/*
* 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.ingest;
import java.util.Map;
/**
* A processor implementation may modify the data belonging to a document.
* Whether changes are made and what exactly is modified is up to the implementation.
*/
public abstract class AbstractProcessorFactory implements Processor.Factory {
public static final String TAG_KEY = "tag";
@Override
public Processor create(Map<String, Processor.Factory> registry, Map<String, Object> config) throws Exception {
String tag = ConfigurationUtils.readOptionalStringProperty(null, null, config, TAG_KEY);
return doCreate(registry, tag, config);
}
protected abstract Processor doCreate(Map<String, Processor.Factory> registry, String tag,
Map<String, Object> config) throws Exception;
}

View File

@ -29,6 +29,8 @@ import java.util.Map;
public final class ConfigurationUtils { public final class ConfigurationUtils {
public static final String TAG_KEY = "tag";
private ConfigurationUtils() { private ConfigurationUtils() {
} }
@ -255,7 +257,8 @@ public final class ConfigurationUtils {
ConfigurationUtils.readOptionalList(null, null, config, Pipeline.ON_FAILURE_KEY); ConfigurationUtils.readOptionalList(null, null, config, Pipeline.ON_FAILURE_KEY);
List<Processor> onFailureProcessors = readProcessorConfigs(onFailureProcessorConfigs, processorFactories); List<Processor> onFailureProcessors = readProcessorConfigs(onFailureProcessorConfigs, processorFactories);
Processor processor = factory.create(processorFactories, config); String tag = ConfigurationUtils.readOptionalStringProperty(null, null, config, TAG_KEY);
Processor processor = factory.create(processorFactories, tag, config);
if (onFailureProcessorConfigs != null && onFailureProcessors.isEmpty()) { if (onFailureProcessorConfigs != null && onFailureProcessors.isEmpty()) {
throw newConfigurationException(processor.getType(), processor.getTag(), Pipeline.ON_FAILURE_KEY, throw newConfigurationException(processor.getType(), processor.getTag(), Pipeline.ON_FAILURE_KEY,

View File

@ -51,11 +51,13 @@ public interface Processor {
* Creates a processor based on the specified map of maps config. * Creates a processor based on the specified map of maps config.
* *
* @param processorFactories Other processors which may be created inside this processor * @param processorFactories Other processors which may be created inside this processor
* @param tag The tag for the processor
* @param config The configuration for the processor * @param config The configuration for the processor
* *
* <b>Note:</b> Implementations are responsible for removing the used configuration keys, so that after * <b>Note:</b> Implementations are responsible for removing the used configuration keys, so that after
* creating a pipeline ingest can verify if all configurations settings have been used. * creating a pipeline ingest can verify if all configurations settings have been used.
*/ */
Processor create(Map<String, Processor.Factory> processorFactories, Map<String, Object> config) throws Exception; Processor create(Map<String, Processor.Factory> processorFactories, String tag,
Map<String, Object> config) throws Exception;
} }
} }

View File

@ -272,7 +272,7 @@ public class Node implements Closeable {
ClusterModule clusterModule = new ClusterModule(settings, clusterService); ClusterModule clusterModule = new ClusterModule(settings, clusterService);
modules.add(clusterModule); modules.add(clusterModule);
modules.add(new IndicesModule(namedWriteableRegistry, pluginsService.filterPlugins(MapperPlugin.class))); modules.add(new IndicesModule(namedWriteableRegistry, pluginsService.filterPlugins(MapperPlugin.class)));
modules.add(new SearchModule(settings, namedWriteableRegistry)); modules.add(new SearchModule(settings, namedWriteableRegistry, false));
modules.add(new ActionModule(DiscoveryNode.isIngestNode(settings), false, settings, modules.add(new ActionModule(DiscoveryNode.isIngestNode(settings), false, settings,
clusterModule.getIndexNameExpressionResolver(), settingsModule.getClusterSettings(), clusterModule.getIndexNameExpressionResolver(), settingsModule.getClusterSettings(),
pluginsService.filterPlugins(ActionPlugin.class))); pluginsService.filterPlugins(ActionPlugin.class)));
@ -289,6 +289,7 @@ public class Node implements Closeable {
modules.add(b -> { modules.add(b -> {
b.bind(PluginsService.class).toInstance(pluginsService); b.bind(PluginsService.class).toInstance(pluginsService);
b.bind(Client.class).toInstance(client); b.bind(Client.class).toInstance(client);
b.bind(NodeClient.class).toInstance(client);
b.bind(Environment.class).toInstance(environment); b.bind(Environment.class).toInstance(environment);
b.bind(ThreadPool.class).toInstance(threadPool); b.bind(ThreadPool.class).toInstance(threadPool);
b.bind(NodeEnvironment.class).toInstance(nodeEnvironment); b.bind(NodeEnvironment.class).toInstance(nodeEnvironment);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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