Merge branch 'master' into ingest_plugin_api
This commit is contained in:
commit
65c9b0b588
|
@ -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[/\\]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[/\\]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[/\\]PercolatorIT.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[/\\]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[/\\]discovery-azure[/\\]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[/\\]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[/\\]cloud[/\\]azure[/\\]AbstractAzureTestCase.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-classic[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]azure[/\\]AzureSimpleTests.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[/\\]discovery[/\\]ec2[/\\]AmazonEC2Mock.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]gce[/\\]GceNetworkTests.java" checks="LineLength" />
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.transport.TcpTransport;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -676,8 +677,8 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
|||
org.elasticsearch.indices.IndexAlreadyExistsException::new, 123),
|
||||
SCRIPT_PARSE_EXCEPTION(org.elasticsearch.script.Script.ScriptParseException.class,
|
||||
org.elasticsearch.script.Script.ScriptParseException::new, 124),
|
||||
HTTP_ON_TRANSPORT_EXCEPTION(org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.HttpOnTransportException.class,
|
||||
org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.HttpOnTransportException::new, 125),
|
||||
HTTP_ON_TRANSPORT_EXCEPTION(TcpTransport.HttpOnTransportException.class,
|
||||
TcpTransport.HttpOnTransportException::new, 125),
|
||||
MAPPER_PARSING_EXCEPTION(org.elasticsearch.index.mapper.MapperParsingException.class,
|
||||
org.elasticsearch.index.mapper.MapperParsingException::new, 126),
|
||||
SEARCH_CONTEXT_EXCEPTION(org.elasticsearch.search.SearchContextException.class,
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.ingest.AbstractProcessorFactory;
|
||||
import org.elasticsearch.ingest.ConfigurationUtils;
|
||||
import org.elasticsearch.ingest.IngestDocument;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -91,7 +91,7 @@ public class SimulateProcessorResult implements Writeable, ToXContent {
|
|||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject();
|
||||
if (processorTag != null) {
|
||||
builder.field(AbstractProcessorFactory.TAG_KEY, processorTag);
|
||||
builder.field(ConfigurationUtils.TAG_KEY, processorTag);
|
||||
}
|
||||
if (failure == null) {
|
||||
ingestDocument.toXContent(builder, params);
|
||||
|
|
|
@ -50,8 +50,8 @@ import org.elasticsearch.plugins.PluginsService;
|
|||
import org.elasticsearch.search.SearchModule;
|
||||
import org.elasticsearch.threadpool.ExecutorBuilder;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TcpTransport;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.transport.netty.NettyTransport;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -107,7 +107,7 @@ public class TransportClient extends AbstractClient {
|
|||
|
||||
private PluginsService newPluginService(final Settings settings) {
|
||||
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(NetworkService.NETWORK_SERVER.getKey(), false)
|
||||
.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(b -> b.bind(ThreadPool.class).toInstance(threadPool));
|
||||
modules.add(new SearchModule(settings, namedWriteableRegistry) {
|
||||
@Override
|
||||
protected void configure() {
|
||||
// noop
|
||||
}
|
||||
});
|
||||
modules.add(new SearchModule(settings, namedWriteableRegistry, true));
|
||||
modules.add(new ActionModule(false, true, settings, null, settingsModule.getClusterSettings(),
|
||||
pluginsService.filterPlugins(ActionPlugin.class)));
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ public class FsBlobContainer extends AbstractBlobContainer {
|
|||
@Override
|
||||
public void deleteBlob(String blobName) throws IOException {
|
||||
Path blobPath = path.resolve(blobName);
|
||||
Files.deleteIfExists(blobPath);
|
||||
Files.delete(blobPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.common.io;
|
||||
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
|
@ -159,25 +158,6 @@ public final class Channels {
|
|||
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}
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -222,6 +222,11 @@ public abstract class TimeZoneRounding extends Rounding {
|
|||
long roundedUTC;
|
||||
if (isInDSTGap(rounded) == false) {
|
||||
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 {
|
||||
/*
|
||||
* Edge case where the rounded local time is illegal and landed
|
||||
|
|
|
@ -89,6 +89,7 @@ import org.elasticsearch.script.ScriptService;
|
|||
import org.elasticsearch.search.SearchModule;
|
||||
import org.elasticsearch.search.SearchService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TcpTransport;
|
||||
import org.elasticsearch.transport.Transport;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.transport.TransportSettings;
|
||||
|
@ -279,14 +280,14 @@ public final class ClusterSettings extends AbstractScopedSettings {
|
|||
TransportSettings.PUBLISH_PORT,
|
||||
TransportSettings.PORT,
|
||||
NettyTransport.WORKER_COUNT,
|
||||
NettyTransport.CONNECTIONS_PER_NODE_RECOVERY,
|
||||
NettyTransport.CONNECTIONS_PER_NODE_BULK,
|
||||
NettyTransport.CONNECTIONS_PER_NODE_REG,
|
||||
NettyTransport.CONNECTIONS_PER_NODE_STATE,
|
||||
NettyTransport.CONNECTIONS_PER_NODE_PING,
|
||||
NettyTransport.PING_SCHEDULE,
|
||||
NettyTransport.TCP_BLOCKING_CLIENT,
|
||||
NettyTransport.TCP_CONNECT_TIMEOUT,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_RECOVERY,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_BULK,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_REG,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_STATE,
|
||||
TcpTransport.CONNECTIONS_PER_NODE_PING,
|
||||
TcpTransport.PING_SCHEDULE,
|
||||
TcpTransport.TCP_BLOCKING_CLIENT,
|
||||
TcpTransport.TCP_CONNECT_TIMEOUT,
|
||||
NettyTransport.NETTY_MAX_CUMULATION_BUFFER_CAPACITY,
|
||||
NettyTransport.NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,
|
||||
NettyTransport.NETTY_RECEIVE_PREDICTOR_SIZE,
|
||||
|
@ -294,12 +295,12 @@ public final class ClusterSettings extends AbstractScopedSettings {
|
|||
NettyTransport.NETTY_RECEIVE_PREDICTOR_MAX,
|
||||
NetworkService.NETWORK_SERVER,
|
||||
NettyTransport.NETTY_BOSS_COUNT,
|
||||
NettyTransport.TCP_NO_DELAY,
|
||||
NettyTransport.TCP_KEEP_ALIVE,
|
||||
NettyTransport.TCP_REUSE_ADDRESS,
|
||||
NettyTransport.TCP_SEND_BUFFER_SIZE,
|
||||
NettyTransport.TCP_RECEIVE_BUFFER_SIZE,
|
||||
NettyTransport.TCP_BLOCKING_SERVER,
|
||||
TcpTransport.TCP_NO_DELAY,
|
||||
TcpTransport.TCP_KEEP_ALIVE,
|
||||
TcpTransport.TCP_REUSE_ADDRESS,
|
||||
TcpTransport.TCP_SEND_BUFFER_SIZE,
|
||||
TcpTransport.TCP_RECEIVE_BUFFER_SIZE,
|
||||
TcpTransport.TCP_BLOCKING_SERVER,
|
||||
NetworkService.GLOBAL_NETWORK_HOST_SETTING,
|
||||
NetworkService.GLOBAL_NETWORK_BINDHOST_SETTING,
|
||||
NetworkService.GLOBAL_NETWORK_PUBLISHHOST_SETTING,
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
|
||||
package org.elasticsearch.http;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.breaker.CircuitBreaker;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
|
@ -39,11 +45,6 @@ import org.elasticsearch.rest.RestRequest;
|
|||
import org.elasticsearch.rest.RestResponse;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.elasticsearch.rest.RestStatus.FORBIDDEN;
|
||||
import static org.elasticsearch.rest.RestStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
|
@ -57,15 +58,18 @@ public class HttpServer extends AbstractLifecycleComponent<HttpServer> implement
|
|||
|
||||
private final NodeService nodeService;
|
||||
|
||||
private final NodeClient client;
|
||||
|
||||
private final CircuitBreakerService circuitBreakerService;
|
||||
|
||||
@Inject
|
||||
public HttpServer(Settings settings, HttpServerTransport transport, RestController restController, NodeService nodeService,
|
||||
CircuitBreakerService circuitBreakerService) {
|
||||
NodeClient client, CircuitBreakerService circuitBreakerService) {
|
||||
super(settings);
|
||||
this.transport = transport;
|
||||
this.restController = restController;
|
||||
this.nodeService = nodeService;
|
||||
this.client = client;
|
||||
this.circuitBreakerService = circuitBreakerService;
|
||||
nodeService.setHttpServer(this);
|
||||
transport.httpServerAdapter(this);
|
||||
|
@ -115,7 +119,7 @@ public class HttpServer extends AbstractLifecycleComponent<HttpServer> implement
|
|||
}
|
||||
// iff we could reserve bytes for the request we need to send the response also over this channel
|
||||
responseChannel = new ResourceHandlingHttpChannel(channel, circuitBreakerService, contentLength);
|
||||
restController.dispatchRequest(request, responseChannel, threadContext);
|
||||
restController.dispatchRequest(request, responseChannel, client, threadContext);
|
||||
} catch (Throwable t) {
|
||||
restController.sendErrorResponse(request, responseChannel, t);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
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.ChannelBuffers;
|
||||
import org.jboss.netty.buffer.CompositeChannelBuffer;
|
||||
|
|
|
@ -24,8 +24,7 @@ import org.elasticsearch.common.bytes.BytesReference;
|
|||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
||||
import org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput;
|
||||
import org.elasticsearch.common.lease.Releasable;
|
||||
import org.elasticsearch.common.netty.NettyUtils;
|
||||
import org.elasticsearch.common.netty.ReleaseChannelFutureListener;
|
||||
import org.elasticsearch.transport.netty.NettyUtils;
|
||||
import org.elasticsearch.http.netty.cors.CorsHandler;
|
||||
import org.elasticsearch.http.netty.pipelining.OrderedDownstreamChannelEvent;
|
||||
import org.elasticsearch.http.netty.pipelining.OrderedUpstreamMessageEvent;
|
||||
|
@ -128,7 +127,7 @@ public final class NettyHttpChannel extends AbstractRestChannel {
|
|||
}
|
||||
|
||||
if (content instanceof Releasable) {
|
||||
future.addListener(new ReleaseChannelFutureListener((Releasable) content));
|
||||
future.addListener((x) -> ((Releasable)content).close());
|
||||
addedReleaseListener = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.http.netty;
|
|||
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
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.support.RestUtils;
|
||||
import org.jboss.netty.channel.Channel;
|
||||
|
|
|
@ -24,8 +24,8 @@ import com.carrotsearch.hppc.IntSet;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.netty.NettyUtils;
|
||||
import org.elasticsearch.common.netty.OpenChannelsHandler;
|
||||
import org.elasticsearch.transport.netty.NettyUtils;
|
||||
import org.elasticsearch.transport.netty.OpenChannelsHandler;
|
||||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
import org.elasticsearch.common.network.NetworkService;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -29,6 +29,8 @@ import java.util.Map;
|
|||
|
||||
public final class ConfigurationUtils {
|
||||
|
||||
public static final String TAG_KEY = "tag";
|
||||
|
||||
private ConfigurationUtils() {
|
||||
}
|
||||
|
||||
|
@ -255,7 +257,8 @@ public final class ConfigurationUtils {
|
|||
ConfigurationUtils.readOptionalList(null, null, config, Pipeline.ON_FAILURE_KEY);
|
||||
|
||||
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()) {
|
||||
throw newConfigurationException(processor.getType(), processor.getTag(), Pipeline.ON_FAILURE_KEY,
|
||||
|
|
|
@ -51,11 +51,13 @@ public interface Processor {
|
|||
* Creates a processor based on the specified map of maps config.
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* <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.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ public class Node implements Closeable {
|
|||
ClusterModule clusterModule = new ClusterModule(settings, clusterService);
|
||||
modules.add(clusterModule);
|
||||
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,
|
||||
clusterModule.getIndexNameExpressionResolver(), settingsModule.getClusterSettings(),
|
||||
pluginsService.filterPlugins(ActionPlugin.class)));
|
||||
|
@ -289,6 +289,7 @@ public class Node implements Closeable {
|
|||
modules.add(b -> {
|
||||
b.bind(PluginsService.class).toInstance(pluginsService);
|
||||
b.bind(Client.class).toInstance(client);
|
||||
b.bind(NodeClient.class).toInstance(client);
|
||||
b.bind(Environment.class).toInstance(environment);
|
||||
b.bind(ThreadPool.class).toInstance(threadPool);
|
||||
b.bind(NodeEnvironment.class).toInstance(nodeEnvironment);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.rest;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
|
@ -37,19 +36,10 @@ import org.elasticsearch.common.settings.Settings;
|
|||
public abstract class BaseRestHandler extends AbstractComponent implements RestHandler {
|
||||
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX =
|
||||
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope);
|
||||
private final Client client;
|
||||
protected final ParseFieldMatcher parseFieldMatcher;
|
||||
|
||||
protected BaseRestHandler(Settings settings, Client client) {
|
||||
protected BaseRestHandler(Settings settings) {
|
||||
super(settings);
|
||||
this.client = client;
|
||||
this.parseFieldMatcher = new ParseFieldMatcher(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void handleRequest(RestRequest request, RestChannel channel) throws Exception {
|
||||
handleRequest(request, channel, client);
|
||||
}
|
||||
|
||||
protected abstract void handleRequest(RestRequest request, RestChannel channel, Client client) throws Exception;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.elasticsearch.rest;
|
||||
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
|
@ -150,7 +151,7 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
|
|||
return (handler != null) ? handler.canTripCircuitBreaker() : true;
|
||||
}
|
||||
|
||||
public void dispatchRequest(final RestRequest request, final RestChannel channel, ThreadContext threadContext) throws Exception {
|
||||
public void dispatchRequest(final RestRequest request, final RestChannel channel, final NodeClient client, ThreadContext threadContext) throws Exception {
|
||||
if (!checkRequestParameters(request, channel)) {
|
||||
return;
|
||||
}
|
||||
|
@ -162,10 +163,10 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
|
|||
}
|
||||
}
|
||||
if (filters.length == 0) {
|
||||
executeHandler(request, channel);
|
||||
executeHandler(request, channel, client);
|
||||
} else {
|
||||
ControllerFilterChain filterChain = new ControllerFilterChain(handlerFilter);
|
||||
filterChain.continueProcessing(request, channel);
|
||||
filterChain.continueProcessing(request, channel, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,10 +201,10 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
|
|||
return true;
|
||||
}
|
||||
|
||||
void executeHandler(RestRequest request, RestChannel channel) throws Exception {
|
||||
void executeHandler(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
|
||||
final RestHandler handler = getHandler(request);
|
||||
if (handler != null) {
|
||||
handler.handleRequest(request, channel);
|
||||
handler.handleRequest(request, channel, client);
|
||||
} else {
|
||||
if (request.method() == RestRequest.Method.OPTIONS) {
|
||||
// when we have OPTIONS request, simply send OK by default (with the Access Control Origin header which gets automatically added)
|
||||
|
@ -261,16 +262,16 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void continueProcessing(RestRequest request, RestChannel channel) {
|
||||
public void continueProcessing(RestRequest request, RestChannel channel, NodeClient client) {
|
||||
try {
|
||||
int loc = index.getAndIncrement();
|
||||
if (loc > filters.length) {
|
||||
throw new IllegalStateException("filter continueProcessing was called more than expected");
|
||||
} else if (loc == filters.length) {
|
||||
executionFilter.process(request, channel, this);
|
||||
executionFilter.process(request, channel, client, this);
|
||||
} else {
|
||||
RestFilter preProcessor = filters[loc];
|
||||
preProcessor.process(request, channel, this);
|
||||
preProcessor.process(request, channel, client, this);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
|
@ -285,8 +286,8 @@ public class RestController extends AbstractLifecycleComponent<RestController> {
|
|||
class RestHandlerFilter extends RestFilter {
|
||||
|
||||
@Override
|
||||
public void process(RestRequest request, RestChannel channel, RestFilterChain filterChain) throws Exception {
|
||||
executeHandler(request, channel);
|
||||
public void process(RestRequest request, RestChannel channel, NodeClient client, RestFilterChain filterChain) throws Exception {
|
||||
executeHandler(request, channel, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ package org.elasticsearch.rest;
|
|||
|
||||
import java.io.Closeable;
|
||||
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
|
||||
/**
|
||||
* A filter allowing to filter rest operations.
|
||||
*/
|
||||
|
@ -43,5 +45,5 @@ public abstract class RestFilter implements Closeable {
|
|||
* Process the rest request. Using the channel to send a response, or the filter chain to continue
|
||||
* processing the request.
|
||||
*/
|
||||
public abstract void process(RestRequest request, RestChannel channel, RestFilterChain filterChain) throws Exception;
|
||||
public abstract void process(RestRequest request, RestChannel channel, NodeClient client, RestFilterChain filterChain) throws Exception;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package org.elasticsearch.rest;
|
||||
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
|
||||
/**
|
||||
* A filter chain allowing to continue and process the rest request.
|
||||
*/
|
||||
|
@ -28,5 +30,5 @@ public interface RestFilterChain {
|
|||
* Continue processing the request. Should only be called if a response has not been sent
|
||||
* through the channel.
|
||||
*/
|
||||
void continueProcessing(RestRequest request, RestChannel channel);
|
||||
void continueProcessing(RestRequest request, RestChannel channel, NodeClient client);
|
||||
}
|
||||
|
|
|
@ -19,12 +19,21 @@
|
|||
|
||||
package org.elasticsearch.rest;
|
||||
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
|
||||
/**
|
||||
* Handler for REST requests
|
||||
*/
|
||||
public interface RestHandler {
|
||||
|
||||
void handleRequest(RestRequest request, RestChannel channel) throws Exception;
|
||||
/**
|
||||
* Handles a rest request.
|
||||
*
|
||||
* @param request The request to handle
|
||||
* @param channel The channel to write the request response to
|
||||
* @param client A client to use to make internal requests on behalf of the original request
|
||||
*/
|
||||
void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception;
|
||||
|
||||
default boolean canTripCircuitBreaker() {
|
||||
return true;
|
||||
|
|
|
@ -19,11 +19,12 @@
|
|||
|
||||
package org.elasticsearch.rest.action.admin.cluster.allocation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.elasticsearch.ExceptionsHelper;
|
||||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
|
||||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -42,22 +43,20 @@ import org.elasticsearch.rest.RestStatus;
|
|||
import org.elasticsearch.rest.action.support.RestActions;
|
||||
import org.elasticsearch.rest.action.support.RestBuilderListener;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Class handling cluster allocation explanation at the REST level
|
||||
*/
|
||||
public class RestClusterAllocationExplainAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterAllocationExplainAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestClusterAllocationExplainAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/allocation/explain", this);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/_cluster/allocation/explain", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
ClusterAllocationExplainRequest req;
|
||||
if (RestActions.hasBodyContent(request) == false) {
|
||||
// Empty request signals "explain the first unassigned shard you find"
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.health;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.health.ClusterHealthStatus;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -42,15 +42,15 @@ import static org.elasticsearch.client.Requests.clusterHealthRequest;
|
|||
public class RestClusterHealthAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterHealthAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestClusterHealthAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/health", this);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/health/{index}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local()));
|
||||
clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout()));
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.hotthreads;
|
|||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads;
|
||||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -42,8 +42,8 @@ import org.elasticsearch.rest.action.support.RestResponseListener;
|
|||
public class RestNodesHotThreadsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestNodesHotThreadsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestNodesHotThreadsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hotthreads", this);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hot_threads", this);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/{nodeId}/hotthreads", this);
|
||||
|
@ -56,7 +56,7 @@ public class RestNodesHotThreadsAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
|
||||
NodesHotThreadsRequest nodesHotThreadsRequest = new NodesHotThreadsRequest(nodesIds);
|
||||
nodesHotThreadsRequest.threads(request.paramAsInt("threads", nodesHotThreadsRequest.threads()));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.rest.action.admin.cluster.node.info;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -46,8 +46,8 @@ public class RestNodesInfoAction extends BaseRestHandler {
|
|||
private final static Set<String> ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "os", "plugins", "process", "settings", "thread_pool", "transport", "ingest", "indices");
|
||||
|
||||
@Inject
|
||||
public RestNodesInfoAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
|
||||
super(settings, client);
|
||||
public RestNodesInfoAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_nodes", this);
|
||||
// this endpoint is used for metrics, not for nodeIds, like /_nodes/fs
|
||||
controller.registerHandler(GET, "/_nodes/{nodeId}", this);
|
||||
|
@ -59,7 +59,7 @@ public class RestNodesInfoAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String[] nodeIds;
|
||||
Set<String> metrics;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.stats;
|
|||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags.Flag;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestNodesStatsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestNodesStatsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestNodesStatsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_nodes/stats", this);
|
||||
controller.registerHandler(GET, "/_nodes/{nodeId}/stats", this);
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class RestNodesStatsAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
|
||||
Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.tasks;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -42,15 +42,15 @@ public class RestCancelTasksAction extends BaseRestHandler {
|
|||
private final ClusterService clusterService;
|
||||
|
||||
@Inject
|
||||
public RestCancelTasksAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
|
||||
super(settings, client);
|
||||
public RestCancelTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
|
||||
super(settings);
|
||||
this.clusterService = clusterService;
|
||||
controller.registerHandler(POST, "/_tasks/_cancel", this);
|
||||
controller.registerHandler(POST, "/_tasks/{taskId}/_cancel", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String[] nodesIds = Strings.splitStringByCommaToArray(request.param("nodeId"));
|
||||
TaskId taskId = new TaskId(request.param("taskId"));
|
||||
String[] actions = Strings.splitStringByCommaToArray(request.param("actions"));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.rest.action.admin.cluster.node.tasks;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -35,13 +35,13 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
|
||||
public class RestGetTaskAction extends BaseRestHandler {
|
||||
@Inject
|
||||
public RestGetTaskAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestGetTaskAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_tasks/{taskId}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
TaskId taskId = new TaskId(request.param("taskId"));
|
||||
boolean waitForCompletion = request.paramAsBoolean("wait_for_completion", false);
|
||||
TimeValue timeout = request.paramAsTime("timeout", null);
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.node.tasks;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -42,8 +42,8 @@ public class RestListTasksAction extends BaseRestHandler {
|
|||
private final ClusterService clusterService;
|
||||
|
||||
@Inject
|
||||
public RestListTasksAction(Settings settings, RestController controller, Client client, ClusterService clusterService) {
|
||||
super(settings, client);
|
||||
public RestListTasksAction(Settings settings, RestController controller, ClusterService clusterService) {
|
||||
super(settings);
|
||||
this.clusterService = clusterService;
|
||||
controller.registerHandler(GET, "/_tasks", this);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class RestListTasksAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
ActionListener<ListTasksResponse> listener = nodeSettingListener(clusterService, new RestToXContentListener<>(channel));
|
||||
client.admin().cluster().listTasks(generateListTasksRequest(request), listener);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.repositories.delete;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
|||
public class RestDeleteRepositoryAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteRepositoryAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestDeleteRepositoryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(DELETE, "/_snapshot/{repository}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
DeleteRepositoryRequest deleteRepositoryRequest = deleteRepositoryRequest(request.param("repository"));
|
||||
deleteRepositoryRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteRepositoryRequest.masterNodeTimeout()));
|
||||
deleteRepositoryRequest.timeout(request.paramAsTime("timeout", deleteRepositoryRequest.timeout()));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.repositories.get;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.RepositoriesMetaData;
|
||||
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -49,15 +49,15 @@ public class RestGetRepositoriesAction extends BaseRestHandler {
|
|||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestGetRepositoriesAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
|
||||
super(settings, client);
|
||||
public RestGetRepositoriesAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_snapshot", this);
|
||||
controller.registerHandler(GET, "/_snapshot/{repository}", this);
|
||||
this.settingsFilter = settingsFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] repositories = request.paramAsStringArray("repository", Strings.EMPTY_ARRAY);
|
||||
GetRepositoriesRequest getRepositoriesRequest = getRepositoryRequest(repositories);
|
||||
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.repositories.put;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -40,15 +40,15 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
public class RestPutRepositoryAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestPutRepositoryAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestPutRepositoryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(PUT, "/_snapshot/{repository}", this);
|
||||
controller.registerHandler(POST, "/_snapshot/{repository}", this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
PutRepositoryRequest putRepositoryRequest = putRepositoryRequest(request.param("repository"));
|
||||
putRepositoryRequest.source(request.content().toUtf8());
|
||||
putRepositoryRequest.verify(request.paramAsBoolean("verify", true));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.rest.action.admin.cluster.repositories.verify;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -35,13 +35,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
public class RestVerifyRepositoryAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestVerifyRepositoryAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestVerifyRepositoryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_snapshot/{repository}/_verify", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
VerifyRepositoryRequest verifyRepositoryRequest = verifyRepositoryRequest(request.param("repository"));
|
||||
verifyRepositoryRequest.masterNodeTimeout(request.paramAsTime("master_timeout", verifyRepositoryRequest.masterNodeTimeout()));
|
||||
verifyRepositoryRequest.timeout(request.paramAsTime("timeout", verifyRepositoryRequest.timeout()));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.reroute;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteRequest;
|
||||
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.routing.allocation.command.AllocationCommandRegistry;
|
||||
|
@ -65,16 +65,16 @@ public class RestClusterRerouteAction extends BaseRestHandler {
|
|||
private final AllocationCommandRegistry registry;
|
||||
|
||||
@Inject
|
||||
public RestClusterRerouteAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter,
|
||||
public RestClusterRerouteAction(Settings settings, RestController controller, SettingsFilter settingsFilter,
|
||||
AllocationCommandRegistry registry) {
|
||||
super(settings, client);
|
||||
super(settings);
|
||||
this.settingsFilter = settingsFilter;
|
||||
this.registry = registry;
|
||||
controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
|
||||
ClusterRerouteRequest clusterRerouteRequest = createRequest(request, registry, parseFieldMatcher);
|
||||
client.admin().cluster().reroute(clusterRerouteRequest, new AcknowledgedRestListener<ClusterRerouteResponse>(channel) {
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.settings;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -50,15 +50,15 @@ public class RestClusterGetSettingsAction extends BaseRestHandler {
|
|||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestClusterGetSettingsAction(Settings settings, RestController controller, Client client, ClusterSettings clusterSettings, SettingsFilter settingsFilter) {
|
||||
super(settings, client);
|
||||
public RestClusterGetSettingsAction(Settings settings, RestController controller, ClusterSettings clusterSettings, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
this.clusterSettings = clusterSettings;
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this);
|
||||
this.settingsFilter = settingsFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest()
|
||||
.routingTable(false)
|
||||
.nodes(false);
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.settings;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -42,13 +42,13 @@ import java.util.Map;
|
|||
public class RestClusterUpdateSettingsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterUpdateSettingsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestClusterUpdateSettingsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
|
||||
final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest();
|
||||
clusterUpdateSettingsRequest.timeout(request.paramAsTime("timeout", clusterUpdateSettingsRequest.timeout()));
|
||||
clusterUpdateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterUpdateSettingsRequest.masterNodeTimeout()));
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.shards;
|
|||
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
public class RestClusterSearchShardsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterSearchShardsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestClusterSearchShardsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_search_shards", this);
|
||||
controller.registerHandler(POST, "/_search_shards", this);
|
||||
controller.registerHandler(GET, "/{index}/_search_shards", this);
|
||||
|
@ -52,7 +52,7 @@ public class RestClusterSearchShardsAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
final ClusterSearchShardsRequest clusterSearchShardsRequest = Requests.clusterSearchShardsRequest(indices);
|
||||
clusterSearchShardsRequest.local(request.paramAsBoolean("local", clusterSearchShardsRequest.local()));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.create;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -40,14 +40,14 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
public class RestCreateSnapshotAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestCreateSnapshotAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestCreateSnapshotAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this);
|
||||
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
CreateSnapshotRequest createSnapshotRequest = createSnapshotRequest(request.param("repository"), request.param("snapshot"));
|
||||
createSnapshotRequest.source(request.content().toUtf8());
|
||||
createSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createSnapshotRequest.masterNodeTimeout()));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.delete;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
|||
public class RestDeleteSnapshotAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteSnapshotAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestDeleteSnapshotAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
DeleteSnapshotRequest deleteSnapshotRequest = deleteSnapshotRequest(request.param("repository"), request.param("snapshot"));
|
||||
deleteSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteSnapshotRequest.masterNodeTimeout()));
|
||||
client.admin().cluster().deleteSnapshot(deleteSnapshotRequest, new AcknowledgedRestListener<DeleteSnapshotResponse>(channel));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.get;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -40,14 +40,14 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestGetSnapshotsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetSnapshotsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestGetSnapshotsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String repository = request.param("repository");
|
||||
String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.restore;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -39,13 +39,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
public class RestRestoreSnapshotAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestRestoreSnapshotAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestRestoreSnapshotAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
RestoreSnapshotRequest restoreSnapshotRequest = restoreSnapshotRequest(request.param("repository"), request.param("snapshot"));
|
||||
restoreSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", restoreSnapshotRequest.masterNodeTimeout()));
|
||||
restoreSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.snapshots.status;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -40,15 +40,15 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestSnapshotsStatusAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestSnapshotsStatusAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestSnapshotsStatusAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}/_status", this);
|
||||
controller.registerHandler(GET, "/_snapshot/{repository}/_status", this);
|
||||
controller.registerHandler(GET, "/_snapshot/_status", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String repository = request.param("repository", "_all");
|
||||
String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);
|
||||
if (snapshots.length == 1 && "_all".equalsIgnoreCase(snapshots[0])) {
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.cluster.state;
|
|||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -50,8 +50,8 @@ public class RestClusterStateAction extends BaseRestHandler {
|
|||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestClusterStateAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) {
|
||||
super(settings, client);
|
||||
public RestClusterStateAction(Settings settings, RestController controller, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state", this);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}", this);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}/{indices}", this);
|
||||
|
@ -60,7 +60,7 @@ public class RestClusterStateAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest();
|
||||
clusterStateRequest.indicesOptions(IndicesOptions.fromRequest(request, clusterStateRequest.indicesOptions()));
|
||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.rest.action.admin.cluster.stats;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -35,14 +35,14 @@ import org.elasticsearch.rest.action.support.RestActions.NodesResponseRestListen
|
|||
public class RestClusterStatsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClusterStatsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestClusterStatsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats", this);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats/nodes/{nodeId}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
ClusterStatsRequest clusterStatsRequest = new ClusterStatsRequest().nodesIds(request.paramAsStringArray("nodeId", null));
|
||||
clusterStatsRequest.timeout(request.param("timeout"));
|
||||
client.admin().cluster().clusterStats(clusterStatsRequest, new NodesResponseRestListener<>(channel));
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.elasticsearch.rest.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -33,12 +33,12 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
|||
public class RestDeleteStoredScriptAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteStoredScriptAction(Settings settings, RestController controller, Client client) {
|
||||
this(settings, controller, true, client);
|
||||
public RestDeleteStoredScriptAction(Settings settings, RestController controller) {
|
||||
this(settings, controller, true);
|
||||
}
|
||||
|
||||
protected RestDeleteStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
|
||||
super(settings, client);
|
||||
protected RestDeleteStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
|
||||
super(settings);
|
||||
if (registerDefaultHandlers) {
|
||||
controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class RestDeleteStoredScriptAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, NodeClient client) {
|
||||
DeleteStoredScriptRequest deleteStoredScriptRequest = new DeleteStoredScriptRequest(getScriptLang(request), request.param("id"));
|
||||
client.admin().cluster().deleteStoredScript(deleteStoredScriptRequest, new AcknowledgedRestListener<>(channel));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.cluster.storedscripts;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -38,12 +38,12 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestGetStoredScriptAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetStoredScriptAction(Settings settings, RestController controller, Client client) {
|
||||
this(settings, controller, true, client);
|
||||
public RestGetStoredScriptAction(Settings settings, RestController controller) {
|
||||
this(settings, controller, true);
|
||||
}
|
||||
|
||||
protected RestGetStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
|
||||
super(settings, client);
|
||||
protected RestGetStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
|
||||
super(settings);
|
||||
if (registerDefaultHandlers) {
|
||||
controller.registerHandler(GET, "/_scripts/{lang}/{id}", this);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class RestGetStoredScriptAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, NodeClient client) {
|
||||
final GetStoredScriptRequest getRequest = new GetStoredScriptRequest(getScriptLang(request), request.param("id"));
|
||||
client.admin().cluster().getStoredScript(getRequest, new RestBuilderListener<GetStoredScriptResponse>(channel) {
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.elasticsearch.rest.action.admin.cluster.storedscripts;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -34,12 +34,12 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
public class RestPutStoredScriptAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestPutStoredScriptAction(Settings settings, RestController controller, Client client) {
|
||||
this(settings, controller, true, client);
|
||||
public RestPutStoredScriptAction(Settings settings, RestController controller) {
|
||||
this(settings, controller, true);
|
||||
}
|
||||
|
||||
protected RestPutStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) {
|
||||
super(settings, client);
|
||||
protected RestPutStoredScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers) {
|
||||
super(settings);
|
||||
if (registerDefaultHandlers) {
|
||||
controller.registerHandler(POST, "/_scripts/{lang}/{id}", this);
|
||||
controller.registerHandler(PUT, "/_scripts/{lang}/{id}", this);
|
||||
|
@ -51,7 +51,7 @@ public class RestPutStoredScriptAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, NodeClient client) {
|
||||
PutStoredScriptRequest putRequest = new PutStoredScriptRequest(getScriptLang(request), request.param("id"));
|
||||
putRequest.script(request.content());
|
||||
client.admin().cluster().putStoredScript(putRequest, new AcknowledgedRestListener<>(channel));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.cluster.tasks;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -35,13 +35,13 @@ import org.elasticsearch.rest.action.support.RestToXContentListener;
|
|||
public class RestPendingClusterTasksAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestPendingClusterTasksAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestPendingClusterTasksAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
|
||||
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
|
||||
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.rest.action.admin.indices;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.RestToXContentListener;
|
|||
public class RestRolloverIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestRolloverIndexAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestRolloverIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover", this);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_rollover/{new_index}", this);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
RolloverRequest rolloverIndexRequest = new RolloverRequest(request.param("index"), request.param("new_index"));
|
||||
if (request.hasContent()) {
|
||||
rolloverIndexRequest.source(request.content());
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.rest.action.admin.indices;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.shrink.ShrinkRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
|||
public class RestShrinkIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestShrinkIndexAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestShrinkIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_shrink/{target}", this);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_shrink/{target}", this);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
if (request.param("target") == null) {
|
||||
throw new IllegalArgumentException("no target index");
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.alias;
|
|||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.AliasAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -46,13 +46,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
public class RestIndicesAliasesAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesAliasesAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestIndicesAliasesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_aliases", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
|
||||
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
||||
indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", indicesAliasesRequest.masterNodeTimeout()));
|
||||
try (XContentParser parser = XContentFactory.xContent(request.content()).createParser(request.content())) {
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.alias.delete;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -37,14 +37,14 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
|||
public class RestIndexDeleteAliasesAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndexDeleteAliasesAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestIndexDeleteAliasesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(DELETE, "/{index}/_alias/{name}", this);
|
||||
controller.registerHandler(DELETE, "/{index}/_aliases/{name}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
final String[] aliases = Strings.splitStringByCommaToArray(request.param("name"));
|
||||
IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest();
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
|||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -50,14 +50,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestGetAliasesAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetAliasesAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestGetAliasesAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_alias/{name}", this);
|
||||
controller.registerHandler(GET, "/{index}/_alias/{name}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] aliases = request.paramAsStringArrayOrEmptyIfAll("name");
|
||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
final GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -44,15 +44,15 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestAliasesExistAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestAliasesExistAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestAliasesExistAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(HEAD, "/_alias/{name}", this);
|
||||
controller.registerHandler(HEAD, "/{index}/_alias/{name}", this);
|
||||
controller.registerHandler(HEAD, "/{index}/_alias", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String[] aliases = request.paramAsStringArray("name", Strings.EMPTY_ARRAY);
|
||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.indices.alias.put;
|
|||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.AliasAction;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
public class RestIndexPutAliasAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndexPutAliasAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestIndexPutAliasAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(PUT, "/{index}/_alias/{name}", this);
|
||||
controller.registerHandler(PUT, "/_alias/{name}", this);
|
||||
controller.registerHandler(PUT, "/{index}/_aliases/{name}", this);
|
||||
|
@ -62,7 +62,7 @@ public class RestIndexPutAliasAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
|
||||
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
String alias = request.param("name");
|
||||
Map<String, Object> filter = null;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.analyze;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
|
@ -60,8 +60,8 @@ public class RestAnalyzeAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Inject
|
||||
public RestAnalyzeAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestAnalyzeAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_analyze", this);
|
||||
controller.registerHandler(GET, "/{index}/_analyze", this);
|
||||
controller.registerHandler(POST, "/_analyze", this);
|
||||
|
@ -69,7 +69,7 @@ public class RestAnalyzeAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
|
||||
String[] texts = request.paramAsStringArrayOrEmptyIfAll("text");
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.cache.clear;
|
|||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
|||
public class RestClearIndicesCacheAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestClearIndicesCacheAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestClearIndicesCacheAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_cache/clear", this);
|
||||
controller.registerHandler(POST, "/{index}/_cache/clear", this);
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class RestClearIndicesCacheAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
clearIndicesCacheRequest.indicesOptions(IndicesOptions.fromRequest(request, clearIndicesCacheRequest.indicesOptions()));
|
||||
fromRequest(request, clearIndicesCacheRequest, parseFieldMatcher);
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.close;
|
|||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
|||
public class RestCloseIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestCloseIndexAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestCloseIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/_close", this);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_close", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
closeIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", closeIndexRequest.masterNodeTimeout()));
|
||||
closeIndexRequest.timeout(request.paramAsTime("timeout", closeIndexRequest.timeout()));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.indices.create;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -36,15 +36,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
|||
public class RestCreateIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestCreateIndexAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestCreateIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}", this);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/{index}", this);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
CreateIndexRequest createIndexRequest = new CreateIndexRequest(request.param("index"));
|
||||
if (request.hasContent()) {
|
||||
createIndexRequest.source(request.content());
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.delete;
|
|||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
|||
public class RestDeleteIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteIndexAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestDeleteIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.DELETE, "/", this);
|
||||
controller.registerHandler(RestRequest.Method.DELETE, "/{index}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
deleteIndexRequest.timeout(request.paramAsTime("timeout", deleteIndexRequest.timeout()));
|
||||
deleteIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexRequest.masterNodeTimeout()));
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.exists.indices;
|
|||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
|
||||
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -45,13 +45,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestIndicesExistsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesExistsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestIndicesExistsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(HEAD, "/{index}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
IndicesExistsRequest indicesExistsRequest = new IndicesExistsRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
indicesExistsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesExistsRequest.indicesOptions()));
|
||||
indicesExistsRequest.local(request.paramAsBoolean("local", indicesExistsRequest.local()));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.indices.exists.types;
|
|||
import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest;
|
||||
import org.elasticsearch.action.admin.indices.exists.types.TypesExistsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -44,13 +44,13 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestTypesExistsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestTypesExistsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestTypesExistsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(HEAD, "/{index}/{type}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
TypesExistsRequest typesExistsRequest = new TypesExistsRequest(
|
||||
Strings.splitStringByCommaToArray(request.param("index")), Strings.splitStringByCommaToArray(request.param("type"))
|
||||
);
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.flush;
|
|||
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
|||
public class RestFlushAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestFlushAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestFlushAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_flush", this);
|
||||
controller.registerHandler(POST, "/{index}/_flush", this);
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class RestFlushAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
FlushRequest flushRequest = new FlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
flushRequest.indicesOptions(IndicesOptions.fromRequest(request, flushRequest.indicesOptions()));
|
||||
flushRequest.force(request.paramAsBoolean("force", flushRequest.force()));
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.flush;
|
|||
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
|
||||
import org.elasticsearch.action.admin.indices.flush.SyncedFlushResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
public class RestSyncedFlushAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestSyncedFlushAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestSyncedFlushAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_flush/synced", this);
|
||||
controller.registerHandler(POST, "/{index}/_flush/synced", this);
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class RestSyncedFlushAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.lenientExpandOpen());
|
||||
SyncedFlushRequest syncedFlushRequest = new SyncedFlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
syncedFlushRequest.indicesOptions(indicesOptions);
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.forcemerge;
|
|||
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
|
||||
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -45,14 +45,14 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
|||
public class RestForceMergeAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestForceMergeAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestForceMergeAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_forcemerge", this);
|
||||
controller.registerHandler(POST, "/{index}/_forcemerge", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
ForceMergeRequest mergeRequest = new ForceMergeRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
mergeRequest.indicesOptions(IndicesOptions.fromRequest(request, mergeRequest.indicesOptions()));
|
||||
mergeRequest.maxNumSegments(request.paramAsInt("max_num_segments", mergeRequest.maxNumSegments()));
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
|
|||
import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
|
||||
import org.elasticsearch.action.admin.indices.get.GetIndexResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
||||
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -57,8 +57,8 @@ public class RestGetIndicesAction extends BaseRestHandler {
|
|||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestGetIndicesAction(Settings settings, RestController controller, Client client, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter) {
|
||||
super(settings, client);
|
||||
public RestGetIndicesAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
this.indexScopedSettings = indexScopedSettings;
|
||||
controller.registerHandler(GET, "/{index}", this);
|
||||
controller.registerHandler(GET, "/{index}/{type}", this);
|
||||
|
@ -66,7 +66,7 @@ public class RestGetIndicesAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
String[] featureParams = request.paramAsStringArray("type", null);
|
||||
// Work out if the indices is a list of features
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsReques
|
|||
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestGetFieldMappingAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetFieldMappingAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestGetFieldMappingAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_mapping/field/{fields}", this);
|
||||
controller.registerHandler(GET, "/_mapping/{type}/field/{fields}", this);
|
||||
controller.registerHandler(GET, "/{index}/_mapping/field/{fields}", this);
|
||||
|
@ -60,7 +60,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
|
||||
final String[] fields = Strings.splitStringByCommaToArray(request.param("fields"));
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
|||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.MappingMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
|
@ -50,8 +50,8 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestGetMappingAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetMappingAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestGetMappingAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/{index}/{type}/_mapping", this);
|
||||
controller.registerHandler(GET, "/{index}/_mappings/{type}", this);
|
||||
controller.registerHandler(GET, "/{index}/_mapping/{type}", this);
|
||||
|
@ -59,7 +59,7 @@ public class RestGetMappingAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
|
||||
GetMappingsRequest getMappingsRequest = new GetMappingsRequest();
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.mapping.put;
|
|||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -43,8 +43,8 @@ public class RestPutMappingAction extends BaseRestHandler {
|
|||
|
||||
|
||||
@Inject
|
||||
public RestPutMappingAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestPutMappingAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(PUT, "/{index}/_mapping/", this);
|
||||
controller.registerHandler(PUT, "/{index}/{type}/_mapping", this);
|
||||
controller.registerHandler(PUT, "/{index}/_mapping/{type}", this);
|
||||
|
@ -68,7 +68,7 @@ public class RestPutMappingAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
PutMappingRequest putMappingRequest = putMappingRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
putMappingRequest.type(request.param("type"));
|
||||
putMappingRequest.source(request.content().toUtf8());
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.open;
|
|||
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.open.OpenIndexResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -38,14 +38,14 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
|||
public class RestOpenIndexAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestOpenIndexAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestOpenIndexAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/_open", this);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/{index}/_open", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
OpenIndexRequest openIndexRequest = new OpenIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
|
||||
openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.recovery;
|
|||
import org.elasticsearch.action.admin.indices.recovery.RecoveryRequest;
|
||||
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -44,14 +44,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestRecoveryAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestRecoveryAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestRecoveryAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_recovery", this);
|
||||
controller.registerHandler(GET, "/{index}/_recovery", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
|
||||
final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.refresh;
|
|||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
|||
public class RestRefreshAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestRefreshAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestRefreshAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_refresh", this);
|
||||
controller.registerHandler(POST, "/{index}/_refresh", this);
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class RestRefreshAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
RefreshRequest refreshRequest = new RefreshRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
refreshRequest.indicesOptions(IndicesOptions.fromRequest(request, refreshRequest.indicesOptions()));
|
||||
client.admin().indices().refresh(refreshRequest, new RestBuilderListener<RefreshResponse>(channel) {
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.segments;
|
|||
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentResponse;
|
||||
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -44,14 +44,14 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
|||
public class RestIndicesSegmentsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesSegmentsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestIndicesSegmentsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_segments", this);
|
||||
controller.registerHandler(GET, "/{index}/_segments", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
indicesSegmentsRequest.verbose(request.paramAsBoolean("verbose", false));
|
||||
indicesSegmentsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesSegmentsRequest.indicesOptions()));
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
|||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
|
@ -47,8 +47,8 @@ public class RestGetSettingsAction extends BaseRestHandler {
|
|||
private final SettingsFilter settingsFilter;
|
||||
|
||||
@Inject
|
||||
public RestGetSettingsAction(Settings settings, RestController controller, Client client, IndexScopedSettings indexScopedSettings, final SettingsFilter settingsFilter) {
|
||||
super(settings, client);
|
||||
public RestGetSettingsAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, final SettingsFilter settingsFilter) {
|
||||
super(settings);
|
||||
this.indexScopedSettings = indexScopedSettings;
|
||||
controller.registerHandler(GET, "/{index}/_settings/{name}", this);
|
||||
controller.registerHandler(GET, "/_settings/{name}", this);
|
||||
|
@ -57,7 +57,7 @@ public class RestGetSettingsAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] names = request.paramAsStringArrayOrEmptyIfAll("name");
|
||||
final boolean renderDefaults = request.paramAsBoolean("include_defaults", false);
|
||||
GetSettingsRequest getSettingsRequest = new GetSettingsRequest()
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.admin.indices.settings;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -53,14 +53,14 @@ public class RestUpdateSettingsAction extends BaseRestHandler {
|
|||
"allow_no_indices"));
|
||||
|
||||
@Inject
|
||||
public RestUpdateSettingsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestUpdateSettingsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/{index}/_settings", this);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/_settings", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
UpdateSettingsRequest updateSettingsRequest = updateSettingsRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
updateSettingsRequest.timeout(request.paramAsTime("timeout", updateSettingsRequest.timeout()));
|
||||
updateSettingsRequest.setPreserveExisting(request.paramAsBoolean("preserve_existing", updateSettingsRequest.isPreserveExisting()));
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresAction;
|
|||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest;
|
||||
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -45,14 +45,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestIndicesShardStoresAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesShardStoresAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestIndicesShardStoresAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_shard_stores", this);
|
||||
controller.registerHandler(GET, "/{index}/_shard_stores", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
IndicesShardStoresRequest indicesShardStoresRequest = new IndicesShardStoresRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
if (request.hasParam("status")) {
|
||||
indicesShardStoresRequest.shardStatuses(Strings.splitStringByCommaToArray(request.param("status")));
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.admin.indices.stats;
|
|||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -46,8 +46,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
|||
public class RestIndicesStatsAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestIndicesStatsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestIndicesStatsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_stats", this);
|
||||
controller.registerHandler(GET, "/_stats/{metric}", this);
|
||||
controller.registerHandler(GET, "/_stats/{metric}/{indexMetric}", this);
|
||||
|
@ -56,7 +56,7 @@ public class RestIndicesStatsAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest();
|
||||
indicesStatsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesStatsRequest.indicesOptions()));
|
||||
indicesStatsRequest.indices(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.template.delete;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -35,13 +35,13 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
|||
public class RestDeleteIndexTemplateAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestDeleteIndexTemplateAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestDeleteIndexTemplateAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name"));
|
||||
deleteIndexTemplateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexTemplateRequest.masterNodeTimeout()));
|
||||
client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new AcknowledgedRestListener<DeleteIndexTemplateResponse>(channel));
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.template.get;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -49,15 +49,15 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestGetIndexTemplateAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestGetIndexTemplateAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestGetIndexTemplateAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
controller.registerHandler(GET, "/_template", this);
|
||||
controller.registerHandler(GET, "/_template/{name}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] names = Strings.splitStringByCommaToArray(request.param("name"));
|
||||
|
||||
GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(names);
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.template.head;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -42,14 +42,14 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
public class RestHeadIndexTemplateAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestHeadIndexTemplateAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestHeadIndexTemplateAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
controller.registerHandler(HEAD, "/_template/{name}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
GetIndexTemplatesRequest getIndexTemplatesRequest = new GetIndexTemplatesRequest(request.param("name"));
|
||||
getIndexTemplatesRequest.local(request.paramAsBoolean("local", getIndexTemplatesRequest.local()));
|
||||
getIndexTemplatesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getIndexTemplatesRequest.masterNodeTimeout()));
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.elasticsearch.rest.action.admin.indices.template.put;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest;
|
||||
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -35,15 +35,15 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener;
|
|||
public class RestPutIndexTemplateAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestPutIndexTemplateAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestPutIndexTemplateAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(RestRequest.Method.PUT, "/_template/{name}", this);
|
||||
controller.registerHandler(RestRequest.Method.POST, "/_template/{name}", this);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
|
||||
putRequest.template(request.param("template", putRequest.template()));
|
||||
putRequest.order(request.paramAsInt("order", putRequest.order()));
|
||||
|
|
|
@ -23,7 +23,8 @@ import org.elasticsearch.Version;
|
|||
import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse;
|
||||
import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeRequest;
|
||||
import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -48,8 +49,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh
|
|||
public class RestUpgradeAction extends BaseRestHandler {
|
||||
|
||||
@Inject
|
||||
public RestUpgradeAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestUpgradeAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, "/_upgrade", this);
|
||||
controller.registerHandler(POST, "/{index}/_upgrade", this);
|
||||
|
||||
|
@ -58,7 +59,7 @@ public class RestUpgradeAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void handleRequest(RestRequest request, RestChannel channel, Client client) throws Exception {
|
||||
public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
|
||||
if (request.method().equals(RestRequest.Method.GET)) {
|
||||
handleGet(request, channel, client);
|
||||
} else if (request.method().equals(RestRequest.Method.POST)) {
|
||||
|
@ -66,7 +67,7 @@ public class RestUpgradeAction extends BaseRestHandler {
|
|||
}
|
||||
}
|
||||
|
||||
void handleGet(final RestRequest request, RestChannel channel, Client client) {
|
||||
void handleGet(final RestRequest request, RestChannel channel, NodeClient client) {
|
||||
client.admin().indices().prepareUpgradeStatus(Strings.splitStringByCommaToArray(request.param("index")))
|
||||
.execute(new RestBuilderListener<UpgradeStatusResponse>(channel) {
|
||||
@Override
|
||||
|
@ -79,7 +80,7 @@ public class RestUpgradeAction extends BaseRestHandler {
|
|||
});
|
||||
}
|
||||
|
||||
void handlePost(final RestRequest request, RestChannel channel, Client client) {
|
||||
void handlePost(final RestRequest request, RestChannel channel, NodeClient client) {
|
||||
UpgradeRequest upgradeReq = new UpgradeRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
upgradeReq.upgradeOnlyAncientSegments(request.paramAsBoolean("only_ancient_segments", false));
|
||||
client.admin().indices().upgrade(upgradeReq, new RestBuilderListener<UpgradeResponse>(channel) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.elasticsearch.action.admin.indices.validate.query.QueryExplanation;
|
|||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -55,8 +55,8 @@ public class RestValidateQueryAction extends BaseRestHandler {
|
|||
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
||||
|
||||
@Inject
|
||||
public RestValidateQueryAction(Settings settings, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
|
||||
super(settings, client);
|
||||
public RestValidateQueryAction(Settings settings, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_validate/query", this);
|
||||
controller.registerHandler(POST, "/_validate/query", this);
|
||||
controller.registerHandler(GET, "/{index}/_validate/query", this);
|
||||
|
@ -67,7 +67,7 @@ public class RestValidateQueryAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
|
||||
ValidateQueryRequest validateQueryRequest = new ValidateQueryRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
validateQueryRequest.indicesOptions(IndicesOptions.fromRequest(request, validateQueryRequest.indicesOptions()));
|
||||
validateQueryRequest.explain(request.paramAsBoolean("explain", false));
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.action.bulk.BulkItemResponse;
|
|||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.bulk.BulkShardRequest;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -56,8 +56,8 @@ public class RestBulkAction extends BaseRestHandler {
|
|||
private final boolean allowExplicitIndex;
|
||||
|
||||
@Inject
|
||||
public RestBulkAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public RestBulkAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
|
||||
controller.registerHandler(POST, "/_bulk", this);
|
||||
controller.registerHandler(PUT, "/_bulk", this);
|
||||
|
@ -70,7 +70,7 @@ public class RestBulkAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
|
||||
BulkRequest bulkRequest = Requests.bulkRequest();
|
||||
String defaultIndex = request.param("index");
|
||||
String defaultType = request.param("type");
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.elasticsearch.rest.action.cat;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.io.UTF8StreamWriter;
|
||||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
||||
|
@ -38,18 +38,18 @@ import static org.elasticsearch.rest.action.support.RestTable.pad;
|
|||
*/
|
||||
public abstract class AbstractCatAction extends BaseRestHandler {
|
||||
|
||||
public AbstractCatAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, client);
|
||||
public AbstractCatAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
protected abstract void doRequest(final RestRequest request, final RestChannel channel, final Client client);
|
||||
protected abstract void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client);
|
||||
|
||||
protected abstract void documentation(StringBuilder sb);
|
||||
|
||||
protected abstract Table getTableWithHeader(final RestRequest request);
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) throws Exception {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception {
|
||||
boolean helpWanted = request.paramAsBoolean("help", false);
|
||||
if (helpWanted) {
|
||||
Table table = getTableWithHeader(request);
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
|
|||
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
|
@ -44,15 +44,15 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestAliasAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestAliasAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestAliasAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/aliases", this);
|
||||
controller.registerHandler(GET, "/_cat/aliases/{alias}", this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
protected void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final GetAliasesRequest getAliasesRequest = request.hasParam("alias") ?
|
||||
new GetAliasesRequest(request.param("alias")) :
|
||||
new GetAliasesRequest();
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
|||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -48,8 +48,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestAllocationAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestAllocationAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestAllocationAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/allocation", this);
|
||||
controller.registerHandler(GET, "/_cat/allocation/{nodes}", this);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class RestAllocationAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] nodes = Strings.splitStringByCommaToArray(request.param("nodes", "data:true"));
|
||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||
clusterStateRequest.clear().routingTable(true);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
package org.elasticsearch.rest.action.cat;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
|
@ -40,8 +40,8 @@ public class RestCatAction extends BaseRestHandler {
|
|||
private final String HELP;
|
||||
|
||||
@Inject
|
||||
public RestCatAction(Settings settings, RestController controller, Set<AbstractCatAction> catActions, Client client) {
|
||||
super(settings, client);
|
||||
public RestCatAction(Settings settings, RestController controller, Set<AbstractCatAction> catActions) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, "/_cat", this);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(CAT_NL);
|
||||
|
@ -52,7 +52,7 @@ public class RestCatAction extends BaseRestHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
channel.sendResponse(new BytesRestResponse(RestStatus.OK, HELP));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
|
|||
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
|
@ -45,8 +45,8 @@ public class RestCountAction extends AbstractCatAction {
|
|||
private final IndicesQueriesRegistry indicesQueriesRegistry;
|
||||
|
||||
@Inject
|
||||
public RestCountAction(Settings settings, RestController restController, RestController controller, Client client, IndicesQueriesRegistry indicesQueriesRegistry) {
|
||||
super(settings, controller, client);
|
||||
public RestCountAction(Settings settings, RestController restController, RestController controller, IndicesQueriesRegistry indicesQueriesRegistry) {
|
||||
super(settings, controller);
|
||||
restController.registerHandler(GET, "/_cat/count", this);
|
||||
restController.registerHandler(GET, "/_cat/count/{index}", this);
|
||||
this.indicesQueriesRegistry = indicesQueriesRegistry;
|
||||
|
@ -59,7 +59,7 @@ public class RestCountAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
SearchRequest countRequest = new SearchRequest(indices);
|
||||
String source = request.param("source");
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectLongCursor;
|
|||
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -43,14 +43,14 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestFielddataAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestFielddataAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestFielddataAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/fielddata", this);
|
||||
controller.registerHandler(GET, "/_cat/fielddata/{fields}", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
protected void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final NodesStatsRequest nodesStatsRequest = new NodesStatsRequest("data:true");
|
||||
nodesStatsRequest.clear();
|
||||
nodesStatsRequest.indices(true);
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestHealthAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestHealthAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestHealthAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/health", this);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class RestHealthAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
ClusterHealthRequest clusterHealthRequest = new ClusterHealthRequest();
|
||||
|
||||
client.admin().cluster().health(clusterHealthRequest, new RestResponseListener<ClusterHealthResponse>(channel) {
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.action.admin.indices.stats.IndexStats;
|
|||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.health.ClusterIndexHealth;
|
||||
|
@ -57,8 +57,8 @@ public class RestIndicesAction extends AbstractCatAction {
|
|||
private final IndexNameExpressionResolver indexNameExpressionResolver;
|
||||
|
||||
@Inject
|
||||
public RestIndicesAction(Settings settings, RestController controller, Client client, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(settings, controller, client);
|
||||
public RestIndicesAction(Settings settings, RestController controller, IndexNameExpressionResolver indexNameExpressionResolver) {
|
||||
super(settings, controller);
|
||||
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
||||
controller.registerHandler(GET, "/_cat/indices", this);
|
||||
controller.registerHandler(GET, "/_cat/indices/{index}", this);
|
||||
|
@ -71,7 +71,7 @@ public class RestIndicesAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
|
||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||
clusterStateRequest.clear().indices(indices).metaData(true);
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Table;
|
||||
|
@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestMasterAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestMasterAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestMasterAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/master", this);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class RestMasterAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||
clusterStateRequest.clear().nodes(true);
|
||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
|
|||
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -47,8 +47,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestNodeAttrsAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestNodeAttrsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestNodeAttrsAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/nodeattrs", this);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class RestNodeAttrsAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||
clusterStateRequest.clear().nodes(true);
|
||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
|
|||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -72,8 +72,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestNodesAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestNodesAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestNodesAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/nodes", this);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class RestNodesAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||
clusterStateRequest.clear().nodes(true);
|
||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.cat;
|
|||
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.service.PendingClusterTask;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
|
||||
public class RestPendingClusterTasksAction extends AbstractCatAction {
|
||||
@Inject
|
||||
public RestPendingClusterTasksAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestPendingClusterTasksAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/pending_tasks", this);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class RestPendingClusterTasksAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
|
||||
pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
|
||||
pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
|
|||
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.Table;
|
||||
|
@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestPluginsAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestPluginsAction(Settings settings, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestPluginsAction(Settings settings, RestController controller) {
|
||||
super(settings, controller);
|
||||
controller.registerHandler(GET, "/_cat/plugins", this);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class RestPluginsAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final ClusterStateRequest clusterStateRequest = new ClusterStateRequest();
|
||||
clusterStateRequest.clear().nodes(true);
|
||||
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.util.CollectionUtil;
|
|||
import org.elasticsearch.action.admin.indices.recovery.RecoveryRequest;
|
||||
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.Table;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
|
@ -51,8 +51,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
|||
public class RestRecoveryAction extends AbstractCatAction {
|
||||
|
||||
@Inject
|
||||
public RestRecoveryAction(Settings settings, RestController restController, RestController controller, Client client) {
|
||||
super(settings, controller, client);
|
||||
public RestRecoveryAction(Settings settings, RestController restController, RestController controller) {
|
||||
super(settings, controller);
|
||||
restController.registerHandler(GET, "/_cat/recovery", this);
|
||||
restController.registerHandler(GET, "/_cat/recovery/{index}", this);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class RestRecoveryAction extends AbstractCatAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
|
||||
public void doRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {
|
||||
final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
|
||||
recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
|
||||
recoveryRequest.activeOnly(request.paramAsBoolean("active_only", false));
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue