Centralize admin implementations and action execution

This change removes the multiple implementations of different admin interfaces and centralizes it with AbstractClient. It also makes sure *all* executions of actions now go through a single AbstractClient#execute method, taking care of copying headers and wrapping listener.
This also has the side benefit of removing all the code around differnet possible clients, and removes quite a bit of code (most of the + code is actually removal of generics and such).

This change also changes how TransportClient is constructed, requiring a Builder to create it, its a breaking change and its noted in the migration guide.

Yea another step towards simplifying the action infra and making it simpler...
This commit is contained in:
Shay Banon 2015-05-04 16:23:08 +02:00
parent bd453db411
commit 187d79b6df
208 changed files with 2341 additions and 4216 deletions

View File

@ -134,7 +134,7 @@ be "two hop" operations).
--------------------------------------------------
// on startup
Client client = new TransportClient()
Client client = TransportClient.builder().build()
.addTransportAddress(new InetSocketTransportAddress("host1", 9300))
.addTransportAddress(new InetSocketTransportAddress("host2", 9300));
@ -150,7 +150,7 @@ Note that you have to set the cluster name if you use one different than
--------------------------------------------------
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "myClusterName").build();
Client client = new TransportClient(settings);
Client client = TransportClient.builder().settings(settings).build();
//Add transport addresses and do something with the client...
--------------------------------------------------
@ -166,7 +166,7 @@ used will be the ones that the other nodes were started with (the
--------------------------------------------------
Settings settings = ImmutableSettings.settingsBuilder()
.put("client.transport.sniff", true).build();
TransportClient client = new TransportClient(settings);
TransportClient client = TransportClient.builder().settings(settings).build();
--------------------------------------------------
Other transport client level settings include:

View File

@ -463,3 +463,23 @@ The `index.store.distributor` setting has also been removed.
The parameter `indices.analysis.hunspell.dictionary.location` has been removed,
and `<path.conf>/hunspell` is always used.
=== Java API Transport API construction
The `TransportClient` construction code has changed, it now uses the builder
pattern. Instead of using:
[source,java]
--------------------------------------------------
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "myClusterName").build();
Client client = new TransportClient(settings);
Use:
[source,java]
--------------------------------------------------
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "myClusterName").build();
Client client = TransportClient.builder().settings(settings).build();
--------------------------------------------------

View File

