[CLIENT] Remove unnecessary intermediate interfaces

Client, ClusterAdminClient and IndicesAdminClient had corresponding
intermediate `internal` interfaces that are unnecessary and cause
a lot of casting. This commit removes the intermediate interfaces
and uses the super interfaces directly.

This commit also adds Releaseable to `Node` and `Client` in order to
be used with utilities like try / with.

Closes #4355
Closes #6517
This commit is contained in:
Simon Willnauer 2014-06-16 16:09:43 +02:00
parent e198c58a6b
commit adb5c19849
154 changed files with 751 additions and 1103 deletions

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Main action (used with {@link Client} API.
*/
public abstract class Action<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>>
public abstract class Action<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>, Client extends ElasticsearchClient>
extends GenericAction<Request, Response> {
protected Action(String name) {

View File

@ -21,23 +21,29 @@ package org.elasticsearch.action;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.internal.InternalGenericClient;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.threadpool.ThreadPool;
/**
*
*/
public abstract class ActionRequestBuilder<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder> {
public abstract class ActionRequestBuilder<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder, Client extends ElasticsearchClient> {
protected final Request request;
private final ThreadPool threadPool;
protected final Client client;
protected final InternalGenericClient client;
protected ActionRequestBuilder(InternalGenericClient client, Request request) {
this.client = client;
protected ActionRequestBuilder(Client client, Request request) {
this.request = request;
this.client = client;
threadPool = client.threadPool();
}
public Request request() {
return this.request;
}
@ -55,7 +61,7 @@ public abstract class ActionRequestBuilder<Request extends ActionRequest, Respon
}
public ListenableActionFuture<Response> execute() {
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<>(request.listenerThreaded(), client.threadPool());
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<>(request.listenerThreaded(), threadPool);
execute(future);
return future;
}

View File

@ -17,13 +17,18 @@
* under the License.
*/
package org.elasticsearch.client.internal;
package org.elasticsearch.action;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.IndicesAdminClient;
/**
*
* Indices action (used with {@link IndicesAdminClient} API.
*/
public interface InternalIndicesAdminClient extends IndicesAdminClient, InternalGenericClient {
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

@ -19,21 +19,17 @@
package org.elasticsearch.action.admin.cluster;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.GenericAction;
import org.elasticsearch.action.*;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
/**
* Cluster action (used with {@link ClusterAdminClient} API.
*/
public abstract class ClusterAction<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>>
extends GenericAction<Request, Response> {
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);
}
public abstract RequestBuilder newRequestBuilder(ClusterAdminClient client);
}

View File

@ -22,17 +22,16 @@ 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.internal.InternalClusterAdminClient;
import org.elasticsearch.common.Priority;
import org.elasticsearch.common.unit.TimeValue;
/**
*
*/
public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder> {
public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder, ClusterAdminClient> {
public ClusterHealthRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new ClusterHealthRequest());
super(clusterClient, new ClusterHealthRequest());
}
public ClusterHealthRequestBuilder setIndices(String... indices) {
@ -90,6 +89,6 @@ public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestB
@Override
protected void doExecute(ActionListener<ClusterHealthResponse> listener) {
((ClusterAdminClient) client).health(request, listener);
client.health(request, listener);
}
}

View File

@ -22,7 +22,6 @@ 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.internal.InternalClusterAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
@ -30,7 +29,7 @@ import org.elasticsearch.common.unit.TimeValue;
public class NodesHotThreadsRequestBuilder extends NodesOperationRequestBuilder<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> {
public NodesHotThreadsRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new NodesHotThreadsRequest());
super(clusterClient, new NodesHotThreadsRequest());
}
public NodesHotThreadsRequestBuilder setThreads(int threads) {
@ -50,6 +49,6 @@ public class NodesHotThreadsRequestBuilder extends NodesOperationRequestBuilder<
@Override
protected void doExecute(ActionListener<NodesHotThreadsResponse> listener) {
((ClusterAdminClient) client).nodesHotThreads(request, listener);
client.nodesHotThreads(request, listener);
}
}

View File

@ -22,7 +22,6 @@ 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.internal.InternalClusterAdminClient;
/**
*
@ -30,7 +29,7 @@ import org.elasticsearch.client.internal.InternalClusterAdminClient;
public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> {
public NodesInfoRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new NodesInfoRequest());
super(clusterClient, new NodesInfoRequest());
}
/**
@ -123,6 +122,6 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
@Override
protected void doExecute(ActionListener<NodesInfoResponse> listener) {
((ClusterAdminClient) client).nodesInfo(request, listener);
client.nodesInfo(request, listener);
}
}

View File

@ -22,7 +22,6 @@ package org.elasticsearch.action.admin.cluster.node.restart;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
@ -31,7 +30,7 @@ import org.elasticsearch.common.unit.TimeValue;
public class NodesRestartRequestBuilder extends NodesOperationRequestBuilder<NodesRestartRequest, NodesRestartResponse, NodesRestartRequestBuilder> {
public NodesRestartRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new NodesRestartRequest());
super(clusterClient, new NodesRestartRequest());
}
/**
@ -52,6 +51,6 @@ public class NodesRestartRequestBuilder extends NodesOperationRequestBuilder<Nod
@Override
protected void doExecute(ActionListener<NodesRestartResponse> listener) {
((ClusterAdminClient) client).nodesRestart(request, listener);
client.nodesRestart(request, listener);
}
}

View File

@ -22,16 +22,15 @@ package org.elasticsearch.action.admin.cluster.node.shutdown;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
*
*/
public class NodesShutdownRequestBuilder extends MasterNodeOperationRequestBuilder<NodesShutdownRequest, NodesShutdownResponse, NodesShutdownRequestBuilder> {
public class NodesShutdownRequestBuilder extends MasterNodeOperationRequestBuilder<NodesShutdownRequest, NodesShutdownResponse, NodesShutdownRequestBuilder, ClusterAdminClient> {
public NodesShutdownRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new NodesShutdownRequest());
super(clusterClient, new NodesShutdownRequest());
}
/**
@ -68,6 +67,6 @@ public class NodesShutdownRequestBuilder extends MasterNodeOperationRequestBuild
@Override
protected void doExecute(ActionListener<NodesShutdownResponse> listener) {
((ClusterAdminClient) client).nodesShutdown(request, listener);
client.nodesShutdown(request, listener);
}
}

View File

@ -23,7 +23,6 @@ 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.internal.InternalClusterAdminClient;
/**
*
@ -31,7 +30,7 @@ import org.elasticsearch.client.internal.InternalClusterAdminClient;
public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> {
public NodesStatsRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new NodesStatsRequest());
super(clusterClient, new NodesStatsRequest());
}
/**
@ -137,6 +136,6 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
@Override
protected void doExecute(ActionListener<NodesStatsResponse> listener) {
((ClusterAdminClient) client).nodesStats(request, listener);
client.nodesStats(request, listener);
}
}

View File

@ -22,12 +22,11 @@ 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.internal.InternalClusterAdminClient;
/**
* Builder for unregister repository request
*/
public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder> {
public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder, ClusterAdminClient> {
/**
* Constructs unregister repository request builder
@ -35,7 +34,7 @@ public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<D
* @param clusterAdminClient cluster admin client
*/
public DeleteRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient) {
super((InternalClusterAdminClient) clusterAdminClient, new DeleteRepositoryRequest());
super(clusterAdminClient, new DeleteRepositoryRequest());
}
/**
@ -44,7 +43,7 @@ public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<D
* @param clusterAdminClient cluster adming client
*/
public DeleteRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient, String name) {
super((InternalClusterAdminClient) clusterAdminClient, new DeleteRepositoryRequest(name));
super(clusterAdminClient, new DeleteRepositoryRequest(name));
}
/**
@ -59,6 +58,6 @@ public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<D
@Override
protected void doExecute(ActionListener<DeleteRepositoryResponse> listener) {
((ClusterAdminClient) client).deleteRepository(request, listener);
client.deleteRepository(request, listener);
}
}

View File

@ -23,12 +23,11 @@ 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.internal.InternalClusterAdminClient;
/**
* Get repository request builder
*/
public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder> {
public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder, ClusterAdminClient> {
/**
* Creates new get repository request builder
@ -36,7 +35,7 @@ public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationReques
* @param clusterAdminClient cluster admin client
*/
public GetRepositoriesRequestBuilder(ClusterAdminClient clusterAdminClient) {
super((InternalClusterAdminClient) clusterAdminClient, new GetRepositoriesRequest());
super(clusterAdminClient, new GetRepositoriesRequest());
}
/**
@ -46,7 +45,7 @@ public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationReques
* @param repositories list of repositories to get
*/
public GetRepositoriesRequestBuilder(ClusterAdminClient clusterAdminClient, String... repositories) {
super((InternalClusterAdminClient) clusterAdminClient, new GetRepositoriesRequest(repositories));
super(clusterAdminClient, new GetRepositoriesRequest(repositories));
}
/**
@ -73,6 +72,6 @@ public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationReques
@Override
protected void doExecute(ActionListener<GetRepositoriesResponse> listener) {
((ClusterAdminClient) client).getRepositories(request, listener);
client.getRepositories(request, listener);
}
}

View File

@ -22,7 +22,6 @@ 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.internal.InternalClusterAdminClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -30,7 +29,7 @@ import java.util.Map;
/**
* Register repository request builder
*/
public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder> {
public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder, ClusterAdminClient> {
/**
* Constructs register repository request
@ -38,7 +37,7 @@ public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutR
* @param clusterAdminClient cluster admin client
*/
public PutRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient) {
super((InternalClusterAdminClient) clusterAdminClient, new PutRepositoryRequest());
super(clusterAdminClient, new PutRepositoryRequest());
}
/**
@ -48,7 +47,7 @@ public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutR
* @param name repository name
*/
public PutRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient, String name) {
super((InternalClusterAdminClient) clusterAdminClient, new PutRepositoryRequest(name));
super(clusterAdminClient, new PutRepositoryRequest(name));
}
/**
@ -119,6 +118,6 @@ public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutR
@Override
protected void doExecute(ActionListener<PutRepositoryResponse> listener) {
((ClusterAdminClient) client).putRepository(request, listener);
client.putRepository(request, listener);
}
}

View File

@ -22,17 +22,16 @@ 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.internal.InternalClusterAdminClient;
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> {
public class ClusterRerouteRequestBuilder extends AcknowledgedRequestBuilder<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder, ClusterAdminClient> {
public ClusterRerouteRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new ClusterRerouteRequest());
super(clusterClient, new ClusterRerouteRequest());
}
/**
@ -72,6 +71,6 @@ public class ClusterRerouteRequestBuilder extends AcknowledgedRequestBuilder<Clu
@Override
protected void doExecute(ActionListener<ClusterRerouteResponse> listener) {
((ClusterAdminClient) client).reroute(request, listener);
client.reroute(request, listener);
}
}

View File

@ -22,7 +22,6 @@ 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.internal.InternalClusterAdminClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -30,10 +29,10 @@ import java.util.Map;
/**
* Builder for a cluster update settings request
*/
public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder> {
public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder, ClusterAdminClient> {
public ClusterUpdateSettingsRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new ClusterUpdateSettingsRequest());
super(clusterClient, new ClusterUpdateSettingsRequest());
}
/**
@ -102,6 +101,6 @@ public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuil
@Override
protected void doExecute(ActionListener<ClusterUpdateSettingsResponse> listener) {
((ClusterAdminClient) client).updateSettings(request, listener);
client.updateSettings(request, listener);
}
}

View File

@ -23,14 +23,13 @@ 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.internal.InternalClusterAdminClient;
/**
*/
public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder> {
public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder, ClusterAdminClient> {
public ClusterSearchShardsRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new ClusterSearchShardsRequest());
super(clusterClient, new ClusterSearchShardsRequest());
}
/**
@ -87,7 +86,7 @@ public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRe
@Override
protected void doExecute(ActionListener<ClusterSearchShardsResponse> listener) {
((ClusterAdminClient) client).searchShards(request, listener);
client.searchShards(request, listener);
}
}

View File

@ -23,7 +23,6 @@ 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.internal.InternalClusterAdminClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -31,7 +30,7 @@ import java.util.Map;
/**
* Create snapshot request builder
*/
public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder> {
public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder, ClusterAdminClient> {
/**
* Constructs a new create snapshot request builder
@ -39,7 +38,7 @@ public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
* @param clusterAdminClient cluster admin client
*/
public CreateSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) {
super((InternalClusterAdminClient) clusterAdminClient, new CreateSnapshotRequest());
super(clusterAdminClient, new CreateSnapshotRequest());
}
/**
@ -50,7 +49,7 @@ public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
* @param snapshot snapshot name
*/
public CreateSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String snapshot) {
super((InternalClusterAdminClient) clusterAdminClient, new CreateSnapshotRequest(repository, snapshot));
super(clusterAdminClient, new CreateSnapshotRequest(repository, snapshot));
}
/**
@ -188,6 +187,6 @@ public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
@Override
protected void doExecute(ActionListener<CreateSnapshotResponse> listener) {
((ClusterAdminClient) client).createSnapshot(request, listener);
client.createSnapshot(request, listener);
}
}

View File

@ -22,12 +22,11 @@ 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.internal.InternalClusterAdminClient;
/**
* Delete snapshot request builder
*/
public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder> {
public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder, ClusterAdminClient> {
/**
* Constructs delete snapshot request builder
@ -35,7 +34,7 @@ public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
* @param clusterAdminClient cluster admin client
*/
public DeleteSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) {
super((InternalClusterAdminClient) clusterAdminClient, new DeleteSnapshotRequest());
super(clusterAdminClient, new DeleteSnapshotRequest());
}
/**
@ -46,7 +45,7 @@ public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
* @param snapshot snapshot name
*/
public DeleteSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String snapshot) {
super((InternalClusterAdminClient) clusterAdminClient, new DeleteSnapshotRequest(repository, snapshot));
super(clusterAdminClient, new DeleteSnapshotRequest(repository, snapshot));
}
/**
@ -73,6 +72,6 @@ public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
@Override
protected void doExecute(ActionListener<DeleteSnapshotResponse> listener) {
((ClusterAdminClient) client).deleteSnapshot(request, listener);
client.deleteSnapshot(request, listener);
}
}

View File

@ -23,12 +23,11 @@ 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.internal.InternalClusterAdminClient;
/**
* Get snapshots request builder
*/
public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilder<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder> {
public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilder<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder, ClusterAdminClient> {
/**
* Constructs the new get snapshot request
@ -36,7 +35,7 @@ public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilde
* @param clusterAdminClient cluster admin client
*/
public GetSnapshotsRequestBuilder(ClusterAdminClient clusterAdminClient) {
super((InternalClusterAdminClient) clusterAdminClient, new GetSnapshotsRequest());
super(clusterAdminClient, new GetSnapshotsRequest());
}
/**
@ -46,7 +45,7 @@ public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilde
* @param repository repository name
*/
public GetSnapshotsRequestBuilder(ClusterAdminClient clusterAdminClient, String repository) {
super((InternalClusterAdminClient) clusterAdminClient, new GetSnapshotsRequest(repository));
super(clusterAdminClient, new GetSnapshotsRequest(repository));
}
/**
@ -84,6 +83,6 @@ public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilde
@Override
protected void doExecute(ActionListener<GetSnapshotsResponse> listener) {
((ClusterAdminClient) client).getSnapshots(request, listener);
client.getSnapshots(request, listener);
}
}

View File

@ -23,7 +23,6 @@ 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.internal.InternalClusterAdminClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -31,7 +30,7 @@ import java.util.Map;
/**
* Restore snapshot request builder
*/
public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder> {
public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder, ClusterAdminClient> {
/**
* Constructs new restore snapshot request builder
@ -39,7 +38,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
* @param clusterAdminClient cluster admin client
*/
public RestoreSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) {
super((InternalClusterAdminClient) clusterAdminClient, new RestoreSnapshotRequest());
super(clusterAdminClient, new RestoreSnapshotRequest());
}
/**
@ -50,7 +49,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
* @param name snapshot name
*/
public RestoreSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String name) {
super((InternalClusterAdminClient) clusterAdminClient, new RestoreSnapshotRequest(repository, name));
super(clusterAdminClient, new RestoreSnapshotRequest(repository, name));
}
@ -211,6 +210,6 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
@Override
protected void doExecute(ActionListener<RestoreSnapshotResponse> listener) {
((ClusterAdminClient) client).restoreSnapshot(request, listener);
client.restoreSnapshot(request, listener);
}
}

View File

@ -23,12 +23,11 @@ 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.internal.InternalClusterAdminClient;
/**
* Snapshots status request builder
*/
public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBuilder<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder> {
public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBuilder<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder, ClusterAdminClient> {
/**
* Constructs the new snapshotstatus request
@ -36,7 +35,7 @@ public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBui
* @param clusterAdminClient cluster admin client
*/
public SnapshotsStatusRequestBuilder(ClusterAdminClient clusterAdminClient) {
super((InternalClusterAdminClient) clusterAdminClient, new SnapshotsStatusRequest());
super(clusterAdminClient, new SnapshotsStatusRequest());
}
/**
@ -46,7 +45,7 @@ public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBui
* @param repository repository name
*/
public SnapshotsStatusRequestBuilder(ClusterAdminClient clusterAdminClient, String repository) {
super((InternalClusterAdminClient) clusterAdminClient, new SnapshotsStatusRequest(repository));
super(clusterAdminClient, new SnapshotsStatusRequest(repository));
}
/**
@ -84,6 +83,6 @@ public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBui
@Override
protected void doExecute(ActionListener<SnapshotsStatusResponse> listener) {
((ClusterAdminClient) client).snapshotsStatus(request, listener);
client.snapshotsStatus(request, listener);
}
}

View File

@ -22,15 +22,14 @@ package org.elasticsearch.action.admin.cluster.state;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
/**
*
*/
public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder> {
public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder, ClusterAdminClient> {
public ClusterStateRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new ClusterStateRequest());
super(clusterClient, new ClusterStateRequest());
}
/**
@ -92,6 +91,6 @@ public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBu
@Override
protected void doExecute(ActionListener<ClusterStateResponse> listener) {
((ClusterAdminClient) client).state(request, listener);
client.state(request, listener);
}
}

View File

@ -22,7 +22,6 @@ 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.internal.InternalClusterAdminClient;
/**
*
@ -30,11 +29,11 @@ import org.elasticsearch.client.internal.InternalClusterAdminClient;
public class ClusterStatsRequestBuilder extends NodesOperationRequestBuilder<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestBuilder> {
public ClusterStatsRequestBuilder(ClusterAdminClient clusterClient) {
super((InternalClusterAdminClient) clusterClient, new ClusterStatsRequest());
super(clusterClient, new ClusterStatsRequest());
}
@Override
protected void doExecute(ActionListener<ClusterStatsResponse> listener) {
((ClusterAdminClient) client).clusterStats(request, listener);
client.clusterStats(request, listener);
}
}

View File

@ -22,18 +22,17 @@ 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.internal.InternalClusterAdminClient;
/**
*/
public class PendingClusterTasksRequestBuilder extends MasterNodeReadOperationRequestBuilder<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder> {
public class PendingClusterTasksRequestBuilder extends MasterNodeReadOperationRequestBuilder<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder, ClusterAdminClient> {
public PendingClusterTasksRequestBuilder(ClusterAdminClient client) {
super((InternalClusterAdminClient) client, new PendingClusterTasksRequest());
super(client, new PendingClusterTasksRequest());
}
@Override
protected void doExecute(ActionListener<PendingClusterTasksResponse> listener) {
((InternalClusterAdminClient) client).pendingClusterTasks(request, listener);
client.pendingClusterTasks(request, listener);
}
}

View File

@ -19,21 +19,16 @@
package org.elasticsearch.action.admin.indices;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.GenericAction;
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>>
extends GenericAction<Request, Response> {
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);
}
public abstract RequestBuilder newRequestBuilder(IndicesAdminClient client);
}

View File

@ -23,7 +23,6 @@ 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.internal.InternalIndicesAdminClient;
import org.elasticsearch.cluster.metadata.AliasAction;
import org.elasticsearch.index.query.FilterBuilder;
@ -32,10 +31,10 @@ import java.util.Map;
/**
*
*/
public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder> {
public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder, IndicesAdminClient> {
public IndicesAliasesRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new IndicesAliasesRequest());
super(indicesClient, new IndicesAliasesRequest());
}
/**
@ -169,7 +168,7 @@ public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<Ind
@Override
protected void doExecute(ActionListener<IndicesAliasesResponse> listener) {
((IndicesAdminClient) client).aliases(request, listener);
client.aliases(request, listener);
}
/**

View File

@ -33,7 +33,7 @@ public class AliasesExistRequestBuilder extends BaseAliasesRequestBuilder<Aliase
@Override
protected void doExecute(ActionListener<AliasesExistResponse> listener) {
((IndicesAdminClient) client).aliasesExist(request, listener);
client.aliasesExist(request, listener);
}
}

View File

@ -24,14 +24,13 @@ import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
/**
*/
public abstract class BaseAliasesRequestBuilder<Response extends ActionResponse, Builder extends BaseAliasesRequestBuilder<Response, Builder>> extends MasterNodeReadOperationRequestBuilder<GetAliasesRequest, Response, Builder> {
public abstract class BaseAliasesRequestBuilder<Response extends ActionResponse, Builder extends BaseAliasesRequestBuilder<Response, Builder>> extends MasterNodeReadOperationRequestBuilder<GetAliasesRequest, Response, Builder, IndicesAdminClient> {
public BaseAliasesRequestBuilder(IndicesAdminClient client, String... aliases) {
super((InternalIndicesAdminClient) client, new GetAliasesRequest(aliases));
super(client, new GetAliasesRequest(aliases));
}
@SuppressWarnings("unchecked")

View File

@ -32,7 +32,7 @@ public class GetAliasesRequestBuilder extends BaseAliasesRequestBuilder<GetAlias
@Override
protected void doExecute(ActionListener<GetAliasesResponse> listener) {
((IndicesAdminClient) client).getAliases(request, listener);
client.getAliases(request, listener);
}
}

View File

@ -21,7 +21,6 @@ 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.internal.InternalIndicesAdminClient;
/**
*
@ -29,11 +28,11 @@ import org.elasticsearch.client.internal.InternalIndicesAdminClient;
public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<AnalyzeRequest, AnalyzeResponse, AnalyzeRequestBuilder> {
public AnalyzeRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new AnalyzeRequest());
super(indicesClient, new AnalyzeRequest());
}
public AnalyzeRequestBuilder(IndicesAdminClient indicesClient, String index, String text) {
super((InternalIndicesAdminClient) indicesClient, new AnalyzeRequest(index, text));
super(indicesClient, new AnalyzeRequest(index, text));
}
/**
@ -91,6 +90,6 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<A
@Override
protected void doExecute(ActionListener<AnalyzeResponse> listener) {
((IndicesAdminClient) client).analyze(request, listener);
client.analyze(request, listener);
}
}

View File

@ -21,16 +21,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.internal.InternalIndicesAdminClient;
/**
*
*/
public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBuilder<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder> {
public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBuilder<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder, IndicesAdminClient> {
public ClearIndicesCacheRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new ClearIndicesCacheRequest());
super(indicesClient, new ClearIndicesCacheRequest());
}
public ClearIndicesCacheRequestBuilder setFilterCache(boolean filterCache) {
@ -60,6 +60,6 @@ public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBu
@Override
protected void doExecute(ActionListener<ClearIndicesCacheResponse> listener) {
((IndicesAdminClient) client).clearCache(request, listener);
client.clearCache(request, listener);
}
}

View File

@ -23,19 +23,18 @@ 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.internal.InternalIndicesAdminClient;
/**
* Builder for close index request
*/
public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {
public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder, IndicesAdminClient> {
public CloseIndexRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new CloseIndexRequest());
super(indicesClient, new CloseIndexRequest());
}
public CloseIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super((InternalIndicesAdminClient) indicesClient, new CloseIndexRequest(indices));
super(indicesClient, new CloseIndexRequest(indices));
}
/**
@ -62,6 +61,6 @@ public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIn
@Override
protected void doExecute(ActionListener<CloseIndexResponse> listener) {
((IndicesAdminClient) client).close(request, listener);
client.close(request, listener);
}
}

View File

@ -23,7 +23,6 @@ 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.internal.InternalIndicesAdminClient;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
@ -34,14 +33,14 @@ import java.util.Map;
/**
* Builder for a create index request
*/
public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder> {
public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder, IndicesAdminClient> {
public CreateIndexRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new CreateIndexRequest());
super(indicesClient, new CreateIndexRequest());
}
public CreateIndexRequestBuilder(IndicesAdminClient indicesClient, String index) {
super((InternalIndicesAdminClient) indicesClient, new CreateIndexRequest(index));
super(indicesClient, new CreateIndexRequest(index));
}
/**
@ -248,6 +247,6 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<Create
@Override
protected void doExecute(ActionListener<CreateIndexResponse> listener) {
((IndicesAdminClient) client).create(request, listener);
client.create(request, listener);
}
}

View File

@ -23,16 +23,15 @@ 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.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
*
*/
public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder> {
public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder, IndicesAdminClient> {
public DeleteIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super((InternalIndicesAdminClient) indicesClient, new DeleteIndexRequest(indices));
super(indicesClient, new DeleteIndexRequest(indices));
}
/**
@ -65,6 +64,6 @@ public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder
@Override
protected void doExecute(ActionListener<DeleteIndexResponse> listener) {
((IndicesAdminClient) client).delete(request, listener);
client.delete(request, listener);
}
}

View File

@ -23,15 +23,14 @@ 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.internal.InternalIndicesAdminClient;
/**
*
*/
public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder> {
public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder, IndicesAdminClient> {
public IndicesExistsRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super((InternalIndicesAdminClient) indicesClient, new IndicesExistsRequest(indices));
super(indicesClient, new IndicesExistsRequest(indices));
}
public IndicesExistsRequestBuilder setIndices(String... indices) {
@ -51,6 +50,6 @@ public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestB
@Override
protected void doExecute(ActionListener<IndicesExistsResponse> listener) {
((IndicesAdminClient) client).exists(request, listener);
client.exists(request, listener);
}
}

View File

@ -22,23 +22,22 @@ 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.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.Strings;
/**
* A builder for {@link TypesExistsRequest}.
*/
public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder> {
public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder, IndicesAdminClient> {
/**
* @param indices What indices to check for types
*/
public TypesExistsRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super((InternalIndicesAdminClient) indicesClient, new TypesExistsRequest(indices, Strings.EMPTY_ARRAY));
super(indicesClient, new TypesExistsRequest(indices, Strings.EMPTY_ARRAY));
}
TypesExistsRequestBuilder(IndicesAdminClient client) {
super((InternalIndicesAdminClient) client, new TypesExistsRequest());
super(client, new TypesExistsRequest());
}
/**
@ -66,6 +65,6 @@ public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBui
}
protected void doExecute(ActionListener<TypesExistsResponse> listener) {
((IndicesAdminClient) client).typesExists(request, listener);
client.typesExists(request, listener);
}
}

View File

@ -22,15 +22,14 @@ 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.internal.InternalIndicesAdminClient;
/**
*
*/
public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushRequest, FlushResponse, FlushRequestBuilder> {
public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushRequest, FlushResponse, FlushRequestBuilder, IndicesAdminClient> {
public FlushRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new FlushRequest());
super(indicesClient, new FlushRequest());
}
public FlushRequestBuilder setFull(boolean full) {
@ -45,6 +44,6 @@ public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushR
@Override
protected void doExecute(ActionListener<FlushResponse> listener) {
((IndicesAdminClient) client).flush(request, listener);
client.flush(request, listener);
}
}

View File

@ -23,15 +23,14 @@ 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.internal.InternalIndicesAdminClient;
/**
* Builder for a delete mapping request
*/
public class DeleteMappingRequestBuilder extends AcknowledgedRequestBuilder<DeleteMappingRequest, DeleteMappingResponse, DeleteMappingRequestBuilder> {
public class DeleteMappingRequestBuilder extends AcknowledgedRequestBuilder<DeleteMappingRequest, DeleteMappingResponse, DeleteMappingRequestBuilder, IndicesAdminClient> {
public DeleteMappingRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new DeleteMappingRequest());
super(indicesClient, new DeleteMappingRequest());
}
/**
@ -62,6 +61,6 @@ public class DeleteMappingRequestBuilder extends AcknowledgedRequestBuilder<Dele
@Override
protected void doExecute(ActionListener<DeleteMappingResponse> listener) {
((IndicesAdminClient) client).deleteMapping(request, listener);
client.deleteMapping(request, listener);
}
}

View File

@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalGenericClient;
/**
*/
@ -36,7 +35,7 @@ public class GetFieldMappingsAction extends IndicesAction<GetFieldMappingsReques
@Override
public GetFieldMappingsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetFieldMappingsRequestBuilder((InternalGenericClient) client);
return new GetFieldMappingsRequestBuilder(client);
}
@Override

View File

@ -24,12 +24,11 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalGenericClient;
/** A helper class to build {@link GetFieldMappingsRequest} objects */
public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder> {
public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder, IndicesAdminClient> {
public GetFieldMappingsRequestBuilder(InternalGenericClient client, String... indices) {
public GetFieldMappingsRequestBuilder(IndicesAdminClient client, String... indices) {
super(client, new GetFieldMappingsRequest().indices(indices));
}
@ -74,6 +73,6 @@ public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFiel
@Override
protected void doExecute(ActionListener<GetFieldMappingsResponse> listener) {
((IndicesAdminClient) client).getFieldMappings(request, listener);
client.getFieldMappings(request, listener);
}
}

View File

@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalGenericClient;
/**
*/
@ -36,7 +35,7 @@ public class GetMappingsAction extends IndicesAction<GetMappingsRequest, GetMapp
@Override
public GetMappingsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetMappingsRequestBuilder((InternalGenericClient) client);
return new GetMappingsRequestBuilder(client);
}
@Override

View File

@ -22,18 +22,17 @@ 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.internal.InternalGenericClient;
/**
*/
public class GetMappingsRequestBuilder extends ClusterInfoRequestBuilder<GetMappingsRequest, GetMappingsResponse, GetMappingsRequestBuilder> {
public GetMappingsRequestBuilder(InternalGenericClient client, String... indices) {
public GetMappingsRequestBuilder(IndicesAdminClient client, String... indices) {
super(client, new GetMappingsRequest().indices(indices));
}
@Override
protected void doExecute(ActionListener<GetMappingsResponse> listener) {
((IndicesAdminClient) client).getMappings(request, listener);
client.getMappings(request, listener);
}
}

View File

@ -23,7 +23,6 @@ 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.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.xcontent.XContentBuilder;
import java.util.Map;
@ -31,10 +30,10 @@ import java.util.Map;
/**
* Builder for a put mapping request
*/
public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder> {
public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder, IndicesAdminClient> {
public PutMappingRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new PutMappingRequest());
super(indicesClient, new PutMappingRequest());
}
public PutMappingRequestBuilder setIndices(String... indices) {
@ -105,6 +104,6 @@ public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMapp
@Override
protected void doExecute(ActionListener<PutMappingResponse> listener) {
((IndicesAdminClient) client).putMapping(request, listener);
client.putMapping(request, listener);
}
}

View File

@ -23,19 +23,18 @@ 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.internal.InternalIndicesAdminClient;
/**
* Builder for for open index request
*/
public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder> {
public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder, IndicesAdminClient> {
public OpenIndexRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new OpenIndexRequest());
super(indicesClient, new OpenIndexRequest());
}
public OpenIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super((InternalIndicesAdminClient) indicesClient, new OpenIndexRequest(indices));
super(indicesClient, new OpenIndexRequest(indices));
}
/**
@ -62,6 +61,6 @@ public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenInde
@Override
protected void doExecute(ActionListener<OpenIndexResponse> listener) {
((IndicesAdminClient) client).open(request, listener);
client.open(request, listener);
}
}

View File

@ -22,7 +22,6 @@ 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.internal.InternalIndicesAdminClient;
/**
* A request to optimize one or more indices. In order to optimize on all the indices, pass an empty array or
@ -34,10 +33,10 @@ import org.elasticsearch.client.internal.InternalIndicesAdminClient;
* <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> {
public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder, IndicesAdminClient> {
public OptimizeRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new OptimizeRequest());
super(indicesClient, new OptimizeRequest());
}
/**
@ -85,6 +84,6 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<Opt
@Override
protected void doExecute(ActionListener<OptimizeResponse> listener) {
((IndicesAdminClient) client).optimize(request, listener);
client.optimize(request, listener);
}
}

View File

@ -22,12 +22,11 @@ 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.internal.InternalIndicesAdminClient;
/**
* Recovery information request builder.
*/
public class RecoveryRequestBuilder extends BroadcastOperationRequestBuilder<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder> {
public class RecoveryRequestBuilder extends BroadcastOperationRequestBuilder<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder, IndicesAdminClient> {
/**
* Constructs a new recovery information request builder.
@ -35,12 +34,12 @@ public class RecoveryRequestBuilder extends BroadcastOperationRequestBuilder<Rec
* @param indicesClient Indices admin client
*/
public RecoveryRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new RecoveryRequest());
super(indicesClient, new RecoveryRequest());
}
@Override
protected void doExecute(ActionListener<RecoveryResponse> listener) {
((IndicesAdminClient) client).recoveries(request, listener);
client.recoveries(request, listener);
}
public RecoveryRequestBuilder setDetailed(boolean detailed) {

View File

@ -22,17 +22,16 @@ 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.internal.InternalIndicesAdminClient;
/**
* 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> {
public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<RefreshRequest, RefreshResponse, RefreshRequestBuilder, IndicesAdminClient> {
public RefreshRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new RefreshRequest());
super(indicesClient, new RefreshRequest());
}
/**
@ -46,6 +45,6 @@ public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<Refr
@Override
protected void doExecute(ActionListener<RefreshResponse> listener) {
((IndicesAdminClient) client).refresh(request, listener);
client.refresh(request, listener);
}
}

View File

@ -22,19 +22,18 @@ 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.internal.InternalIndicesAdminClient;
/**
*
*/
public class IndicesSegmentsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder> {
public class IndicesSegmentsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder, IndicesAdminClient> {
public IndicesSegmentsRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new IndicesSegmentsRequest());
super(indicesClient, new IndicesSegmentsRequest());
}
@Override
protected void doExecute(ActionListener<IndicesSegmentResponse> listener) {
((IndicesAdminClient) client).segments(request, listener);
client.segments(request, listener);
}
}

View File

@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.indices.settings.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalGenericClient;
/**
*/
@ -36,7 +35,7 @@ public class GetSettingsAction extends IndicesAction<GetSettingsRequest, GetSett
@Override
public GetSettingsRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetSettingsRequestBuilder((InternalGenericClient) client);
return new GetSettingsRequestBuilder(client);
}
@Override

View File

@ -24,13 +24,12 @@ 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.internal.InternalGenericClient;
/**
*/
public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder> {
public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder, IndicesAdminClient> {
public GetSettingsRequestBuilder(InternalGenericClient client, String... indices) {
public GetSettingsRequestBuilder(IndicesAdminClient client, String... indices) {
super(client, new GetSettingsRequest().indices(indices));
}
@ -61,6 +60,6 @@ public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBui
@Override
protected void doExecute(ActionListener<GetSettingsResponse> listener) {
((IndicesAdminClient) client).getSettings(request, listener);
client.getSettings(request, listener);
}
}

View File

@ -23,7 +23,6 @@ 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.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.settings.Settings;
import java.util.Map;
@ -31,10 +30,10 @@ import java.util.Map;
/**
* Builder for an update index settings request
*/
public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder> {
public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder, IndicesAdminClient> {
public UpdateSettingsRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
super((InternalIndicesAdminClient) indicesClient, new UpdateSettingsRequest(indices));
super(indicesClient, new UpdateSettingsRequest(indices));
}
/**
@ -89,6 +88,6 @@ public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<Upd
@Override
protected void doExecute(ActionListener<UpdateSettingsResponse> listener) {
((IndicesAdminClient) client).updateSettings(request, listener);
client.updateSettings(request, listener);
}
}

View File

@ -22,7 +22,6 @@ 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.internal.InternalIndicesAdminClient;
/**
* A request to get indices level stats. Allow to enable different stats to be returned.
@ -33,10 +32,10 @@ import org.elasticsearch.client.internal.InternalIndicesAdminClient;
* <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> {
public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder, IndicesAdminClient> {
public IndicesStatsRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new IndicesStatsRequest());
super(indicesClient, new IndicesStatsRequest());
}
/**
@ -166,6 +165,6 @@ public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder
@Override
protected void doExecute(ActionListener<IndicesStatsResponse> listener) {
((IndicesAdminClient) client).stats(request, listener);
client.stats(request, listener);
}
}

View File

@ -21,23 +21,22 @@ 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.internal.InternalIndicesAdminClient;
/**
*
*/
public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder> {
public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder, IndicesAdminClient> {
public DeleteIndexTemplateRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new DeleteIndexTemplateRequest());
super(indicesClient, new DeleteIndexTemplateRequest());
}
public DeleteIndexTemplateRequestBuilder(IndicesAdminClient indicesClient, String name) {
super((InternalIndicesAdminClient) indicesClient, new DeleteIndexTemplateRequest(name));
super(indicesClient, new DeleteIndexTemplateRequest(name));
}
@Override
protected void doExecute(ActionListener<DeleteIndexTemplateResponse> listener) {
((IndicesAdminClient) client).deleteTemplate(request, listener);
client.deleteTemplate(request, listener);
}
}

View File

@ -21,23 +21,22 @@ 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.internal.InternalIndicesAdminClient;
/**
*
*/
public class GetIndexTemplatesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder> {
public class GetIndexTemplatesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder, IndicesAdminClient> {
public GetIndexTemplatesRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new GetIndexTemplatesRequest());
super(indicesClient, new GetIndexTemplatesRequest());
}
public GetIndexTemplatesRequestBuilder(IndicesAdminClient indicesClient, String... names) {
super((InternalIndicesAdminClient) indicesClient, new GetIndexTemplatesRequest(names));
super(indicesClient, new GetIndexTemplatesRequest(names));
}
@Override
protected void doExecute(ActionListener<GetIndexTemplatesResponse> listener) {
((IndicesAdminClient) client).getTemplates(request, listener);
client.getTemplates(request, listener);
}
}

View File

@ -22,7 +22,6 @@ 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.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -32,14 +31,14 @@ import java.util.Map;
/**
*
*/
public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder> {
public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder, IndicesAdminClient> {
public PutIndexTemplateRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new PutIndexTemplateRequest());
super(indicesClient, new PutIndexTemplateRequest());
}
public PutIndexTemplateRequestBuilder(IndicesAdminClient indicesClient, String name) {
super((InternalIndicesAdminClient) indicesClient, new PutIndexTemplateRequest(name));
super(indicesClient, new PutIndexTemplateRequest(name));
}
/**
@ -233,6 +232,6 @@ public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBu
@Override
protected void doExecute(ActionListener<PutIndexTemplateResponse> listener) {
((IndicesAdminClient) client).putTemplate(request, listener);
client.putTemplate(request, listener);
}
}

View File

@ -23,19 +23,18 @@ 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.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.index.query.QueryBuilder;
/**
*
*/
public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilder<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder> {
public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilder<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder, IndicesAdminClient> {
private QuerySourceBuilder sourceBuilder;
public ValidateQueryRequestBuilder(IndicesAdminClient client) {
super((InternalIndicesAdminClient) client, new ValidateQueryRequest());
super(client, new ValidateQueryRequest());
}
/**
@ -102,7 +101,7 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
request.source(sourceBuilder);
}
((IndicesAdminClient) client).validateQuery(request, listener);
client.validateQuery(request, listener);
}
private QuerySourceBuilder sourceBuilder() {

View File

@ -23,15 +23,14 @@ 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.internal.InternalIndicesAdminClient;
/**
*
*/
public class DeleteWarmerRequestBuilder extends AcknowledgedRequestBuilder<DeleteWarmerRequest, DeleteWarmerResponse, DeleteWarmerRequestBuilder> {
public class DeleteWarmerRequestBuilder extends AcknowledgedRequestBuilder<DeleteWarmerRequest, DeleteWarmerResponse, DeleteWarmerRequestBuilder, IndicesAdminClient> {
public DeleteWarmerRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new DeleteWarmerRequest());
super(indicesClient, new DeleteWarmerRequest());
}
public DeleteWarmerRequestBuilder setIndices(String... indices) {
@ -60,6 +59,6 @@ public class DeleteWarmerRequestBuilder extends AcknowledgedRequestBuilder<Delet
@Override
protected void doExecute(ActionListener<DeleteWarmerResponse> listener) {
((IndicesAdminClient) client).deleteWarmer(request, listener);
client.deleteWarmer(request, listener);
}
}

View File

@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.indices.warmer.get;
import org.elasticsearch.action.admin.indices.IndicesAction;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalGenericClient;
/**
*/
@ -36,7 +35,7 @@ public class GetWarmersAction extends IndicesAction<GetWarmersRequest, GetWarmer
@Override
public GetWarmersRequestBuilder newRequestBuilder(IndicesAdminClient client) {
return new GetWarmersRequestBuilder((InternalGenericClient) client);
return new GetWarmersRequestBuilder(client);
}
@Override

View File

@ -23,13 +23,12 @@ import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalGenericClient;
/**
*/
public class GetWarmersRequestBuilder extends ClusterInfoRequestBuilder<GetWarmersRequest, GetWarmersResponse, GetWarmersRequestBuilder> {
public GetWarmersRequestBuilder(InternalGenericClient client, String... indices) {
public GetWarmersRequestBuilder(IndicesAdminClient client, String... indices) {
super(client, new GetWarmersRequest().indices(indices));
}
@ -45,6 +44,6 @@ public class GetWarmersRequestBuilder extends ClusterInfoRequestBuilder<GetWarme
@Override
protected void doExecute(ActionListener<GetWarmersResponse> listener) {
((IndicesAdminClient) client).getWarmers(request, listener);
client.getWarmers(request, listener);
}
}

View File

@ -24,19 +24,18 @@ import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
/**
*
*/
public class PutWarmerRequestBuilder extends AcknowledgedRequestBuilder<PutWarmerRequest, PutWarmerResponse, PutWarmerRequestBuilder> {
public class PutWarmerRequestBuilder extends AcknowledgedRequestBuilder<PutWarmerRequest, PutWarmerResponse, PutWarmerRequestBuilder, IndicesAdminClient> {
public PutWarmerRequestBuilder(IndicesAdminClient indicesClient, String name) {
super((InternalIndicesAdminClient) indicesClient, new PutWarmerRequest().name(name));
super(indicesClient, new PutWarmerRequest().name(name));
}
public PutWarmerRequestBuilder(IndicesAdminClient indicesClient) {
super((InternalIndicesAdminClient) indicesClient, new PutWarmerRequest());
super(indicesClient, new PutWarmerRequest());
}
/**
@ -65,6 +64,6 @@ public class PutWarmerRequestBuilder extends AcknowledgedRequestBuilder<PutWarme
@Override
protected void doExecute(ActionListener<PutWarmerResponse> listener) {
((IndicesAdminClient) client).putWarmer(request, listener);
client.putWarmer(request, listener);
}
}

View File

@ -20,12 +20,13 @@
package org.elasticsearch.action.bench;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
* Abort benchmark action
*/
public class AbortBenchmarkAction extends Action<AbortBenchmarkRequest, AbortBenchmarkResponse, AbortBenchmarkRequestBuilder> {
public class AbortBenchmarkAction extends ClientAction<AbortBenchmarkRequest, AbortBenchmarkResponse, AbortBenchmarkRequestBuilder> {
public static final AbortBenchmarkAction INSTANCE = new AbortBenchmarkAction();
public static final String NAME = "benchmark/abort";

View File

@ -22,15 +22,14 @@ package org.elasticsearch.action.bench;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
/**
* Request builder for aborting a benchmark
*/
public class AbortBenchmarkRequestBuilder extends ActionRequestBuilder<AbortBenchmarkRequest, AbortBenchmarkResponse, AbortBenchmarkRequestBuilder> {
public class AbortBenchmarkRequestBuilder extends ActionRequestBuilder<AbortBenchmarkRequest, AbortBenchmarkResponse, AbortBenchmarkRequestBuilder, Client> {
public AbortBenchmarkRequestBuilder(Client client) {
super((InternalClient) client, new AbortBenchmarkRequest());
super(client, new AbortBenchmarkRequest());
}
public AbortBenchmarkRequestBuilder setBenchmarkNames(String... benchmarkNames) {
@ -40,7 +39,7 @@ public class AbortBenchmarkRequestBuilder extends ActionRequestBuilder<AbortBenc
@Override
protected void doExecute(ActionListener<AbortBenchmarkResponse> listener) {
((Client) client).abortBench(request, listener);
client.abortBench(request, listener);
}
}

View File

@ -19,13 +19,14 @@
package org.elasticsearch.action.bench;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.Strings;
/**
* Benchmark action
*/
public class BenchmarkAction extends Action<BenchmarkRequest, BenchmarkResponse, BenchmarkRequestBuilder> {
public class BenchmarkAction extends ClientAction<BenchmarkRequest, BenchmarkResponse, BenchmarkRequestBuilder> {
public static final BenchmarkAction INSTANCE = new BenchmarkAction();
public static final String NAME = "benchmark/start";

View File

@ -23,19 +23,18 @@ import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
/**
* Request builder for benchmarks
*/
public class BenchmarkRequestBuilder extends ActionRequestBuilder<BenchmarkRequest, BenchmarkResponse, BenchmarkRequestBuilder> {
public class BenchmarkRequestBuilder extends ActionRequestBuilder<BenchmarkRequest, BenchmarkResponse, BenchmarkRequestBuilder, Client> {
public BenchmarkRequestBuilder(Client client, String[] indices) {
super((InternalClient) client, new BenchmarkRequest(indices));
super(client, new BenchmarkRequest(indices));
}
public BenchmarkRequestBuilder(Client client) {
super((InternalClient) client, new BenchmarkRequest());
super(client, new BenchmarkRequest());
}
public BenchmarkRequestBuilder setAllowCacheClearing(boolean allowCacheClearing) {
@ -114,6 +113,6 @@ public class BenchmarkRequestBuilder extends ActionRequestBuilder<BenchmarkReque
@Override
protected void doExecute(ActionListener<BenchmarkResponse> listener) {
((Client) client).bench(request, listener);
client.bench(request, listener);
}
}

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.bench;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
* Benchmark status action
*/
public class BenchmarkStatusAction extends Action<BenchmarkStatusRequest, BenchmarkStatusResponse, BenchmarkStatusRequestBuilder> {
public class BenchmarkStatusAction extends ClientAction<BenchmarkStatusRequest, BenchmarkStatusResponse, BenchmarkStatusRequestBuilder> {
public static final BenchmarkStatusAction INSTANCE = new BenchmarkStatusAction();
public static final String NAME = "benchmark/status";

View File

@ -20,21 +20,20 @@
package org.elasticsearch.action.bench;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
/**
* Request builder for benchmark status
*/
public class BenchmarkStatusRequestBuilder extends ActionRequestBuilder<BenchmarkStatusRequest, BenchmarkStatusResponse, BenchmarkStatusRequestBuilder> {
public class BenchmarkStatusRequestBuilder extends ActionRequestBuilder<BenchmarkStatusRequest, BenchmarkStatusResponse, BenchmarkStatusRequestBuilder, Client> {
public BenchmarkStatusRequestBuilder(Client client) {
super((InternalClient) client, new BenchmarkStatusRequest());
super(client, new BenchmarkStatusRequest());
}
@Override
protected void doExecute(ActionListener<BenchmarkStatusResponse> listener) {
((Client) client).benchStatus(request, listener);
client.benchStatus(request, listener);
}
}

View File

@ -20,13 +20,14 @@
package org.elasticsearch.action.bulk;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.transport.TransportRequestOptions;
/**
*/
public class BulkAction extends Action<BulkRequest, BulkResponse, BulkRequestBuilder> {
public class BulkAction extends ClientAction<BulkRequest, BulkResponse, BulkRequestBuilder> {
public static final BulkAction INSTANCE = new BulkAction();
public static final String NAME = "bulk";

View File

@ -25,7 +25,6 @@ import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.unit.ByteSizeUnit;
@ -182,7 +181,7 @@ public class BulkProcessor implements Closeable {
this.flushInterval = flushInterval;
if (flushInterval != null) {
this.scheduler = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(1, EsExecutors.daemonThreadFactory(((InternalClient) client).settings(), (name != null ? "[" + name + "]" : "") + "bulk_processor"));
this.scheduler = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(1, EsExecutors.daemonThreadFactory(client.settings(), (name != null ? "[" + name + "]" : "") + "bulk_processor"));
this.scheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
this.scheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
this.scheduledFuture = this.scheduler.scheduleWithFixedDelay(new Flush(), flushInterval.millis(), flushInterval.millis(), TimeUnit.MILLISECONDS);

View File

@ -30,7 +30,6 @@ import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.unit.TimeValue;
@ -38,10 +37,10 @@ import org.elasticsearch.common.unit.TimeValue;
* A bulk request holds an ordered {@link IndexRequest}s and {@link DeleteRequest}s and allows to executes
* it in a single batch.
*/
public class BulkRequestBuilder extends ActionRequestBuilder<BulkRequest, BulkResponse, BulkRequestBuilder> {
public class BulkRequestBuilder extends ActionRequestBuilder<BulkRequest, BulkResponse, BulkRequestBuilder, Client> {
public BulkRequestBuilder(Client client) {
super((InternalClient) client, new BulkRequest());
super(client, new BulkRequest());
}
/**
@ -162,6 +161,6 @@ public class BulkRequestBuilder extends ActionRequestBuilder<BulkRequest, BulkRe
@Override
protected void doExecute(ActionListener<BulkResponse> listener) {
((Client) client).bulk(request, listener);
client.bulk(request, listener);
}
}

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.count;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class CountAction extends Action<CountRequest, CountResponse, CountRequestBuilder> {
public class CountAction extends ClientAction<CountRequest, CountResponse, CountRequestBuilder> {
public static final CountAction INSTANCE = new CountAction();
public static final String NAME = "count";

View File

@ -23,19 +23,18 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.QuerySourceBuilder;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.index.query.QueryBuilder;
/**
* A count action request builder.
*/
public class CountRequestBuilder extends BroadcastOperationRequestBuilder<CountRequest, CountResponse, CountRequestBuilder> {
public class CountRequestBuilder extends BroadcastOperationRequestBuilder<CountRequest, CountResponse, CountRequestBuilder, Client> {
private QuerySourceBuilder sourceBuilder;
public CountRequestBuilder(Client client) {
super((InternalClient) client, new CountRequest());
super(client, new CountRequest());
}
/**
@ -122,7 +121,7 @@ public class CountRequestBuilder extends BroadcastOperationRequestBuilder<CountR
request.source(sourceBuilder);
}
((InternalClient) client).count(request, listener);
client.count(request, listener);
}
private QuerySourceBuilder sourceBuilder() {

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.delete;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class DeleteAction extends Action<DeleteRequest, DeleteResponse, DeleteRequestBuilder> {
public class DeleteAction extends ClientAction<DeleteRequest, DeleteResponse, DeleteRequestBuilder> {
public static final DeleteAction INSTANCE = new DeleteAction();
public static final String NAME = "delete";

View File

@ -24,7 +24,6 @@ import org.elasticsearch.action.WriteConsistencyLevel;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.action.support.replication.ShardReplicationOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.index.VersionType;
@ -34,11 +33,11 @@ import org.elasticsearch.index.VersionType;
public class DeleteRequestBuilder extends ShardReplicationOperationRequestBuilder<DeleteRequest, DeleteResponse, DeleteRequestBuilder> {
public DeleteRequestBuilder(Client client) {
super((InternalClient) client, new DeleteRequest());
super(client, new DeleteRequest());
}
public DeleteRequestBuilder(Client client, @Nullable String index) {
super((InternalClient) client, new DeleteRequest(index));
super(client, new DeleteRequest(index));
}
/**
@ -120,6 +119,6 @@ public class DeleteRequestBuilder extends ShardReplicationOperationRequestBuilde
@Override
protected void doExecute(ActionListener<DeleteResponse> listener) {
((Client) client).delete(request, listener);
client.delete(request, listener);
}
}

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.deletebyquery;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class DeleteByQueryAction extends Action<DeleteByQueryRequest, DeleteByQueryResponse, DeleteByQueryRequestBuilder> {
public class DeleteByQueryAction extends ClientAction<DeleteByQueryRequest, DeleteByQueryResponse, DeleteByQueryRequestBuilder> {
public static final DeleteByQueryAction INSTANCE = new DeleteByQueryAction();
public static final String NAME = "deleteByQuery";

View File

@ -25,7 +25,6 @@ import org.elasticsearch.action.support.QuerySourceBuilder;
import org.elasticsearch.action.support.replication.IndicesReplicationOperationRequestBuilder;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilder;
@ -40,7 +39,7 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ
private QuerySourceBuilder sourceBuilder;
public DeleteByQueryRequestBuilder(Client client) {
super((InternalClient) client, new DeleteByQueryRequest());
super(client, new DeleteByQueryRequest());
}
/**
@ -162,7 +161,7 @@ public class DeleteByQueryRequestBuilder extends IndicesReplicationOperationRequ
request.source(sourceBuilder);
}
((Client) client).deleteByQuery(request, listener);
client.deleteByQuery(request, listener);
}
private QuerySourceBuilder sourceBuilder() {

View File

@ -20,12 +20,13 @@
package org.elasticsearch.action.explain;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
* Entry point for the explain feature.
*/
public class ExplainAction extends Action<ExplainRequest, ExplainResponse, ExplainRequestBuilder> {
public class ExplainAction extends ClientAction<ExplainRequest, ExplainResponse, ExplainRequestBuilder> {
public static final ExplainAction INSTANCE = new ExplainAction();
public static final String NAME = "explain";

View File

@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.QuerySourceBuilder;
import org.elasticsearch.action.support.single.shard.SingleShardOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
@ -38,11 +37,11 @@ public class ExplainRequestBuilder extends SingleShardOperationRequestBuilder<Ex
private QuerySourceBuilder sourceBuilder;
ExplainRequestBuilder(Client client) {
super((InternalClient) client, new ExplainRequest());
super(client, new ExplainRequest());
}
public ExplainRequestBuilder(Client client, String index, String type, String id) {
super((InternalClient) client, new ExplainRequest().index(index).type(type).id(id));
super(client, new ExplainRequest().index(index).type(type).id(id));
}
/**
@ -181,7 +180,7 @@ public class ExplainRequestBuilder extends SingleShardOperationRequestBuilder<Ex
request.source(sourceBuilder);
}
((Client) client).explain(request, listener);
client.explain(request, listener);
}
private QuerySourceBuilder sourceBuilder() {

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.get;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class GetAction extends Action<GetRequest, GetResponse, GetRequestBuilder> {
public class GetAction extends ClientAction<GetRequest, GetResponse, GetRequestBuilder> {
public static final GetAction INSTANCE = new GetAction();
public static final String NAME = "get";

View File

@ -22,7 +22,6 @@ package org.elasticsearch.action.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.single.shard.SingleShardOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.common.Strings;
@ -34,11 +33,11 @@ import org.elasticsearch.search.fetch.source.FetchSourceContext;
public class GetRequestBuilder extends SingleShardOperationRequestBuilder<GetRequest, GetResponse, GetRequestBuilder> {
public GetRequestBuilder(Client client) {
super((InternalClient) client, new GetRequest());
super(client, new GetRequest());
}
public GetRequestBuilder(Client client, @Nullable String index) {
super((InternalClient) client, new GetRequest(index));
super(client, new GetRequest(index));
}
/**
@ -179,7 +178,7 @@ public class GetRequestBuilder extends SingleShardOperationRequestBuilder<GetReq
@Override
protected void doExecute(ActionListener<GetResponse> listener) {
((Client) client).get(request, listener);
client.get(request, listener);
}

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.get;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class MultiGetAction extends Action<MultiGetRequest, MultiGetResponse, MultiGetRequestBuilder> {
public class MultiGetAction extends ClientAction<MultiGetRequest, MultiGetResponse, MultiGetRequestBuilder> {
public static final MultiGetAction INSTANCE = new MultiGetAction();
public static final String NAME = "mget";

View File

@ -22,16 +22,15 @@ package org.elasticsearch.action.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Nullable;
/**
* A multi get document action request builder.
*/
public class MultiGetRequestBuilder extends ActionRequestBuilder<MultiGetRequest, MultiGetResponse, MultiGetRequestBuilder> {
public class MultiGetRequestBuilder extends ActionRequestBuilder<MultiGetRequest, MultiGetResponse, MultiGetRequestBuilder, Client> {
public MultiGetRequestBuilder(Client client) {
super((InternalClient) client, new MultiGetRequest());
super(client, new MultiGetRequest());
}
public MultiGetRequestBuilder add(String index, @Nullable String type, String id) {
@ -85,6 +84,6 @@ public class MultiGetRequestBuilder extends ActionRequestBuilder<MultiGetRequest
@Override
protected void doExecute(ActionListener<MultiGetResponse> listener) {
((Client) client).multiGet(request, listener);
client.multiGet(request, listener);
}
}

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.index;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class IndexAction extends Action<IndexRequest, IndexResponse, IndexRequestBuilder> {
public class IndexAction extends ClientAction<IndexRequest, IndexResponse, IndexRequestBuilder> {
public static final IndexAction INSTANCE = new IndexAction();
public static final String NAME = "index";

View File

@ -24,7 +24,6 @@ import org.elasticsearch.action.WriteConsistencyLevel;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.action.support.replication.ShardReplicationOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -39,11 +38,11 @@ import java.util.Map;
public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder<IndexRequest, IndexResponse, IndexRequestBuilder> {
public IndexRequestBuilder(Client client) {
super((InternalClient) client, new IndexRequest());
super(client, new IndexRequest());
}
public IndexRequestBuilder(Client client, @Nullable String index) {
super((InternalClient) client, new IndexRequest(index));
super(client, new IndexRequest(index));
}
/**
@ -311,6 +310,6 @@ public class IndexRequestBuilder extends ShardReplicationOperationRequestBuilder
@Override
protected void doExecute(ActionListener<IndexResponse> listener) {
((Client) client).index(request, listener);
client.index(request, listener);
}
}

View File

@ -20,12 +20,13 @@
package org.elasticsearch.action.mlt;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
/**
*/
public class MoreLikeThisAction extends Action<MoreLikeThisRequest, SearchResponse, MoreLikeThisRequestBuilder> {
public class MoreLikeThisAction extends ClientAction<MoreLikeThisRequest, SearchResponse, MoreLikeThisRequestBuilder> {
public static final MoreLikeThisAction INSTANCE = new MoreLikeThisAction();
public static final String NAME = "mlt";

View File

@ -25,7 +25,6 @@ import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.Scroll;
import org.elasticsearch.search.builder.SearchSourceBuilder;
@ -34,14 +33,14 @@ import java.util.Map;
/**
*/
public class MoreLikeThisRequestBuilder extends ActionRequestBuilder<MoreLikeThisRequest, SearchResponse, MoreLikeThisRequestBuilder> {
public class MoreLikeThisRequestBuilder extends ActionRequestBuilder<MoreLikeThisRequest, SearchResponse, MoreLikeThisRequestBuilder, Client> {
public MoreLikeThisRequestBuilder(Client client) {
super((InternalClient) client, new MoreLikeThisRequest());
super(client, new MoreLikeThisRequest());
}
public MoreLikeThisRequestBuilder(Client client, String index, String type, String id) {
super((InternalClient) client, new MoreLikeThisRequest(index).type(type).id(id));
super(client, new MoreLikeThisRequest(index).type(type).id(id));
}
/**
@ -255,6 +254,6 @@ public class MoreLikeThisRequestBuilder extends ActionRequestBuilder<MoreLikeThi
@Override
protected void doExecute(ActionListener<SearchResponse> listener) {
((Client) client).moreLikeThis(request, listener);
client.moreLikeThis(request, listener);
}
}

View File

@ -19,11 +19,12 @@
package org.elasticsearch.action.percolate;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class MultiPercolateAction extends Action<MultiPercolateRequest, MultiPercolateResponse, MultiPercolateRequestBuilder> {
public class MultiPercolateAction extends ClientAction<MultiPercolateRequest, MultiPercolateResponse, MultiPercolateRequestBuilder> {
public static final MultiPercolateAction INSTANCE = new MultiPercolateAction();
public static final String NAME = "mpercolate";

View File

@ -22,14 +22,13 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
/**
*/
public class MultiPercolateRequestBuilder extends ActionRequestBuilder<MultiPercolateRequest, MultiPercolateResponse, MultiPercolateRequestBuilder> {
public class MultiPercolateRequestBuilder extends ActionRequestBuilder<MultiPercolateRequest, MultiPercolateResponse, MultiPercolateRequestBuilder, Client> {
public MultiPercolateRequestBuilder(Client client) {
super((InternalClient) client, new MultiPercolateRequest());
super(client, new MultiPercolateRequest());
}
/**
@ -60,6 +59,6 @@ public class MultiPercolateRequestBuilder extends ActionRequestBuilder<MultiPerc
@Override
protected void doExecute(ActionListener<MultiPercolateResponse> listener) {
((Client) client).multiPercolate(request, listener);
client.multiPercolate(request, listener);
}
}

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.percolate;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class PercolateAction extends Action<PercolateRequest, PercolateResponse, PercolateRequestBuilder> {
public class PercolateAction extends ClientAction<PercolateRequest, PercolateResponse, PercolateRequestBuilder> {
public static final PercolateAction INSTANCE = new PercolateAction();
public static final String NAME = "percolate";

View File

@ -22,7 +22,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -39,12 +38,12 @@ import java.util.Map;
/**
*
*/
public class PercolateRequestBuilder extends BroadcastOperationRequestBuilder<PercolateRequest, PercolateResponse, PercolateRequestBuilder> {
public class PercolateRequestBuilder extends BroadcastOperationRequestBuilder<PercolateRequest, PercolateResponse, PercolateRequestBuilder, Client> {
private PercolateSourceBuilder sourceBuilder;
public PercolateRequestBuilder(Client client) {
super((InternalClient) client, new PercolateRequest());
super(client, new PercolateRequest());
}
/**
@ -254,7 +253,7 @@ public class PercolateRequestBuilder extends BroadcastOperationRequestBuilder<Pe
if (sourceBuilder != null) {
request.source(sourceBuilder);
}
((Client) client).percolate(request, listener);
client.percolate(request, listener);
}
}

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.search;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class ClearScrollAction extends Action<ClearScrollRequest, ClearScrollResponse, ClearScrollRequestBuilder> {
public class ClearScrollAction extends ClientAction<ClearScrollRequest, ClearScrollResponse, ClearScrollRequestBuilder> {
public static final ClearScrollAction INSTANCE = new ClearScrollAction();
public static final String NAME = "clear_sc";

View File

@ -22,16 +22,15 @@ package org.elasticsearch.action.search;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import java.util.List;
/**
*/
public class ClearScrollRequestBuilder extends ActionRequestBuilder<ClearScrollRequest, ClearScrollResponse, ClearScrollRequestBuilder> {
public class ClearScrollRequestBuilder extends ActionRequestBuilder<ClearScrollRequest, ClearScrollResponse, ClearScrollRequestBuilder, Client> {
public ClearScrollRequestBuilder(Client client) {
super((InternalClient) client, new ClearScrollRequest());
super(client, new ClearScrollRequest());
}
public ClearScrollRequestBuilder setScrollIds(List<String> cursorIds) {
@ -46,6 +45,6 @@ public class ClearScrollRequestBuilder extends ActionRequestBuilder<ClearScrollR
@Override
protected void doExecute(ActionListener<ClearScrollResponse> listener) {
((Client) client).clearScroll(request, listener);
client.clearScroll(request, listener);
}
}

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.search;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class MultiSearchAction extends Action<MultiSearchRequest, MultiSearchResponse, MultiSearchRequestBuilder> {
public class MultiSearchAction extends ClientAction<MultiSearchRequest, MultiSearchResponse, MultiSearchRequestBuilder> {
public static final MultiSearchAction INSTANCE = new MultiSearchAction();
public static final String NAME = "msearch";

View File

@ -23,15 +23,14 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
/**
* A request builder for multiple search requests.
*/
public class MultiSearchRequestBuilder extends ActionRequestBuilder<MultiSearchRequest, MultiSearchResponse, MultiSearchRequestBuilder> {
public class MultiSearchRequestBuilder extends ActionRequestBuilder<MultiSearchRequest, MultiSearchResponse, MultiSearchRequestBuilder, Client> {
public MultiSearchRequestBuilder(Client client) {
super((InternalClient) client, new MultiSearchRequest());
super(client, new MultiSearchRequest());
}
/**
@ -76,6 +75,6 @@ public class MultiSearchRequestBuilder extends ActionRequestBuilder<MultiSearchR
@Override
protected void doExecute(ActionListener<MultiSearchResponse> listener) {
((Client) client).multiSearch(request, listener);
client.multiSearch(request, listener);
}
}

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.search;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class SearchAction extends Action<SearchRequest, SearchResponse, SearchRequestBuilder> {
public class SearchAction extends ClientAction<SearchRequest, SearchResponse, SearchRequestBuilder> {
public static final SearchAction INSTANCE = new SearchAction();
public static final String NAME = "search";

View File

@ -24,7 +24,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.unit.TimeValue;
@ -46,12 +45,12 @@ import java.util.Map;
/**
* A search action request builder.
*/
public class SearchRequestBuilder extends ActionRequestBuilder<SearchRequest, SearchResponse, SearchRequestBuilder> {
public class SearchRequestBuilder extends ActionRequestBuilder<SearchRequest, SearchResponse, SearchRequestBuilder, Client> {
private SearchSourceBuilder sourceBuilder;
public SearchRequestBuilder(Client client) {
super((InternalClient) client, new SearchRequest());
super(client, new SearchRequest());
}
/**
@ -1089,7 +1088,7 @@ public class SearchRequestBuilder extends ActionRequestBuilder<SearchRequest, Se
if (sourceBuilder != null) {
request.source(sourceBuilder());
}
((Client) client).search(request, listener);
client.search(request, listener);
}
private SearchSourceBuilder sourceBuilder() {

View File

@ -20,11 +20,12 @@
package org.elasticsearch.action.search;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
/**
*/
public class SearchScrollAction extends Action<SearchScrollRequest, SearchResponse, SearchScrollRequestBuilder> {
public class SearchScrollAction extends ClientAction<SearchScrollRequest, SearchResponse, SearchScrollRequestBuilder> {
public static final SearchScrollAction INSTANCE = new SearchScrollAction();
public static final String NAME = "search/scroll";

View File

@ -22,21 +22,20 @@ package org.elasticsearch.action.search;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.search.Scroll;
/**
* A search scroll action request builder.
*/
public class SearchScrollRequestBuilder extends ActionRequestBuilder<SearchScrollRequest, SearchResponse, SearchScrollRequestBuilder> {
public class SearchScrollRequestBuilder extends ActionRequestBuilder<SearchScrollRequest, SearchResponse, SearchScrollRequestBuilder, Client> {
public SearchScrollRequestBuilder(Client client) {
super((InternalClient) client, new SearchScrollRequest());
super(client, new SearchScrollRequest());
}
public SearchScrollRequestBuilder(Client client, String scrollId) {
super((InternalClient) client, new SearchScrollRequest(scrollId));
super(client, new SearchScrollRequest(scrollId));
}
/**
@ -81,6 +80,6 @@ public class SearchScrollRequestBuilder extends ActionRequestBuilder<SearchScrol
@Override
protected void doExecute(ActionListener<SearchResponse> listener) {
((Client) client).searchScroll(request, listener);
client.searchScroll(request, listener);
}
}

View File

@ -20,12 +20,13 @@
package org.elasticsearch.action.suggest;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ClientAction;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.suggest.Suggest;
/**
*/
public class SuggestAction extends Action<SuggestRequest, SuggestResponse, SuggestRequestBuilder> {
public class SuggestAction extends ClientAction<SuggestRequest, SuggestResponse, SuggestRequestBuilder> {
public static final SuggestAction INSTANCE = new SuggestAction();
public static final String NAME = "suggest";

View File

@ -24,7 +24,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.Requests;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
@ -36,12 +35,12 @@ import java.io.IOException;
/**
* A suggest action request builder.
*/
public class SuggestRequestBuilder extends BroadcastOperationRequestBuilder<SuggestRequest, SuggestResponse, SuggestRequestBuilder> {
public class SuggestRequestBuilder extends BroadcastOperationRequestBuilder<SuggestRequest, SuggestResponse, SuggestRequestBuilder , Client> {
final SuggestBuilder suggest = new SuggestBuilder();
public SuggestRequestBuilder(Client client) {
super((InternalClient) client, new SuggestRequest());
super(client, new SuggestRequest());
}
/**
@ -94,6 +93,6 @@ public class SuggestRequestBuilder extends BroadcastOperationRequestBuilder<Sugg
throw new ElasticsearchException("Unable to build suggestion request", e);
}
((InternalClient) client).suggest(request, listener);
client.suggest(request, listener);
}
}

View File

@ -21,14 +21,16 @@ package org.elasticsearch.action.support.broadcast;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.internal.InternalGenericClient;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient;
/**
*/
public abstract class BroadcastOperationRequestBuilder<Request extends BroadcastOperationRequest<Request>, Response extends BroadcastOperationResponse, RequestBuilder extends BroadcastOperationRequestBuilder<Request, Response, RequestBuilder>>
extends ActionRequestBuilder<Request, Response, RequestBuilder> {
public abstract class BroadcastOperationRequestBuilder<Request extends BroadcastOperationRequest<Request>, Response extends BroadcastOperationResponse, RequestBuilder extends BroadcastOperationRequestBuilder<Request, Response, RequestBuilder, Client>, Client extends ElasticsearchClient>
extends ActionRequestBuilder<Request, Response, RequestBuilder, Client> {
protected BroadcastOperationRequestBuilder(InternalGenericClient client, Request request) {
protected BroadcastOperationRequestBuilder(Client client, Request request) {
super(client, request);
}

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