@ -24,7 +24,7 @@ import org.elasticsearch.client.ElasticsearchClient;
/**
* Base action. Supports building the <code>Request</code> through a <code>RequestBuilder</code>.
*/
public abstract class Action<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>, Client extends ElasticsearchClient>
public abstract class Action<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>>
extends GenericAction<Request, Response> {
protected Action(String name) {
@ -34,5 +34,5 @@ public abstract class Action<Request extends ActionRequest, Response extends Act
/**
* Creates a new request builder given the client provided as argument
*/
public abstract RequestBuilder newRequestBuilder(Client client);
public abstract RequestBuilder newRequestBuilder(ElasticsearchClient client);
}

View File

@ -19,6 +19,7 @@
package org.elasticsearch.action;
import com.google.common.base.Preconditions;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.Client;
@ -26,18 +27,22 @@ import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.search.aggregations.reducers.ReducerBuilder;
import org.elasticsearch.threadpool.ThreadPool;
/**
*
*/
public abstract class ActionRequestBuilder<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder, Client extends ElasticsearchClient> {
public abstract class ActionRequestBuilder<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> {
protected final Action<Request, Response, RequestBuilder> action;
protected final Request request;
private final ThreadPool threadPool;
protected final Client client;
protected final ElasticsearchClient client;
protected ActionRequestBuilder(Client client, Request request) {
protected ActionRequestBuilder(ElasticsearchClient client, Action<Request, Response, RequestBuilder> action, Request request) {
Preconditions.checkNotNull(action, "action must not be null");
this.action = action;
this.request = request;
this.client = client;
threadPool = client.threadPool();
@ -81,9 +86,14 @@ public abstract class ActionRequestBuilder<Request extends ActionRequest, Respon
return execute().actionGet(timeout);
}
public void execute(ActionListener<Response> listener) {
doExecute(listener);
public final void execute(ActionListener<Response> listener) {
client.execute(action, beforeExecute(request), listener);
}
protected abstract void doExecute(ActionListener<Response> listener);
/**
* A callback to additionally process the request before its executed
*/
protected Request beforeExecute(Request request) {
return request;
}
}

View File

@ -1,33 +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.action;
import org.elasticsearch.client.Client;
/**
* Action (used with {@link Client} API).
*/
public abstract class ClientAction<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>>
extends Action<Request, Response, RequestBuilder, Client> {
protected ClientAction(String name) {
super(name);
}
}

View File

@ -1,37 +0,0 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.action.admin.cluster;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.client.ClusterAdminClient;
/**
* Cluster action (used with {@link ClusterAdminClient} API).
*/
public abstract class ClusterAction<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, ClusterAdminClient>>
extends Action<Request, Response, RequestBuilder, ClusterAdminClient> {
protected ClusterAction(String name) {
super(name);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.health;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ClusterHealthAction extends ClusterAction<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder> {
public class ClusterHealthAction extends Action<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder> {
public static final ClusterHealthAction INSTANCE = new ClusterHealthAction();
public static final String NAME = "cluster:monitor/health";
@ -39,7 +39,7 @@ public class ClusterHealthAction extends ClusterAction<ClusterHealthRequest, Clu
}
@Override
public ClusterHealthRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new ClusterHealthRequestBuilder(client);
public ClusterHealthRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterHealthRequestBuilder(client, this);
}
}

View File

@ -19,19 +19,18 @@
package org.elasticsearch.action.admin.cluster.health;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.Priority;
import org.elasticsearch.common.unit.TimeValue;
/**
*
*/
public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder, ClusterAdminClient> {
public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder> {
public ClusterHealthRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ClusterHealthRequest());
public ClusterHealthRequestBuilder(ElasticsearchClient client, ClusterHealthAction action) {
super(client, action, new ClusterHealthRequest());
}
public ClusterHealthRequestBuilder setIndices(String... indices) {
@ -86,9 +85,4 @@ public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestB
request.waitForEvents(waitForEvents);
return this;
}
@Override
protected void doExecute(ActionListener<ClusterHealthResponse> listener) {
client.health(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.node.hotthreads;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class NodesHotThreadsAction extends ClusterAction<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> {
public class NodesHotThreadsAction extends Action<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> {
public static final NodesHotThreadsAction INSTANCE = new NodesHotThreadsAction();
public static final String NAME = "cluster:monitor/nodes/hot_threads";
@ -39,7 +39,7 @@ public class NodesHotThreadsAction extends ClusterAction<NodesHotThreadsRequest,
}
@Override
public NodesHotThreadsRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new NodesHotThreadsRequestBuilder(client);
public NodesHotThreadsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new NodesHotThreadsRequestBuilder(client, this);
}
}

View File

@ -22,14 +22,15 @@ package org.elasticsearch.action.admin.cluster.node.hotthreads;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.unit.TimeValue;
/**
*/
public class NodesHotThreadsRequestBuilder extends NodesOperationRequestBuilder<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> {
public NodesHotThreadsRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new NodesHotThreadsRequest());
public NodesHotThreadsRequestBuilder(ElasticsearchClient client, NodesHotThreadsAction action) {
super(client, action, new NodesHotThreadsRequest());
}
public NodesHotThreadsRequestBuilder setThreads(int threads) {
@ -51,9 +52,4 @@ public class NodesHotThreadsRequestBuilder extends NodesOperationRequestBuilder<
request.interval(interval);
return this;
}
@Override
protected void doExecute(ActionListener<NodesHotThreadsResponse> listener) {
client.nodesHotThreads(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.node.info;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class NodesInfoAction extends ClusterAction<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> {
public class NodesInfoAction extends Action<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> {
public static final NodesInfoAction INSTANCE = new NodesInfoAction();
public static final String NAME = "cluster:monitor/nodes/info";
@ -39,7 +39,7 @@ public class NodesInfoAction extends ClusterAction<NodesInfoRequest, NodesInfoRe
}
@Override
public NodesInfoRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new NodesInfoRequestBuilder(client);
public NodesInfoRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new NodesInfoRequestBuilder(client, this);
}
}

View File

@ -19,17 +19,16 @@
package org.elasticsearch.action.admin.cluster.node.info;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> {
public NodesInfoRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new NodesInfoRequest());
public NodesInfoRequestBuilder(ElasticsearchClient client, NodesInfoAction action) {
super(client, action, new NodesInfoRequest());
}
/**
@ -119,9 +118,4 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
request().plugins(plugins);
return this;
}
@Override
protected void doExecute(ActionListener<NodesInfoResponse> listener) {
client.nodesInfo(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.node.stats;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class NodesStatsAction extends ClusterAction<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> {
public class NodesStatsAction extends Action<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> {
public static final NodesStatsAction INSTANCE = new NodesStatsAction();
public static final String NAME = "cluster:monitor/nodes/stats";
@ -39,7 +39,7 @@ public class NodesStatsAction extends ClusterAction<NodesStatsRequest, NodesStat
}
@Override
public NodesStatsRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new NodesStatsRequestBuilder(client);
public NodesStatsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new NodesStatsRequestBuilder(client, this);
}
}

View File

@ -22,15 +22,15 @@ package org.elasticsearch.action.admin.cluster.node.stats;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> {
public NodesStatsRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new NodesStatsRequest());
public NodesStatsRequestBuilder(ElasticsearchClient client, NodesStatsAction action) {
super(client, action, new NodesStatsRequest());
}
/**
@ -133,9 +133,4 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
request.http(http);
return this;
}
@Override
protected void doExecute(ActionListener<NodesStatsResponse> listener) {
client.nodesStats(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.repositories.delete;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Unregister repository action
*/
public class DeleteRepositoryAction extends ClusterAction<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder> {
public class DeleteRepositoryAction extends Action<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder> {
public static final DeleteRepositoryAction INSTANCE = new DeleteRepositoryAction();
public static final String NAME = "cluster:admin/repository/delete";
@ -40,8 +40,8 @@ public class DeleteRepositoryAction extends ClusterAction<DeleteRepositoryReques
}
@Override
public DeleteRepositoryRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new DeleteRepositoryRequestBuilder(client);
public DeleteRepositoryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new DeleteRepositoryRequestBuilder(client, this);
}
}

View File

@ -19,31 +19,26 @@
package org.elasticsearch.action.admin.cluster.repositories.delete;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Builder for unregister repository request
*/
public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder, ClusterAdminClient> {
public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder> {
/**
* Constructs unregister repository request builder
*
* @param clusterAdminClient cluster admin client
*/
public DeleteRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new DeleteRepositoryRequest());
public DeleteRepositoryRequestBuilder(ElasticsearchClient client, DeleteRepositoryAction action) {
super(client, action, new DeleteRepositoryRequest());
}
/**
* Constructs unregister repository request builder with specified repository name
*
* @param clusterAdminClient cluster adming client
*/
public DeleteRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient, String name) {
super(clusterAdminClient, new DeleteRepositoryRequest(name));
public DeleteRepositoryRequestBuilder(ElasticsearchClient client, DeleteRepositoryAction action, String name) {
super(client, action, new DeleteRepositoryRequest(name));
}
/**
@ -55,9 +50,4 @@ public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<D
request.name(name);
return this;
}
@Override
protected void doExecute(ActionListener<DeleteRepositoryResponse> listener) {
client.deleteRepository(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.repositories.get;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Get repositories action
*/
public class GetRepositoriesAction extends ClusterAction<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder> {
public class GetRepositoriesAction extends Action<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder> {
public static final GetRepositoriesAction INSTANCE = new GetRepositoriesAction();
public static final String NAME = "cluster:admin/repository/get";
@ -40,8 +40,8 @@ public class GetRepositoriesAction extends ClusterAction<GetRepositoriesRequest,
}
@Override
public GetRepositoriesRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new GetRepositoriesRequestBuilder(client);
public GetRepositoriesRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetRepositoriesRequestBuilder(client, this);
}
}

View File

@ -20,32 +20,26 @@
package org.elasticsearch.action.admin.cluster.repositories.get;
import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Get repository request builder
*/
public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder, ClusterAdminClient> {
public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder> {
/**
* Creates new get repository request builder
*
* @param clusterAdminClient cluster admin client
*/
public GetRepositoriesRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new GetRepositoriesRequest());
public GetRepositoriesRequestBuilder(ElasticsearchClient client, GetRepositoriesAction action) {
super(client, action, new GetRepositoriesRequest());
}
/**
* Creates new get repository request builder
*
* @param clusterAdminClient cluster admin client
* @param repositories list of repositories to get
*/
public GetRepositoriesRequestBuilder(ClusterAdminClient clusterAdminClient, String... repositories) {
super(clusterAdminClient, new GetRepositoriesRequest(repositories));
public GetRepositoriesRequestBuilder(ElasticsearchClient client, GetRepositoriesAction action, String... repositories) {
super(client, action, new GetRepositoriesRequest(repositories));
}
/**
@ -69,9 +63,4 @@ public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationReques
request.repositories(ObjectArrays.concat(request.repositories(), repositories, String.class));
return this;
}
@Override
protected void doExecute(ActionListener<GetRepositoriesResponse> listener) {
client.getRepositories(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.repositories.put;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Register repository action
*/
public class PutRepositoryAction extends ClusterAction<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder> {
public class PutRepositoryAction extends Action<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder> {
public static final PutRepositoryAction INSTANCE = new PutRepositoryAction();
public static final String NAME = "cluster:admin/repository/put";
@ -40,8 +40,8 @@ public class PutRepositoryAction extends ClusterAction<PutRepositoryRequest, Put
}
@Override
public PutRepositoryRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new PutRepositoryRequestBuilder(client);
public PutRepositoryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new PutRepositoryRequestBuilder(client, this);
}
}

View File

@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.cluster.repositories.put;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -29,25 +29,20 @@ import java.util.Map;
/**
* Register repository request builder
*/
public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder, ClusterAdminClient> {
public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder> {
/**
* Constructs register repository request
*
* @param clusterAdminClient cluster admin client
*/
public PutRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new PutRepositoryRequest());
public PutRepositoryRequestBuilder(ElasticsearchClient client, PutRepositoryAction action) {
super(client, action, new PutRepositoryRequest());
}
/**
* Constructs register repository request for the repository with a given name
*
* @param clusterAdminClient cluster admin client
* @param name repository name
*/
public PutRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient, String name) {
super(clusterAdminClient, new PutRepositoryRequest(name));
public PutRepositoryRequestBuilder(ElasticsearchClient client, PutRepositoryAction action, String name) {
super(client, action, new PutRepositoryRequest(name));
}
/**
@ -126,9 +121,4 @@ public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutR
request.verify(verify);
return this;
}
@Override
protected void doExecute(ActionListener<PutRepositoryResponse> listener) {
client.putRepository(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.repositories.verify;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Unregister repository action
*/
public class VerifyRepositoryAction extends ClusterAction<VerifyRepositoryRequest, VerifyRepositoryResponse, VerifyRepositoryRequestBuilder> {
public class VerifyRepositoryAction extends Action<VerifyRepositoryRequest, VerifyRepositoryResponse, VerifyRepositoryRequestBuilder> {
public static final VerifyRepositoryAction INSTANCE = new VerifyRepositoryAction();
public static final String NAME = "cluster:admin/repository/verify";
@ -40,8 +40,8 @@ public class VerifyRepositoryAction extends ClusterAction<VerifyRepositoryReques
}
@Override
public VerifyRepositoryRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new VerifyRepositoryRequestBuilder(client);
public VerifyRepositoryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new VerifyRepositoryRequestBuilder(client, this);
}
}

View File

@ -19,32 +19,26 @@
package org.elasticsearch.action.admin.cluster.repositories.verify;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Builder for unregister repository request
*/
public class VerifyRepositoryRequestBuilder extends MasterNodeOperationRequestBuilder<VerifyRepositoryRequest, VerifyRepositoryResponse, VerifyRepositoryRequestBuilder, ClusterAdminClient> {
public class VerifyRepositoryRequestBuilder extends MasterNodeOperationRequestBuilder<VerifyRepositoryRequest, VerifyRepositoryResponse, VerifyRepositoryRequestBuilder> {
/**
* Constructs unregister repository request builder
*
* @param clusterAdminClient cluster admin client
*/
public VerifyRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new VerifyRepositoryRequest());
public VerifyRepositoryRequestBuilder(ElasticsearchClient client, VerifyRepositoryAction action) {
super(client, action, new VerifyRepositoryRequest());
}
/**
* Constructs unregister repository request builder with specified repository name
*
* @param clusterAdminClient cluster adming client
*/
public VerifyRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient, String name) {
super(clusterAdminClient, new VerifyRepositoryRequest(name));
public VerifyRepositoryRequestBuilder(ElasticsearchClient client, VerifyRepositoryAction action, String name) {
super(client, action, new VerifyRepositoryRequest(name));
}
/**
@ -56,9 +50,4 @@ public class VerifyRepositoryRequestBuilder extends MasterNodeOperationRequestBu
request.name(name);
return this;
}
@Override
protected void doExecute(ActionListener<VerifyRepositoryResponse> listener) {
client.verifyRepository(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.reroute;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ClusterRerouteAction extends ClusterAction<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder> {
public class ClusterRerouteAction extends Action<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder> {
public static final ClusterRerouteAction INSTANCE = new ClusterRerouteAction();
public static final String NAME = "cluster:admin/reroute";
@ -39,7 +39,7 @@ public class ClusterRerouteAction extends ClusterAction<ClusterRerouteRequest, C
}
@Override
public ClusterRerouteRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new ClusterRerouteRequestBuilder(client);
public ClusterRerouteRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterRerouteRequestBuilder(client, this);
}
}

View File

@ -19,19 +19,18 @@
package org.elasticsearch.action.admin.cluster.reroute;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.cluster.routing.allocation.command.AllocationCommand;
import org.elasticsearch.common.bytes.BytesReference;
/**
* Builder for a cluster reroute request
*/
public class ClusterRerouteRequestBuilder extends AcknowledgedRequestBuilder<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder, ClusterAdminClient> {
public class ClusterRerouteRequestBuilder extends AcknowledgedRequestBuilder<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder> {
public ClusterRerouteRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ClusterRerouteRequest());
public ClusterRerouteRequestBuilder(ElasticsearchClient client, ClusterRerouteAction action) {
super(client, action, new ClusterRerouteRequest());
}
/**
@ -68,9 +67,4 @@ public class ClusterRerouteRequestBuilder extends AcknowledgedRequestBuilder<Clu
request.source(source);
return this;
}
@Override
protected void doExecute(ActionListener<ClusterRerouteResponse> listener) {
client.reroute(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ClusterUpdateSettingsAction extends ClusterAction<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder> {
public class ClusterUpdateSettingsAction extends Action<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder> {
public static final ClusterUpdateSettingsAction INSTANCE = new ClusterUpdateSettingsAction();
public static final String NAME = "cluster:admin/settings/update";
@ -39,7 +39,7 @@ public class ClusterUpdateSettingsAction extends ClusterAction<ClusterUpdateSett
}
@Override
public ClusterUpdateSettingsRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new ClusterUpdateSettingsRequestBuilder(client);
public ClusterUpdateSettingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterUpdateSettingsRequestBuilder(client, this);
}
}

View File

@ -19,9 +19,8 @@
package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -29,10 +28,10 @@ import java.util.Map;
/**
* Builder for a cluster update settings request
*/
public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder, ClusterAdminClient> {
public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder> {
public ClusterUpdateSettingsRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ClusterUpdateSettingsRequest());
public ClusterUpdateSettingsRequestBuilder(ElasticsearchClient client, ClusterUpdateSettingsAction action) {
super(client, action, new ClusterUpdateSettingsRequest());
}
/**
@ -98,9 +97,4 @@ public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuil
request.persistentSettings(settings);
return this;
}
@Override
protected void doExecute(ActionListener<ClusterUpdateSettingsResponse> listener) {
client.updateSettings(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.shards;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ClusterSearchShardsAction extends ClusterAction<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder> {
public class ClusterSearchShardsAction extends Action<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder> {
public static final ClusterSearchShardsAction INSTANCE = new ClusterSearchShardsAction();
public static final String NAME = "indices:admin/shards/search_shards";
@ -39,7 +39,7 @@ public class ClusterSearchShardsAction extends ClusterAction<ClusterSearchShards
}
@Override
public ClusterSearchShardsRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new ClusterSearchShardsRequestBuilder(client);
public ClusterSearchShardsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterSearchShardsRequestBuilder(client, this);
}
}

View File

@ -19,17 +19,16 @@
package org.elasticsearch.action.admin.cluster.shards;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder, ClusterAdminClient> {
public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder> {
public ClusterSearchShardsRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ClusterSearchShardsRequest());
public ClusterSearchShardsRequestBuilder(ElasticsearchClient client, ClusterSearchShardsAction action) {
super(client, action, new ClusterSearchShardsRequest());
}
/**
@ -83,10 +82,4 @@ public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRe
request().indicesOptions(indicesOptions);
return this;
}
@Override
protected void doExecute(ActionListener<ClusterSearchShardsResponse> listener) {
client.searchShards(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.create;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Create snapshot action
*/
public class CreateSnapshotAction extends ClusterAction<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder> {
public class CreateSnapshotAction extends Action<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder> {
public static final CreateSnapshotAction INSTANCE = new CreateSnapshotAction();
public static final String NAME = "cluster:admin/snapshot/create";
@ -40,8 +40,8 @@ public class CreateSnapshotAction extends ClusterAction<CreateSnapshotRequest, C
}
@Override
public CreateSnapshotRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new CreateSnapshotRequestBuilder(client);
public CreateSnapshotRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new CreateSnapshotRequestBuilder(client, this);
}
}

View File

@ -22,7 +22,7 @@ package org.elasticsearch.action.admin.cluster.snapshots.create;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -30,26 +30,20 @@ import java.util.Map;
/**
* Create snapshot request builder
*/
public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder, ClusterAdminClient> {
public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder> {
/**
* Constructs a new create snapshot request builder
*
* @param clusterAdminClient cluster admin client
*/
public CreateSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new CreateSnapshotRequest());
public CreateSnapshotRequestBuilder(ElasticsearchClient client, CreateSnapshotAction action) {
super(client, action, new CreateSnapshotRequest());
}
/**
* Constructs a new create snapshot request builder with specified repository and snapshot names
*
* @param clusterAdminClient cluster admin client
* @param repository repository name
* @param snapshot snapshot name
*/
public CreateSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String snapshot) {
super(clusterAdminClient, new CreateSnapshotRequest(repository, snapshot));
public CreateSnapshotRequestBuilder(ElasticsearchClient client, CreateSnapshotAction action, String repository, String snapshot) {
super(client, action, new CreateSnapshotRequest(repository, snapshot));
}
/**
@ -184,9 +178,4 @@ public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
request.includeGlobalState(includeGlobalState);
return this;
}
@Override
protected void doExecute(ActionListener<CreateSnapshotResponse> listener) {
client.createSnapshot(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.delete;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Delete snapshot action
*/
public class DeleteSnapshotAction extends ClusterAction<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder> {
public class DeleteSnapshotAction extends Action<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder> {
public static final DeleteSnapshotAction INSTANCE = new DeleteSnapshotAction();
public static final String NAME = "cluster:admin/snapshot/delete";
@ -40,8 +40,8 @@ public class DeleteSnapshotAction extends ClusterAction<DeleteSnapshotRequest, D
}
@Override
public DeleteSnapshotRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new DeleteSnapshotRequestBuilder(client);
public DeleteSnapshotRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new DeleteSnapshotRequestBuilder(client, this);
}
}

View File

@ -21,31 +21,25 @@ package org.elasticsearch.action.admin.cluster.snapshots.delete;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Delete snapshot request builder
*/
public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder, ClusterAdminClient> {
public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder> {
/**
* Constructs delete snapshot request builder
*
* @param clusterAdminClient cluster admin client
*/
public DeleteSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new DeleteSnapshotRequest());
public DeleteSnapshotRequestBuilder(ElasticsearchClient client, DeleteSnapshotAction action) {
super(client, action, new DeleteSnapshotRequest());
}
/**
* Constructs delete snapshot request builder with specified repository and snapshot names
*
* @param clusterAdminClient cluster admin client
* @param repository repository name
* @param snapshot snapshot name
*/
public DeleteSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String snapshot) {
super(clusterAdminClient, new DeleteSnapshotRequest(repository, snapshot));
public DeleteSnapshotRequestBuilder(ElasticsearchClient client, DeleteSnapshotAction action, String repository, String snapshot) {
super(client, action, new DeleteSnapshotRequest(repository, snapshot));
}
/**
@ -69,9 +63,4 @@ public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
request.snapshot(snapshot);
return this;
}
@Override
protected void doExecute(ActionListener<DeleteSnapshotResponse> listener) {
client.deleteSnapshot(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.get;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Get snapshots action
*/
public class GetSnapshotsAction extends ClusterAction<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder> {
public class GetSnapshotsAction extends Action<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder> {
public static final GetSnapshotsAction INSTANCE = new GetSnapshotsAction();
public static final String NAME = "cluster:admin/snapshot/get";
@ -40,8 +40,8 @@ public class GetSnapshotsAction extends ClusterAction<GetSnapshotsRequest, GetSn
}
@Override
public GetSnapshotsRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new GetSnapshotsRequestBuilder(client);
public GetSnapshotsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetSnapshotsRequestBuilder(client, this);
}
}

View File

@ -20,32 +20,26 @@
package org.elasticsearch.action.admin.cluster.snapshots.get;
import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Get snapshots request builder
*/
public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilder<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder, ClusterAdminClient> {
public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilder<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder> {
/**
* Constructs the new get snapshot request
*
* @param clusterAdminClient cluster admin client
*/
public GetSnapshotsRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new GetSnapshotsRequest());
public GetSnapshotsRequestBuilder(ElasticsearchClient client, GetSnapshotsAction action) {
super(client, action, new GetSnapshotsRequest());
}
/**
* Constructs the new get snapshot request with specified repository
*
* @param clusterAdminClient cluster admin client
* @param repository repository name
*/
public GetSnapshotsRequestBuilder(ClusterAdminClient clusterAdminClient, String repository) {
super(clusterAdminClient, new GetSnapshotsRequest(repository));
public GetSnapshotsRequestBuilder(ElasticsearchClient client, GetSnapshotsAction action, String repository) {
super(client, action, new GetSnapshotsRequest(repository));
}
/**
@ -76,7 +70,7 @@ public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilde
* @return this builder
*/
public GetSnapshotsRequestBuilder setCurrentSnapshot() {
request.snapshots(new String[] {GetSnapshotsRequest.CURRENT_SNAPSHOT});
request.snapshots(new String[]{GetSnapshotsRequest.CURRENT_SNAPSHOT});
return this;
}
@ -90,9 +84,4 @@ public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilde
request.snapshots(ObjectArrays.concat(request.snapshots(), snapshots, String.class));
return this;
}
@Override
protected void doExecute(ActionListener<GetSnapshotsResponse> listener) {
client.getSnapshots(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.restore;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Restore snapshot action
*/
public class RestoreSnapshotAction extends ClusterAction<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder> {
public class RestoreSnapshotAction extends Action<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder> {
public static final RestoreSnapshotAction INSTANCE = new RestoreSnapshotAction();
public static final String NAME = "cluster:admin/snapshot/restore";
@ -40,8 +40,8 @@ public class RestoreSnapshotAction extends ClusterAction<RestoreSnapshotRequest,
}
@Override
public RestoreSnapshotRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new RestoreSnapshotRequestBuilder(client);
public RestoreSnapshotRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RestoreSnapshotRequestBuilder(client, this);
}
}

View File

@ -19,10 +19,9 @@
package org.elasticsearch.action.admin.cluster.snapshots.restore;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
import java.util.List;
@ -31,26 +30,20 @@ import java.util.Map;
/**
* Restore snapshot request builder
*/
public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder, ClusterAdminClient> {
public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder> {
/**
* Constructs new restore snapshot request builder
*
* @param clusterAdminClient cluster admin client
*/
public RestoreSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new RestoreSnapshotRequest());
public RestoreSnapshotRequestBuilder(ElasticsearchClient client, RestoreSnapshotAction action) {
super(client, action, new RestoreSnapshotRequest());
}
/**
* Constructs new restore snapshot request builder with specified repository and snapshot names
*
* @param clusterAdminClient cluster admin client
* @param repository reposiory name
* @param name snapshot name
*/
public RestoreSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String name) {
super(clusterAdminClient, new RestoreSnapshotRequest(repository, name));
public RestoreSnapshotRequestBuilder(ElasticsearchClient client, RestoreSnapshotAction action, String repository, String name) {
super(client, action, new RestoreSnapshotRequest(repository, name));
}
@ -233,6 +226,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
/**
* Sets index settings that should be added or replaced during restore
*
* @param settings index settings
* @return this builder
*/
@ -243,7 +237,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
/**
* Sets index settings that should be added or replaced during restore
*
* @param settings index settings
* @return this builder
*/
@ -254,7 +248,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
/**
* Sets index settings that should be added or replaced during restore
*
* @param source index settings
* @return this builder
*/
@ -265,7 +259,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
/**
* Sets index settings that should be added or replaced during restore
*
* @param source index settings
* @return this builder
*/
@ -290,10 +284,4 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
request.ignoreIndexSettings(ignoreIndexSettings);
return this;
}
@Override
protected void doExecute(ActionListener<RestoreSnapshotResponse> listener) {
client.restoreSnapshot(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.status;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Snapshots status action
*/
public class SnapshotsStatusAction extends ClusterAction<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder> {
public class SnapshotsStatusAction extends Action<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder> {
public static final SnapshotsStatusAction INSTANCE = new SnapshotsStatusAction();
public static final String NAME = "cluster:admin/snapshot/status";
@ -40,8 +40,8 @@ public class SnapshotsStatusAction extends ClusterAction<SnapshotsStatusRequest,
}
@Override
public SnapshotsStatusRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new SnapshotsStatusRequestBuilder(client);
public SnapshotsStatusRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new SnapshotsStatusRequestBuilder(client, this);
}
}

View File

@ -22,30 +22,25 @@ package org.elasticsearch.action.admin.cluster.snapshots.status;
import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Snapshots status request builder
*/
public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBuilder<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder, ClusterAdminClient> {
public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBuilder<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder> {
/**
* Constructs the new snapshotstatus request
*
* @param clusterAdminClient cluster admin client
*/
public SnapshotsStatusRequestBuilder(ClusterAdminClient clusterAdminClient) {
super(clusterAdminClient, new SnapshotsStatusRequest());
public SnapshotsStatusRequestBuilder(ElasticsearchClient client, SnapshotsStatusAction action) {
super(client, action, new SnapshotsStatusRequest());
}
/**
* Constructs the new snapshot status request with specified repository
*
* @param clusterAdminClient cluster admin client
* @param repository repository name
*/
public SnapshotsStatusRequestBuilder(ClusterAdminClient clusterAdminClient, String repository) {
super(clusterAdminClient, new SnapshotsStatusRequest(repository));
public SnapshotsStatusRequestBuilder(ElasticsearchClient client, SnapshotsStatusAction action, String repository) {
super(client, action, new SnapshotsStatusRequest(repository));
}
/**
@ -80,9 +75,4 @@ public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBui
request.snapshots(ObjectArrays.concat(request.snapshots(), snapshots, String.class));
return this;
}
@Override
protected void doExecute(ActionListener<SnapshotsStatusResponse> listener) {
client.snapshotsStatus(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.state;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ClusterStateAction extends ClusterAction<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder> {
public class ClusterStateAction extends Action<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder> {
public static final ClusterStateAction INSTANCE = new ClusterStateAction();
public static final String NAME = "cluster:monitor/state";
@ -39,7 +39,7 @@ public class ClusterStateAction extends ClusterAction<ClusterStateRequest, Clust
}
@Override
public ClusterStateRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new ClusterStateRequestBuilder(client);
public ClusterStateRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterStateRequestBuilder(client, this);
}
}

View File

@ -19,18 +19,17 @@
package org.elasticsearch.action.admin.cluster.state;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder, ClusterAdminClient> {
public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder> {
public ClusterStateRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ClusterStateRequest());
public ClusterStateRequestBuilder(ElasticsearchClient client, ClusterStateAction action) {
super(client, action, new ClusterStateRequest());
}
/**
@ -94,9 +93,4 @@ public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBu
request.indicesOptions(indicesOptions);
return this;
}
@Override
protected void doExecute(ActionListener<ClusterStateResponse> listener) {
client.state(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.stats;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ClusterStatsAction extends ClusterAction<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestBuilder> {
public class ClusterStatsAction extends Action<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestBuilder> {
public static final ClusterStatsAction INSTANCE = new ClusterStatsAction();
public static final String NAME = "cluster:monitor/stats";
@ -39,7 +39,7 @@ public class ClusterStatsAction extends ClusterAction<ClusterStatsRequest, Clust
}
@Override
public ClusterStatsRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new ClusterStatsRequestBuilder(client);
public ClusterStatsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterStatsRequestBuilder(client, this);
}
}

View File

@ -19,21 +19,15 @@
package org.elasticsearch.action.admin.cluster.stats;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class ClusterStatsRequestBuilder extends NodesOperationRequestBuilder<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestBuilder> {
public ClusterStatsRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ClusterStatsRequest());
}
@Override
protected void doExecute(ActionListener<ClusterStatsResponse> listener) {
client.clusterStats(request, listener);
public ClusterStatsRequestBuilder(ElasticsearchClient client, ClusterStatsAction action) {
super(client, action, new ClusterStatsRequest());
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.tasks;
import org.elasticsearch.action.admin.cluster.ClusterAction;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class PendingClusterTasksAction extends ClusterAction<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder> {
public class PendingClusterTasksAction extends Action<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder> {
public static final PendingClusterTasksAction INSTANCE = new PendingClusterTasksAction();
public static final String NAME = "cluster:monitor/task";
@ -39,7 +39,7 @@ public class PendingClusterTasksAction extends ClusterAction<PendingClusterTasks
}
@Override
public PendingClusterTasksRequestBuilder newRequestBuilder(ClusterAdminClient client) {
return new PendingClusterTasksRequestBuilder(client);
public PendingClusterTasksRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new PendingClusterTasksRequestBuilder(client, this);
}
}

View File

@ -19,20 +19,14 @@
package org.elasticsearch.action.admin.cluster.tasks;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class PendingClusterTasksRequestBuilder extends MasterNodeReadOperationRequestBuilder<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder, ClusterAdminClient> {
public class PendingClusterTasksRequestBuilder extends MasterNodeReadOperationRequestBuilder<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder> {
public PendingClusterTasksRequestBuilder(ClusterAdminClient client) {
super(client, new PendingClusterTasksRequest());
}
@Override
protected void doExecute(ActionListener<PendingClusterTasksResponse> listener) {
client.pendingClusterTasks(request, listener);
public PendingClusterTasksRequestBuilder(ElasticsearchClient client, PendingClusterTasksAction action) {
super(client, action, new PendingClusterTasksRequest());
}
}

View File

@ -1,34 +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.action.admin.indices;
import org.elasticsearch.action.*;
import org.elasticsearch.client.IndicesAdminClient;
/**
* Indices action (used with {@link IndicesAdminClient} API).
*/
public abstract class IndicesAction<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, IndicesAdminClient>>
extends Action<Request, Response, RequestBuilder, IndicesAdminClient> {
protected IndicesAction(String name) {
super(name);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.alias;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class IndicesAliasesAction extends IndicesAction<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder> {
public class IndicesAliasesAction extends Action<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder> {
public static final IndicesAliasesAction INSTANCE = new IndicesAliasesAction();
public static final String NAME = "indices:admin/aliases";
@ -39,7 +39,7 @@ public class IndicesAliasesAction extends IndicesAction<IndicesAliasesRequest, I
}
@Override
public IndicesAliasesRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new IndicesAliasesRequestBuilder(client);
public IndicesAliasesRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new IndicesAliasesRequestBuilder(client, this);
}
}

View File

@ -19,10 +19,9 @@
package org.elasticsearch.action.admin.indices.alias;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.cluster.metadata.AliasAction;
import org.elasticsearch.index.query.FilterBuilder;
@ -31,28 +30,28 @@ import java.util.Map;
/**
*
*/
public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder, IndicesAdminClient> {
public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder> {
public IndicesAliasesRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new IndicesAliasesRequest());
public IndicesAliasesRequestBuilder(ElasticsearchClient client, IndicesAliasesAction action) {
super(client, action, new IndicesAliasesRequest());
}
/**
* Adds an alias to the index.
*
* @param index The index
* @param alias The alias
* @param index The index
* @param alias The alias
*/
public IndicesAliasesRequestBuilder addAlias(String index, String alias) {
request.addAlias(alias, index);
return this;
}
/**
* Adds an alias to the index.
*
* @param indices The indices
* @param alias The alias
* @param alias The alias
*/
public IndicesAliasesRequestBuilder addAlias(String[] indices, String alias) {
request.addAlias(alias, indices);
@ -71,32 +70,32 @@ public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<Ind
request.addAliasAction(action);
return this;
}
/**
* Adds an alias to the index.
*
* @param indices The indices
* @param alias The alias
* @param filter The filter
* @param indices The indices
* @param alias The alias
* @param filter The filter
*/
public IndicesAliasesRequestBuilder addAlias(String indices[], String alias, String filter) {
AliasActions action = new AliasActions(AliasAction.Type.ADD, indices, alias).filter(filter);
request.addAliasAction(action);
return this;
}
/**
* Adds an alias to the index.
*
* @param indices The indices
* @param alias The alias
* @param filter The filter
* @param indices The indices
* @param alias The alias
* @param filter The filter
*/
public IndicesAliasesRequestBuilder addAlias(String[] indices, String alias, Map<String, Object> filter) {
request.addAlias(alias, filter, indices);
return this;
}
/**
* Adds an alias to the index.
*
@ -120,11 +119,11 @@ public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<Ind
request.addAlias(alias, filterBuilder, indices);
return this;
}
/**
* Adds an alias to the index.
*
* @param index The index
* @param index The index
* @param alias The alias
* @param filterBuilder The filter
*/
@ -143,7 +142,7 @@ public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<Ind
request.removeAlias(index, alias);
return this;
}
/**
* Removes aliases from the index.
*
@ -154,23 +153,18 @@ public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<Ind
request.removeAlias(indices, aliases);
return this;
}
/**
* Removes aliases from the index.
*
* @param index The index
* @param index The index
* @param aliases The aliases
*/
public IndicesAliasesRequestBuilder removeAlias(String index, String[] aliases) {
request.removeAlias(index, aliases);
return this;
}
@Override
protected void doExecute(ActionListener<IndicesAliasesResponse> listener) {
client.aliases(request, listener);
}
/**
* Adds an alias action to the request.
*

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.indices.alias.exists;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class AliasesExistAction extends IndicesAction<GetAliasesRequest, AliasesExistResponse, AliasesExistRequestBuilder> {
public class AliasesExistAction extends Action<GetAliasesRequest, AliasesExistResponse, AliasesExistRequestBuilder> {
public static final AliasesExistAction INSTANCE = new AliasesExistAction();
public static final String NAME = "indices:admin/aliases/exists";
@ -35,8 +35,8 @@ public class AliasesExistAction extends IndicesAction<GetAliasesRequest, Aliases
}
@Override
public AliasesExistRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new AliasesExistRequestBuilder(client);
public AliasesExistRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new AliasesExistRequestBuilder(client, this);
}
@Override

View File

@ -19,21 +19,14 @@
package org.elasticsearch.action.admin.indices.alias.exists;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.get.BaseAliasesRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class AliasesExistRequestBuilder extends BaseAliasesRequestBuilder<AliasesExistResponse, AliasesExistRequestBuilder> {
public AliasesExistRequestBuilder(IndicesAdminClient client, String... aliases) {
super(client, aliases);
public AliasesExistRequestBuilder(ElasticsearchClient client, AliasesExistAction action, String... aliases) {
super(client, action, aliases);
}
@Override
protected void doExecute(ActionListener<AliasesExistResponse> listener) {
client.aliasesExist(request, listener);
}
}

View File

@ -20,17 +20,19 @@
package org.elasticsearch.action.admin.indices.alias.get;
import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient;
/**
*/
public abstract class BaseAliasesRequestBuilder<Response extends ActionResponse, Builder extends BaseAliasesRequestBuilder<Response, Builder>> extends MasterNodeReadOperationRequestBuilder<GetAliasesRequest, Response, Builder, IndicesAdminClient> {
public abstract class BaseAliasesRequestBuilder<Response extends ActionResponse, Builder extends BaseAliasesRequestBuilder<Response, Builder>> extends MasterNodeReadOperationRequestBuilder<GetAliasesRequest, Response, Builder> {
public BaseAliasesRequestBuilder(IndicesAdminClient client, String... aliases) {
super(client, new GetAliasesRequest(aliases));
public BaseAliasesRequestBuilder(ElasticsearchClient client, Action<GetAliasesRequest, Response, Builder> action, String... aliases) {
super(client, action, new GetAliasesRequest(aliases));
}
@SuppressWarnings("unchecked")

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.alias.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class GetAliasesAction extends IndicesAction<GetAliasesRequest, GetAliasesResponse, GetAliasesRequestBuilder> {
public class GetAliasesAction extends Action<GetAliasesRequest, GetAliasesResponse, GetAliasesRequestBuilder> {
public static final GetAliasesAction INSTANCE = new GetAliasesAction();
public static final String NAME = "indices:admin/aliases/get";
@ -34,8 +34,8 @@ public class GetAliasesAction extends IndicesAction<GetAliasesRequest, GetAliase
}
@Override
public GetAliasesRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetAliasesRequestBuilder(client);
public GetAliasesRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetAliasesRequestBuilder(client, this);
}
@Override

View File

@ -19,20 +19,13 @@
package org.elasticsearch.action.admin.indices.alias.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class GetAliasesRequestBuilder extends BaseAliasesRequestBuilder<GetAliasesResponse, GetAliasesRequestBuilder> {
public GetAliasesRequestBuilder(IndicesAdminClient client, String... aliases) {
super(client, aliases);
public GetAliasesRequestBuilder(ElasticsearchClient client, GetAliasesAction action, String... aliases) {
super(client, action, aliases);
}
@Override
protected void doExecute(ActionListener<GetAliasesResponse> listener) {
client.getAliases(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.analyze;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class AnalyzeAction extends IndicesAction<AnalyzeRequest, AnalyzeResponse, AnalyzeRequestBuilder> {
public class AnalyzeAction extends Action<AnalyzeRequest, AnalyzeResponse, AnalyzeRequestBuilder> {
public static final AnalyzeAction INSTANCE = new AnalyzeAction();
public static final String NAME = "indices:admin/analyze";
@ -39,7 +39,7 @@ public class AnalyzeAction extends IndicesAction<AnalyzeRequest, AnalyzeResponse
}
@Override
public AnalyzeRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new AnalyzeRequestBuilder(client);
public AnalyzeRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new AnalyzeRequestBuilder(client, this);
}
}

View File

@ -18,21 +18,20 @@
*/
package org.elasticsearch.action.admin.indices.analyze;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.single.custom.SingleCustomOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<AnalyzeRequest, AnalyzeResponse, AnalyzeRequestBuilder> {
public AnalyzeRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new AnalyzeRequest());
public AnalyzeRequestBuilder(ElasticsearchClient client, AnalyzeAction action) {
super(client, action, new AnalyzeRequest());
}
public AnalyzeRequestBuilder(IndicesAdminClient indicesClient, String index, String text) {
super(indicesClient, new AnalyzeRequest(index).text(text));
public AnalyzeRequestBuilder(ElasticsearchClient client, AnalyzeAction action, String index, String text) {
super(client, action, new AnalyzeRequest(index).text(text));
}
/**
@ -87,9 +86,4 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<A
request.charFilters(charFilters);
return this;
}
@Override
protected void doExecute(ActionListener<AnalyzeResponse> listener) {
client.analyze(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.cache.clear;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ClearIndicesCacheAction extends IndicesAction<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder> {
public class ClearIndicesCacheAction extends Action<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder> {
public static final ClearIndicesCacheAction INSTANCE = new ClearIndicesCacheAction();
public static final String NAME = "indices:admin/cache/clear";
@ -39,7 +39,7 @@ public class ClearIndicesCacheAction extends IndicesAction<ClearIndicesCacheRequ
}
@Override
public ClearIndicesCacheRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new ClearIndicesCacheRequestBuilder(client);
public ClearIndicesCacheRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClearIndicesCacheRequestBuilder(client, this);
}
}

View File

@ -19,18 +19,16 @@
package org.elasticsearch.action.admin.indices.cache.clear;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBuilder<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder, IndicesAdminClient> {
public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBuilder<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder> {
public ClearIndicesCacheRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new ClearIndicesCacheRequest());
public ClearIndicesCacheRequestBuilder(ElasticsearchClient client, ClearIndicesCacheAction action) {
super(client, action, new ClearIndicesCacheRequest());
}
public ClearIndicesCacheRequestBuilder setFilterCache(boolean filterCache) {
@ -57,9 +55,4 @@ public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBu
request.idCache(idCache);
return this;
}
@Override
protected void doExecute(ActionListener<ClearIndicesCacheResponse> listener) {
client.clearCache(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.close;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class CloseIndexAction extends IndicesAction<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {
public class CloseIndexAction extends Action<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {
public static final CloseIndexAction INSTANCE = new CloseIndexAction();
public static final String NAME = "indices:admin/close";
@ -39,7 +39,7 @@ public class CloseIndexAction extends IndicesAction<CloseIndexRequest, CloseInde
}
@Override
public CloseIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new CloseIndexRequestBuilder(client);
public CloseIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new CloseIndexRequestBuilder(client, this);
}
}

View File

@ -19,26 +19,26 @@
package org.elasticsearch.action.admin.indices.close;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Builder for close index request
*/
public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder, IndicesAdminClient> {
public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {
public CloseIndexRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new CloseIndexRequest());
public CloseIndexRequestBuilder(ElasticsearchClient client, CloseIndexAction action) {
super(client, action, new CloseIndexRequest());
}
public CloseIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super(indicesClient, new CloseIndexRequest(indices));
public CloseIndexRequestBuilder(ElasticsearchClient client, CloseIndexAction action, String... indices) {
super(client, action, new CloseIndexRequest(indices));
}
/**
* Sets the indices to be closed
*
* @param indices the indices to be closed
* @return the request itself
*/
@ -58,9 +58,4 @@ public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIn
request.indicesOptions(indicesOptions);
return this;
}
@Override
protected void doExecute(ActionListener<CloseIndexResponse> listener) {
client.close(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.create;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class CreateIndexAction extends IndicesAction<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder> {
public class CreateIndexAction extends Action<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder> {
public static final CreateIndexAction INSTANCE = new CreateIndexAction();
public static final String NAME = "indices:admin/create";
@ -39,7 +39,7 @@ public class CreateIndexAction extends IndicesAction<CreateIndexRequest, CreateI
}
@Override
public CreateIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new CreateIndexRequestBuilder(client);
public CreateIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new CreateIndexRequestBuilder(client, this);
}
}

View File

@ -19,10 +19,9 @@
package org.elasticsearch.action.admin.indices.create;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.Alias;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
@ -33,14 +32,14 @@ import java.util.Map;
/**
* Builder for a create index request
*/
public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder, IndicesAdminClient> {
public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder> {
public CreateIndexRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new CreateIndexRequest());
public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action) {
super(client, action, new CreateIndexRequest());
}
public CreateIndexRequestBuilder(IndicesAdminClient indicesClient, String index) {
super(indicesClient, new CreateIndexRequest(index));
public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action, String index) {
super(client, action, new CreateIndexRequest(index));
}
/**
@ -244,9 +243,4 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<Create
request.source(source);
return this;
}
@Override
protected void doExecute(ActionListener<CreateIndexResponse> listener) {
client.create(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.delete;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class DeleteIndexAction extends IndicesAction<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder> {
public class DeleteIndexAction extends Action<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder> {
public static final DeleteIndexAction INSTANCE = new DeleteIndexAction();
public static final String NAME = "indices:admin/delete";
@ -39,7 +39,7 @@ public class DeleteIndexAction extends IndicesAction<DeleteIndexRequest, DeleteI
}
@Override
public DeleteIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new DeleteIndexRequestBuilder(client);
public DeleteIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new DeleteIndexRequestBuilder(client, this);
}
}

View File

@ -19,19 +19,18 @@
package org.elasticsearch.action.admin.indices.delete;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.unit.TimeValue;
/**
*
*/
public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder, IndicesAdminClient> {
public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder> {
public DeleteIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super(indicesClient, new DeleteIndexRequest(indices));
public DeleteIndexRequestBuilder(ElasticsearchClient client, DeleteIndexAction action, String... indices) {
super(client, action, new DeleteIndexRequest(indices));
}
/**
@ -54,16 +53,11 @@ public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder
/**
* Specifies what type of requested indices to ignore and wildcard indices expressions.
*
* <p/>
* For example indices that don't exist.
*/
public DeleteIndexRequestBuilder setIndicesOptions(IndicesOptions options) {
request.indicesOptions(options);
return this;
}
@Override
protected void doExecute(ActionListener<DeleteIndexResponse> listener) {
client.delete(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.exists.indices;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class IndicesExistsAction extends IndicesAction<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder> {
public class IndicesExistsAction extends Action<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder> {
public static final IndicesExistsAction INSTANCE = new IndicesExistsAction();
public static final String NAME = "indices:admin/exists";
@ -39,7 +39,7 @@ public class IndicesExistsAction extends IndicesAction<IndicesExistsRequest, Ind
}
@Override
public IndicesExistsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new IndicesExistsRequestBuilder(client);
public IndicesExistsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new IndicesExistsRequestBuilder(client, this);
}
}

View File

@ -19,18 +19,17 @@
package org.elasticsearch.action.admin.indices.exists.indices;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder, IndicesAdminClient> {
public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder> {
public IndicesExistsRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super(indicesClient, new IndicesExistsRequest(indices));
public IndicesExistsRequestBuilder(ElasticsearchClient client, IndicesExistsAction action, String... indices) {
super(client, action, new IndicesExistsRequest(indices));
}
public IndicesExistsRequestBuilder setIndices(String... indices) {
@ -40,16 +39,11 @@ public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestB
/**
* Specifies what type of requested indices to ignore and wildcard indices expressions.
*
* <p/>
* For example indices that don't exist.
*/
public IndicesExistsRequestBuilder setIndicesOptions(IndicesOptions options) {
request.indicesOptions(options);
return this;
}
@Override
protected void doExecute(ActionListener<IndicesExistsResponse> listener) {
client.exists(request, listener);
}
}

View File

@ -18,12 +18,12 @@
*/
package org.elasticsearch.action.admin.indices.exists.types;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class TypesExistsAction extends IndicesAction<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder> {
public class TypesExistsAction extends Action<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder> {
public static final TypesExistsAction INSTANCE = new TypesExistsAction();
public static final String NAME = "indices:admin/types/exists";
@ -38,7 +38,7 @@ public class TypesExistsAction extends IndicesAction<TypesExistsRequest, TypesEx
}
@Override
public TypesExistsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new TypesExistsRequestBuilder(client);
public TypesExistsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new TypesExistsRequestBuilder(client, this);
}
}

View File

@ -18,26 +18,25 @@
*/
package org.elasticsearch.action.admin.indices.exists.types;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.Strings;
/**
* A builder for {@link TypesExistsRequest}.
*/
public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder, IndicesAdminClient> {
public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder> {
/**
* @param indices What indices to check for types
*/
public TypesExistsRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super(indicesClient, new TypesExistsRequest(indices, Strings.EMPTY_ARRAY));
public TypesExistsRequestBuilder(ElasticsearchClient client, TypesExistsAction action, String... indices) {
super(client, action, new TypesExistsRequest(indices, Strings.EMPTY_ARRAY));
}
TypesExistsRequestBuilder(IndicesAdminClient client) {
super(client, new TypesExistsRequest());
TypesExistsRequestBuilder(ElasticsearchClient client, TypesExistsAction action) {
super(client, action, new TypesExistsRequest());
}
/**
@ -63,9 +62,4 @@ public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBui
request.indicesOptions(indicesOptions);
return this;
}
@Override
protected void doExecute(ActionListener<TypesExistsResponse> listener) {
client.typesExists(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.flush;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class FlushAction extends IndicesAction<FlushRequest, FlushResponse, FlushRequestBuilder> {
public class FlushAction extends Action<FlushRequest, FlushResponse, FlushRequestBuilder> {
public static final FlushAction INSTANCE = new FlushAction();
public static final String NAME = "indices:admin/flush";
@ -39,7 +39,7 @@ public class FlushAction extends IndicesAction<FlushRequest, FlushResponse, Flus
}
@Override
public FlushRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new FlushRequestBuilder(client);
public FlushRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new FlushRequestBuilder(client, this);
}
}

View File

@ -19,17 +19,16 @@
package org.elasticsearch.action.admin.indices.flush;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushRequest, FlushResponse, FlushRequestBuilder, IndicesAdminClient> {
public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushRequest, FlushResponse, FlushRequestBuilder> {
public FlushRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new FlushRequest());
public FlushRequestBuilder(ElasticsearchClient client, FlushAction action) {
super(client, action, new FlushRequest());
}
public FlushRequestBuilder setForce(boolean force) {
@ -37,11 +36,6 @@ public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushR
return this;
}
@Override
protected void doExecute(ActionListener<FlushResponse> listener) {
client.flush(request, listener);
}
public FlushRequestBuilder setWaitIfOngoing(boolean waitIfOngoing) {
request.waitIfOngoing(waitIfOngoing);
return this;

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class GetIndexAction extends IndicesAction<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> {
public class GetIndexAction extends Action<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> {
public static final GetIndexAction INSTANCE = new GetIndexAction();
public static final String NAME = "indices:admin/get";
@ -34,8 +34,8 @@ public class GetIndexAction extends IndicesAction<GetIndexRequest, GetIndexRespo
}
@Override
public GetIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetIndexRequestBuilder(client);
public GetIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetIndexRequestBuilder(client, this);
}
@Override

View File

@ -19,18 +19,17 @@
package org.elasticsearch.action.admin.indices.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class GetIndexRequestBuilder extends ClusterInfoRequestBuilder<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> {
public GetIndexRequestBuilder(IndicesAdminClient client, String... indices) {
super(client, new GetIndexRequest().indices(indices));
public GetIndexRequestBuilder(ElasticsearchClient client, GetIndexAction action, String... indices) {
super(client, action, new GetIndexRequest().indices(indices));
}
public GetIndexRequestBuilder setFeatures(Feature... features) {
@ -42,9 +41,4 @@ public class GetIndexRequestBuilder extends ClusterInfoRequestBuilder<GetIndexRe
request.addFeatures(features);
return this;
}
@Override
protected void doExecute(ActionListener<GetIndexResponse> listener) {
client.getIndex(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class GetFieldMappingsAction extends IndicesAction<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder> {
public class GetFieldMappingsAction extends Action<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder> {
public static final GetFieldMappingsAction INSTANCE = new GetFieldMappingsAction();
public static final String NAME = "indices:admin/mappings/fields/get";
@ -34,8 +34,8 @@ public class GetFieldMappingsAction extends IndicesAction<GetFieldMappingsReques
}
@Override
public GetFieldMappingsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetFieldMappingsRequestBuilder(client);
public GetFieldMappingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetFieldMappingsRequestBuilder(client, this);
}
@Override

View File

@ -23,13 +23,14 @@ import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient;
/** A helper class to build {@link GetFieldMappingsRequest} objects */
public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder, IndicesAdminClient> {
public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder> {
public GetFieldMappingsRequestBuilder(IndicesAdminClient client, String... indices) {
super(client, new GetFieldMappingsRequest().indices(indices));
public GetFieldMappingsRequestBuilder(ElasticsearchClient client, GetFieldMappingsAction action, String... indices) {
super(client, action, new GetFieldMappingsRequest().indices(indices));
}
public GetFieldMappingsRequestBuilder setIndices(String... indices) {
@ -69,10 +70,4 @@ public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFiel
request.includeDefaults(includeDefaults);
return this;
}
@Override
protected void doExecute(ActionListener<GetFieldMappingsResponse> listener) {
client.getFieldMappings(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class GetMappingsAction extends IndicesAction<GetMappingsRequest, GetMappingsResponse, GetMappingsRequestBuilder> {
public class GetMappingsAction extends Action<GetMappingsRequest, GetMappingsResponse, GetMappingsRequestBuilder> {
public static final GetMappingsAction INSTANCE = new GetMappingsAction();
public static final String NAME = "indices:admin/mappings/get";
@ -34,8 +34,8 @@ public class GetMappingsAction extends IndicesAction<GetMappingsRequest, GetMapp
}
@Override
public GetMappingsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetMappingsRequestBuilder(client);
public GetMappingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetMappingsRequestBuilder(client, this);
}
@Override

View File

@ -19,20 +19,14 @@
package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class GetMappingsRequestBuilder extends ClusterInfoRequestBuilder<GetMappingsRequest, GetMappingsResponse, GetMappingsRequestBuilder> {
public GetMappingsRequestBuilder(IndicesAdminClient client, String... indices) {
super(client, new GetMappingsRequest().indices(indices));
}
@Override
protected void doExecute(ActionListener<GetMappingsResponse> listener) {
client.getMappings(request, listener);
public GetMappingsRequestBuilder(ElasticsearchClient client, GetMappingsAction action, String... indices) {
super(client, action, new GetMappingsRequest().indices(indices));
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.mapping.put;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class PutMappingAction extends IndicesAction<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder> {
public class PutMappingAction extends Action<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder> {
public static final PutMappingAction INSTANCE = new PutMappingAction();
public static final String NAME = "indices:admin/mapping/put";
@ -39,7 +39,7 @@ public class PutMappingAction extends IndicesAction<PutMappingRequest, PutMappin
}
@Override
public PutMappingRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new PutMappingRequestBuilder(client);
public PutMappingRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new PutMappingRequestBuilder(client, this);
}
}

View File

@ -19,10 +19,9 @@
package org.elasticsearch.action.admin.indices.mapping.put;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.xcontent.XContentBuilder;
import java.util.Map;
@ -30,10 +29,10 @@ import java.util.Map;
/**
* Builder for a put mapping request
*/
public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder, IndicesAdminClient> {
public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder> {
public PutMappingRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new PutMappingRequest());
public PutMappingRequestBuilder(ElasticsearchClient client, PutMappingAction action) {
super(client, action, new PutMappingRequest());
}
public PutMappingRequestBuilder setIndices(String... indices) {
@ -43,7 +42,7 @@ public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMapp
/**
* Specifies what type of requested indices to ignore and wildcard indices expressions.
*
* <p/>
* For example indices that don't exist.
*/
public PutMappingRequestBuilder setIndicesOptions(IndicesOptions options) {
@ -101,9 +100,4 @@ public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMapp
request.ignoreConflicts(ignoreConflicts);
return this;
}
@Override
protected void doExecute(ActionListener<PutMappingResponse> listener) {
client.putMapping(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.open;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class OpenIndexAction extends IndicesAction<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder> {
public class OpenIndexAction extends Action<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder> {
public static final OpenIndexAction INSTANCE = new OpenIndexAction();
public static final String NAME = "indices:admin/open";
@ -39,7 +39,7 @@ public class OpenIndexAction extends IndicesAction<OpenIndexRequest, OpenIndexRe
}
@Override
public OpenIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new OpenIndexRequestBuilder(client);
public OpenIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new OpenIndexRequestBuilder(client, this);
}
}

View File

@ -19,26 +19,26 @@
package org.elasticsearch.action.admin.indices.open;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Builder for for open index request
*/
public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder, IndicesAdminClient> {
public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder> {
public OpenIndexRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new OpenIndexRequest());
public OpenIndexRequestBuilder(ElasticsearchClient client, OpenIndexAction action) {
super(client, action, new OpenIndexRequest());
}
public OpenIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super(indicesClient, new OpenIndexRequest(indices));
public OpenIndexRequestBuilder(ElasticsearchClient client, OpenIndexAction action, String... indices) {
super(client, action, new OpenIndexRequest(indices));
}
/**
* Sets the indices to be opened
*
* @param indices the indices to be opened
* @return the request itself
*/
@ -58,9 +58,4 @@ public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenInde
request.indicesOptions(indicesOptions);
return this;
}
@Override
protected void doExecute(ActionListener<OpenIndexResponse> listener) {
client.open(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.optimize;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class OptimizeAction extends IndicesAction<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder> {
public class OptimizeAction extends Action<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder> {
public static final OptimizeAction INSTANCE = new OptimizeAction();
public static final String NAME = "indices:admin/optimize";
@ -39,7 +39,7 @@ public class OptimizeAction extends IndicesAction<OptimizeRequest, OptimizeRespo
}
@Override
public OptimizeRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new OptimizeRequestBuilder(client);
public OptimizeRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new OptimizeRequestBuilder(client, this);
}
}

View File

@ -19,9 +19,8 @@
package org.elasticsearch.action.admin.indices.optimize;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* A request to optimize one or more indices. In order to optimize on all the indices, pass an empty array or
@ -30,10 +29,10 @@ import org.elasticsearch.client.IndicesAdminClient;
* <p>{@link #setMaxNumSegments(int)} allows to control the number of segments to optimize down to. By default, will
* cause the optimize process to optimize down to half the configured number of segments.
*/
public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder, IndicesAdminClient> {
public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder> {
public OptimizeRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new OptimizeRequest());
public OptimizeRequestBuilder(ElasticsearchClient client, OptimizeAction action) {
super(client, action, new OptimizeRequest());
}
/**
@ -61,9 +60,4 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<Opt
request.flush(flush);
return this;
}
@Override
protected void doExecute(ActionListener<OptimizeResponse> listener) {
client.optimize(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.indices.recovery;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Recovery information action
*/
public class RecoveryAction extends IndicesAction<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder> {
public class RecoveryAction extends Action<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder> {
public static final RecoveryAction INSTANCE = new RecoveryAction();
public static final String NAME = "indices:monitor/recovery";
@ -35,8 +35,8 @@ public class RecoveryAction extends IndicesAction<RecoveryRequest, RecoveryRespo
}
@Override
public RecoveryRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new RecoveryRequestBuilder(client);
public RecoveryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RecoveryRequestBuilder(client, this);
}
@Override

View File

@ -19,27 +19,19 @@
package org.elasticsearch.action.admin.indices.recovery;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Recovery information request builder.
*/
public class RecoveryRequestBuilder extends BroadcastOperationRequestBuilder<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder, IndicesAdminClient> {
public class RecoveryRequestBuilder extends BroadcastOperationRequestBuilder<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder> {
/**
* Constructs a new recovery information request builder.
*
* @param indicesClient Indices admin client
*/
public RecoveryRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new RecoveryRequest());
}
@Override
protected void doExecute(ActionListener<RecoveryResponse> listener) {
client.recoveries(request, listener);
public RecoveryRequestBuilder(ElasticsearchClient client, RecoveryAction action) {
super(client, action, new RecoveryRequest());
}
public RecoveryRequestBuilder setDetailed(boolean detailed) {

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.refresh;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class RefreshAction extends IndicesAction<RefreshRequest, RefreshResponse, RefreshRequestBuilder> {
public class RefreshAction extends Action<RefreshRequest, RefreshResponse, RefreshRequestBuilder> {
public static final RefreshAction INSTANCE = new RefreshAction();
public static final String NAME = "indices:admin/refresh";
@ -39,7 +39,7 @@ public class RefreshAction extends IndicesAction<RefreshRequest, RefreshResponse
}
@Override
public RefreshRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new RefreshRequestBuilder(client);
public RefreshRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RefreshRequestBuilder(client, this);
}
}

View File

@ -19,23 +19,17 @@
package org.elasticsearch.action.admin.indices.refresh;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* A refresh request making all operations performed since the last refresh available for search. The (near) real-time
* capabilities depends on the index engine used. For example, the internal one requires refresh to be called, but by
* default a refresh is scheduled periodically.
*/
public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<RefreshRequest, RefreshResponse, RefreshRequestBuilder, IndicesAdminClient> {
public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<RefreshRequest, RefreshResponse, RefreshRequestBuilder> {
public RefreshRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new RefreshRequest());
}
@Override
protected void doExecute(ActionListener<RefreshResponse> listener) {
client.refresh(request, listener);
public RefreshRequestBuilder(ElasticsearchClient client, RefreshAction action) {
super(client, action, new RefreshRequest());
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.segments;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class IndicesSegmentsAction extends IndicesAction<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder> {
public class IndicesSegmentsAction extends Action<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder> {
public static final IndicesSegmentsAction INSTANCE = new IndicesSegmentsAction();
public static final String NAME = "indices:monitor/segments";
@ -39,7 +39,7 @@ public class IndicesSegmentsAction extends IndicesAction<IndicesSegmentsRequest,
}
@Override
public IndicesSegmentsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new IndicesSegmentsRequestBuilder(client);
public IndicesSegmentsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new IndicesSegmentsRequestBuilder(client, this);
}
}

View File

@ -19,26 +19,20 @@
package org.elasticsearch.action.admin.indices.segments;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class IndicesSegmentsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder, IndicesAdminClient> {
public class IndicesSegmentsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder> {
public IndicesSegmentsRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new IndicesSegmentsRequest());
public IndicesSegmentsRequestBuilder(ElasticsearchClient client, IndicesSegmentsAction action) {
super(client, action, new IndicesSegmentsRequest());
}
public IndicesSegmentsRequestBuilder setVerbose(boolean verbose) {
request.verbose = verbose;
return this;
}
@Override
protected void doExecute(ActionListener<IndicesSegmentResponse> listener) {
client.segments(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.settings.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class GetSettingsAction extends IndicesAction<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder> {
public class GetSettingsAction extends Action<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder> {
public static final GetSettingsAction INSTANCE = new GetSettingsAction();
public static final String NAME = "indices:monitor/settings/get";
@ -34,8 +34,8 @@ public class GetSettingsAction extends IndicesAction<GetSettingsRequest, GetSett
}
@Override
public GetSettingsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetSettingsRequestBuilder(client);
public GetSettingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetSettingsRequestBuilder(client, this);
}
@Override

View File

@ -20,17 +20,16 @@
package org.elasticsearch.action.admin.indices.settings.get;
import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder, IndicesAdminClient> {
public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder> {
public GetSettingsRequestBuilder(IndicesAdminClient client, String... indices) {
super(client, new GetSettingsRequest().indices(indices));
public GetSettingsRequestBuilder(ElasticsearchClient client, GetSettingsAction action, String... indices) {
super(client, action, new GetSettingsRequest().indices(indices));
}
public GetSettingsRequestBuilder setIndices(String... indices) {
@ -45,7 +44,7 @@ public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBui
/**
* Specifies what type of requested indices to ignore and wildcard indices expressions.
*
* <p/>
* For example indices that don't exist.
*/
public GetSettingsRequestBuilder setIndicesOptions(IndicesOptions options) {
@ -57,9 +56,4 @@ public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBui
request.names(names);
return this;
}
@Override
protected void doExecute(ActionListener<GetSettingsResponse> listener) {
client.getSettings(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.settings.put;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class UpdateSettingsAction extends IndicesAction<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder> {
public class UpdateSettingsAction extends Action<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder> {
public static final UpdateSettingsAction INSTANCE = new UpdateSettingsAction();
public static final String NAME = "indices:admin/settings/update";
@ -39,7 +39,7 @@ public class UpdateSettingsAction extends IndicesAction<UpdateSettingsRequest, U
}
@Override
public UpdateSettingsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new UpdateSettingsRequestBuilder(client);
public UpdateSettingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new UpdateSettingsRequestBuilder(client, this);
}
}

View File

@ -22,7 +22,7 @@ package org.elasticsearch.action.admin.indices.settings.put;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -30,10 +30,10 @@ import java.util.Map;
/**
* Builder for an update index settings request
*/
public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder, IndicesAdminClient> {
public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder> {
public UpdateSettingsRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super(indicesClient, new UpdateSettingsRequest(indices));
public UpdateSettingsRequestBuilder(ElasticsearchClient client, UpdateSettingsAction action, String... indices) {
super(client, action, new UpdateSettingsRequest(indices));
}
/**
@ -46,7 +46,7 @@ public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<Upd
/**
* Specifies what type of requested indices to ignore and wildcard indices expressions.
*
* <p/>
* For example indices that don't exist.
*/
public UpdateSettingsRequestBuilder setIndicesOptions(IndicesOptions options) {
@ -85,9 +85,4 @@ public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<Upd
request.settings(source);
return this;
}
@Override
protected void doExecute(ActionListener<UpdateSettingsResponse> listener) {
client.updateSettings(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.stats;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class IndicesStatsAction extends IndicesAction<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder> {
public class IndicesStatsAction extends Action<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder> {
public static final IndicesStatsAction INSTANCE = new IndicesStatsAction();
public static final String NAME = "indices:monitor/stats";
@ -39,7 +39,7 @@ public class IndicesStatsAction extends IndicesAction<IndicesStatsRequest, Indic
}
@Override
public IndicesStatsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new IndicesStatsRequestBuilder(client);
public IndicesStatsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new IndicesStatsRequestBuilder(client, this);
}
}

View File

@ -19,9 +19,8 @@
package org.elasticsearch.action.admin.indices.stats;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* A request to get indices level stats. Allow to enable different stats to be returned.
@ -32,10 +31,10 @@ import org.elasticsearch.client.IndicesAdminClient;
* <p>All the stats to be returned can be cleared using {@link #clear()}, at which point, specific
* stats can be enabled.
*/
public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder, IndicesAdminClient> {
public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder> {
public IndicesStatsRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new IndicesStatsRequest());
public IndicesStatsRequestBuilder(ElasticsearchClient client, IndicesStatsAction action) {
super(client, action, new IndicesStatsRequest());
}
/**
@ -172,9 +171,4 @@ public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder
request.recovery(recovery);
return this;
}
@Override
protected void doExecute(ActionListener<IndicesStatsResponse> listener) {
client.stats(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.template.delete;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class DeleteIndexTemplateAction extends IndicesAction<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder> {
public class DeleteIndexTemplateAction extends Action<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder> {
public static final DeleteIndexTemplateAction INSTANCE = new DeleteIndexTemplateAction();
public static final String NAME = "indices:admin/template/delete";
@ -39,7 +39,7 @@ public class DeleteIndexTemplateAction extends IndicesAction<DeleteIndexTemplate
}
@Override
public DeleteIndexTemplateRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new DeleteIndexTemplateRequestBuilder(client);
public DeleteIndexTemplateRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new DeleteIndexTemplateRequestBuilder(client, this);
}
}

View File

@ -18,25 +18,19 @@
*/
package org.elasticsearch.action.admin.indices.template.delete;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder, IndicesAdminClient> {
public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder> {
public DeleteIndexTemplateRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new DeleteIndexTemplateRequest());
public DeleteIndexTemplateRequestBuilder(ElasticsearchClient client, DeleteIndexTemplateAction action) {
super(client, action, new DeleteIndexTemplateRequest());
}
public DeleteIndexTemplateRequestBuilder(IndicesAdminClient indicesClient, String name) {
super(indicesClient, new DeleteIndexTemplateRequest(name));
}
@Override
protected void doExecute(ActionListener<DeleteIndexTemplateResponse> listener) {
client.deleteTemplate(request, listener);
public DeleteIndexTemplateRequestBuilder(ElasticsearchClient client, DeleteIndexTemplateAction action, String name) {
super(client, action, new DeleteIndexTemplateRequest(name));
}
}

View File

@ -18,13 +18,13 @@
*/
package org.elasticsearch.action.admin.indices.template.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class GetIndexTemplatesAction extends IndicesAction<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder> {
public class GetIndexTemplatesAction extends Action<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder> {
public static final GetIndexTemplatesAction INSTANCE = new GetIndexTemplatesAction();
public static final String NAME = "indices:admin/template/get";
@ -39,7 +39,7 @@ public class GetIndexTemplatesAction extends IndicesAction<GetIndexTemplatesRequ
}
@Override
public GetIndexTemplatesRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetIndexTemplatesRequestBuilder(client);
public GetIndexTemplatesRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetIndexTemplatesRequestBuilder(client, this);
}
}

View File

@ -18,25 +18,19 @@
*/
package org.elasticsearch.action.admin.indices.template.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
*
*/
public class GetIndexTemplatesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder, IndicesAdminClient> {
public class GetIndexTemplatesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder> {
public GetIndexTemplatesRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new GetIndexTemplatesRequest());
public GetIndexTemplatesRequestBuilder(ElasticsearchClient client, GetIndexTemplatesAction action) {
super(client, action, new GetIndexTemplatesRequest());
}
public GetIndexTemplatesRequestBuilder(IndicesAdminClient indicesClient, String... names) {
super(indicesClient, new GetIndexTemplatesRequest(names));
}
@Override
protected void doExecute(ActionListener<GetIndexTemplatesResponse> listener) {
client.getTemplates(request, listener);
public GetIndexTemplatesRequestBuilder(ElasticsearchClient client, GetIndexTemplatesAction action, String... names) {
super(client, action, new GetIndexTemplatesRequest(names));
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.template.put;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class PutIndexTemplateAction extends IndicesAction<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder> {
public class PutIndexTemplateAction extends Action<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder> {
public static final PutIndexTemplateAction INSTANCE = new PutIndexTemplateAction();
public static final String NAME = "indices:admin/template/put";
@ -39,7 +39,7 @@ public class PutIndexTemplateAction extends IndicesAction<PutIndexTemplateReques
}
@Override
public PutIndexTemplateRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new PutIndexTemplateRequestBuilder(client);
public PutIndexTemplateRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new PutIndexTemplateRequestBuilder(client, this);
}
}

View File

@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.indices.template.put;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.Alias;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -31,14 +31,14 @@ import java.util.Map;
/**
*
*/
public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder, IndicesAdminClient> {
public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder> {
public PutIndexTemplateRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new PutIndexTemplateRequest());
public PutIndexTemplateRequestBuilder(ElasticsearchClient client, PutIndexTemplateAction action) {
super(client, action, new PutIndexTemplateRequest());
}
public PutIndexTemplateRequestBuilder(IndicesAdminClient indicesClient, String name) {
super(indicesClient, new PutIndexTemplateRequest(name));
public PutIndexTemplateRequestBuilder(ElasticsearchClient client, PutIndexTemplateAction action, String name) {
super(client, action, new PutIndexTemplateRequest(name));
}
/**
@ -153,7 +153,7 @@ public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBu
/**
* Adds an alias that will be added when the index template gets created.
*
* @param alias The alias
* @param alias The alias
* @return the request builder
*/
public PutIndexTemplateRequestBuilder addAlias(Alias alias) {
@ -238,9 +238,4 @@ public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBu
request.source(templateSource, offset, length);
return this;
}
@Override
protected void doExecute(ActionListener<PutIndexTemplateResponse> listener) {
client.putTemplate(request, listener);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.validate.query;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient;
/**
*/
public class ValidateQueryAction extends IndicesAction<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder> {
public class ValidateQueryAction extends Action<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder> {
public static final ValidateQueryAction INSTANCE = new ValidateQueryAction();
public static final String NAME = "indices:admin/validate/query";
@ -39,7 +39,7 @@ public class ValidateQueryAction extends IndicesAction<ValidateQueryRequest, Val
}
@Override
public ValidateQueryRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new ValidateQueryRequestBuilder(client);
public ValidateQueryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ValidateQueryRequestBuilder(client, this);
}
}

View File

@ -22,19 +22,19 @@ package org.elasticsearch.action.admin.indices.validate.query;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.QuerySourceBuilder;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.index.query.QueryBuilder;
/**
*
*/
public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilder<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder, IndicesAdminClient> {
public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilder<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder> {
private QuerySourceBuilder sourceBuilder;
public ValidateQueryRequestBuilder(IndicesAdminClient client) {
super(client, new ValidateQueryRequest());
public ValidateQueryRequestBuilder(ElasticsearchClient client, ValidateQueryAction action) {
super(client, action, new ValidateQueryRequest());
}
/**
@ -94,12 +94,11 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
}
@Override
protected void doExecute(ActionListener<ValidateQueryResponse> listener) {
protected ValidateQueryRequest beforeExecute(ValidateQueryRequest request) {
if (sourceBuilder != null) {
request.source(sourceBuilder);
}
client.validateQuery(request, listener);
return request;
}
private QuerySourceBuilder sourceBuilder() {

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