clean up the java api a bit

This commit is contained in:
kimchy 2010-07-20 09:18:16 +03:00
parent 2ee870e01e
commit 3867591ffa
29 changed files with 76 additions and 58 deletions

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
@ -32,7 +32,7 @@ import org.elasticsearch.common.unit.TimeValue;
*/
public class ClusterHealthRequestBuilder extends BaseClusterRequestBuilder<ClusterHealthRequest, ClusterHealthResponse> {
public ClusterHealthRequestBuilder(InternalClusterAdminClient clusterClient) {
public ClusterHealthRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ClusterHealthRequest());
}

View File

@ -22,15 +22,15 @@ package org.elasticsearch.client.action.admin.cluster.node.info;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class NodesInfoRequestBuilder extends BaseClusterRequestBuilder<NodesInfoRequest, NodesInfoResponse> {
public NodesInfoRequestBuilder(InternalClusterAdminClient clusterClient) {
public NodesInfoRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new NodesInfoRequest());
}

View File

@ -22,8 +22,8 @@ package org.elasticsearch.client.action.admin.cluster.node.restart;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.restart.NodesRestartRequest;
import org.elasticsearch.action.admin.cluster.node.restart.NodesRestartResponse;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
@ -31,7 +31,7 @@ import org.elasticsearch.common.unit.TimeValue;
*/
public class NodesRestartRequestBuilder extends BaseClusterRequestBuilder<NodesRestartRequest, NodesRestartResponse> {
public NodesRestartRequestBuilder(InternalClusterAdminClient clusterClient) {
public NodesRestartRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new NodesRestartRequest());
}

View File

@ -22,8 +22,8 @@ package org.elasticsearch.client.action.admin.cluster.node.shutdown;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.shutdown.NodesShutdownRequest;
import org.elasticsearch.action.admin.cluster.node.shutdown.NodesShutdownResponse;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
@ -31,7 +31,7 @@ import org.elasticsearch.common.unit.TimeValue;
*/
public class NodesShutdownRequestBuilder extends BaseClusterRequestBuilder<NodesShutdownRequest, NodesShutdownResponse> {
public NodesShutdownRequestBuilder(InternalClusterAdminClient clusterClient) {
public NodesShutdownRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new NodesShutdownRequest());
}

View File

@ -22,15 +22,15 @@ package org.elasticsearch.client.action.admin.cluster.node.stats;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class NodesStatsRequestBuilder extends BaseClusterRequestBuilder<NodesStatsRequest, NodesStatsResponse> {
public NodesStatsRequestBuilder(InternalClusterAdminClient clusterClient) {
public NodesStatsRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new NodesStatsRequest());
}

View File

@ -23,15 +23,15 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.ping.broadcast.BroadcastPingRequest;
import org.elasticsearch.action.admin.cluster.ping.broadcast.BroadcastPingResponse;
import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class BroadcastPingRequestBuilder extends BaseClusterRequestBuilder<BroadcastPingRequest, BroadcastPingResponse> {
public BroadcastPingRequestBuilder(InternalClusterAdminClient clusterClient) {
public BroadcastPingRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new BroadcastPingRequest());
}

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.ping.replication.ReplicationPingRequest;
import org.elasticsearch.action.admin.cluster.ping.replication.ReplicationPingResponse;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
@ -32,7 +32,7 @@ import org.elasticsearch.common.unit.TimeValue;
*/
public class ReplicationPingRequestBuilder extends BaseClusterRequestBuilder<ReplicationPingRequest, ReplicationPingResponse> {
public ReplicationPingRequestBuilder(InternalClusterAdminClient clusterClient) {
public ReplicationPingRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ReplicationPingRequest());
}

View File

@ -22,15 +22,15 @@ package org.elasticsearch.client.action.admin.cluster.ping.single;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.ping.single.SinglePingRequest;
import org.elasticsearch.action.admin.cluster.ping.single.SinglePingResponse;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class SinglePingRequestBuilder extends BaseClusterRequestBuilder<SinglePingRequest, SinglePingResponse> {
public SinglePingRequestBuilder(InternalClusterAdminClient clusterClient) {
public SinglePingRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new SinglePingRequest());
}

View File

@ -22,15 +22,15 @@ package org.elasticsearch.client.action.admin.cluster.state;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.admin.cluster.support.BaseClusterRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class ClusterStateRequestBuilder extends BaseClusterRequestBuilder<ClusterStateRequest, ClusterStateResponse> {
public ClusterStateRequestBuilder(InternalClusterAdminClient clusterClient) {
public ClusterStateRequestBuilder(ClusterAdminClient clusterClient) {
super(clusterClient, new ClusterStateRequest());
}

View File

@ -24,6 +24,7 @@ import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.RequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
@ -36,8 +37,8 @@ public abstract class BaseClusterRequestBuilder<Request extends ActionRequest, R
protected final Request request;
protected BaseClusterRequestBuilder(InternalClusterAdminClient client, Request request) {
this.client = client;
protected BaseClusterRequestBuilder(ClusterAdminClient client, Request request) {
this.client = (InternalClusterAdminClient) client;
this.request = request;
}

View File

@ -22,15 +22,15 @@ package org.elasticsearch.client.action.admin.indices.alias;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class IndicesAliasesRequestBuilder extends BaseIndicesRequestBuilder<IndicesAliasesRequest, IndicesAliasesResponse> {
public IndicesAliasesRequestBuilder(InternalIndicesAdminClient indicesClient) {
public IndicesAliasesRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new IndicesAliasesRequest());
}

View File

@ -23,15 +23,15 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class ClearIndicesCacheRequestBuilder extends BaseIndicesRequestBuilder<ClearIndicesCacheRequest, ClearIndicesCacheResponse> {
public ClearIndicesCacheRequestBuilder(InternalIndicesAdminClient indicesClient) {
public ClearIndicesCacheRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new ClearIndicesCacheRequest());
}

View File

@ -22,8 +22,8 @@ package org.elasticsearch.client.action.admin.indices.create;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.builder.XContentBuilder;
@ -35,7 +35,7 @@ import java.util.Map;
*/
public class CreateIndexRequestBuilder extends BaseIndicesRequestBuilder<CreateIndexRequest, CreateIndexResponse> {
public CreateIndexRequestBuilder(InternalIndicesAdminClient indicesClient, String index) {
public CreateIndexRequestBuilder(IndicesAdminClient indicesClient, String index) {
super(indicesClient, new CreateIndexRequest(index));
}

View File

@ -22,8 +22,8 @@ package org.elasticsearch.client.action.admin.indices.delete;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
@ -31,7 +31,7 @@ import org.elasticsearch.common.unit.TimeValue;
*/
public class DeleteIndexRequestBuilder extends BaseIndicesRequestBuilder<DeleteIndexRequest, DeleteIndexResponse> {
public DeleteIndexRequestBuilder(InternalIndicesAdminClient indicesClient, String index) {
public DeleteIndexRequestBuilder(IndicesAdminClient indicesClient, String index) {
super(indicesClient, new DeleteIndexRequest(index));
}

View File

@ -22,15 +22,15 @@ package org.elasticsearch.client.action.admin.indices.flush;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class FlushRequestBuilder extends BaseIndicesRequestBuilder<FlushRequest, FlushResponse> {
public FlushRequestBuilder(InternalIndicesAdminClient indicesClient) {
public FlushRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new FlushRequest());
}

View File

@ -22,8 +22,8 @@ package org.elasticsearch.client.action.admin.indices.gateway.snapshot;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.gateway.snapshot.GatewaySnapshotRequest;
import org.elasticsearch.action.admin.indices.gateway.snapshot.GatewaySnapshotResponse;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.unit.TimeValue;
/**
@ -31,7 +31,7 @@ import org.elasticsearch.common.unit.TimeValue;
*/
public class GatewaySnapshotRequestBuilder extends BaseIndicesRequestBuilder<GatewaySnapshotRequest, GatewaySnapshotResponse> {
public GatewaySnapshotRequestBuilder(InternalIndicesAdminClient indicesClient) {
public GatewaySnapshotRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new GatewaySnapshotRequest());
}

View File

@ -22,8 +22,8 @@ package org.elasticsearch.client.action.admin.indices.mapping.put;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.builder.XContentBuilder;
@ -34,7 +34,7 @@ import java.util.Map;
*/
public class PutMappingRequestBuilder extends BaseIndicesRequestBuilder<PutMappingRequest, PutMappingResponse> {
public PutMappingRequestBuilder(InternalIndicesAdminClient indicesClient) {
public PutMappingRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new PutMappingRequest());
}

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.optimize.OptimizeRequest;
import org.elasticsearch.action.admin.indices.optimize.OptimizeResponse;
import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
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
@ -40,7 +40,7 @@ import org.elasticsearch.client.internal.InternalIndicesAdminClient;
*/
public class OptimizeRequestBuilder extends BaseIndicesRequestBuilder<OptimizeRequest, OptimizeResponse> {
public OptimizeRequestBuilder(InternalIndicesAdminClient indicesClient) {
public OptimizeRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new OptimizeRequest());
}

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
/**
* A refresh request making all operations performed since the last refresh available for search. The (near) real-time
@ -35,7 +35,7 @@ import org.elasticsearch.client.internal.InternalIndicesAdminClient;
*/
public class RefreshRequestBuilder extends BaseIndicesRequestBuilder<RefreshRequest, RefreshResponse> {
public RefreshRequestBuilder(InternalIndicesAdminClient indicesClient) {
public RefreshRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new RefreshRequest());
}

View File

@ -22,15 +22,15 @@ package org.elasticsearch.client.action.admin.indices.status;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.status.IndicesStatusRequest;
import org.elasticsearch.action.admin.indices.status.IndicesStatusResponse;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.admin.indices.support.BaseIndicesRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
/**
* @author kimchy (shay.banon)
*/
public class IndicesStatusRequestBuilder extends BaseIndicesRequestBuilder<IndicesStatusRequest, IndicesStatusResponse> {
public IndicesStatusRequestBuilder(InternalIndicesAdminClient indicesClient) {
public IndicesStatusRequestBuilder(IndicesAdminClient indicesClient) {
super(indicesClient, new IndicesStatusRequest());
}

View File

@ -24,6 +24,7 @@ import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.RequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
@ -36,8 +37,8 @@ public abstract class BaseIndicesRequestBuilder<Request extends ActionRequest, R
protected final Request request;
protected BaseIndicesRequestBuilder(InternalIndicesAdminClient client, Request request) {
this.client = client;
protected BaseIndicesRequestBuilder(IndicesAdminClient client, Request request) {
this.client = (InternalIndicesAdminClient) client;
this.request = request;
}

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.count.CountRequest;
import org.elasticsearch.action.count.CountResponse;
import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.index.query.QueryBuilder;
/**
@ -34,7 +34,7 @@ import org.elasticsearch.index.query.QueryBuilder;
*/
public class CountRequestBuilder extends BaseRequestBuilder<CountRequest, CountResponse> {
public CountRequestBuilder(InternalClient client) {
public CountRequestBuilder(Client client) {
super(client, new CountRequest());
}

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
import javax.annotation.Nullable;
@ -35,7 +35,7 @@ import javax.annotation.Nullable;
*/
public class DeleteRequestBuilder extends BaseRequestBuilder<DeleteRequest, DeleteResponse> {
public DeleteRequestBuilder(InternalClient client, @Nullable String index) {
public DeleteRequestBuilder(Client client, @Nullable String index) {
super(client, new DeleteRequest(index));
}

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.deletebyquery.DeleteByQueryRequest;
import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.builder.XContentBuilder;
import org.elasticsearch.index.query.QueryBuilder;
@ -36,7 +36,7 @@ import java.util.Map;
*/
public class DeleteByQueryRequestBuilder extends BaseRequestBuilder<DeleteByQueryRequest, DeleteByQueryResponse> {
public DeleteByQueryRequestBuilder(InternalClient client) {
public DeleteByQueryRequestBuilder(Client client) {
super(client, new DeleteByQueryRequest());
}

View File

@ -22,8 +22,8 @@ package org.elasticsearch.client.action.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
import javax.annotation.Nullable;
@ -34,7 +34,7 @@ import javax.annotation.Nullable;
*/
public class GetRequestBuilder extends BaseRequestBuilder<GetRequest, GetResponse> {
public GetRequestBuilder(InternalClient client, @Nullable String index) {
public GetRequestBuilder(Client client, @Nullable String index) {
super(client, new GetRequest(index));
}

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.common.xcontent.builder.XContentBuilder;
@ -39,7 +39,7 @@ import java.util.Map;
*/
public class IndexRequestBuilder extends BaseRequestBuilder<IndexRequest, IndexResponse> {
public IndexRequestBuilder(InternalClient client, @Nullable String index) {
public IndexRequestBuilder(Client client, @Nullable String index) {
super(client, new IndexRequest(index));
}

View File

@ -25,8 +25,8 @@ import org.elasticsearch.action.search.SearchOperationThreading;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.xcontent.XContentQueryBuilder;
import org.elasticsearch.search.Scroll;
@ -47,7 +47,7 @@ public class SearchRequestBuilder extends BaseRequestBuilder<SearchRequest, Sear
private HighlightBuilder highlightBuilder;
public SearchRequestBuilder(InternalClient client) {
public SearchRequestBuilder(Client client) {
super(client, new SearchRequest());
}
@ -222,11 +222,26 @@ public class SearchRequestBuilder extends BaseRequestBuilder<SearchRequest, Sear
return this;
}
/**
* Adds a script based field to load and return. The field does not have to be stored,
* but its recommended to use non analyzed or numeric fields.
*
* @param name The name that will represent this value in the return hit
* @param script The script to use
*/
public SearchRequestBuilder addScriptField(String name, String script) {
sourceBuilder().scriptField(name, script);
return this;
}
/**
* Adds a script based field to load and return. The field does not have to be stored,
* but its recommended to use non analyzed or numeric fields.
*
* @param name The name that will represent this value in the return hit
* @param script The script to use
* @param params Parameters that the script can use.
*/
public SearchRequestBuilder addScriptField(String name, String script, Map<String, Object> params) {
sourceBuilder().scriptField(name, script, params);
return this;

View File

@ -23,8 +23,8 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.search.SearchOperationThreading;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.support.BaseRequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.search.Scroll;
@ -35,7 +35,7 @@ import org.elasticsearch.search.Scroll;
*/
public class SearchScrollRequestBuilder extends BaseRequestBuilder<SearchScrollRequest, SearchResponse> {
public SearchScrollRequestBuilder(InternalClient client, String scrollId) {
public SearchScrollRequestBuilder(Client client, String scrollId) {
super(client, new SearchScrollRequest(scrollId));
}

View File

@ -24,6 +24,7 @@ import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.RequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
@ -36,8 +37,8 @@ public abstract class BaseRequestBuilder<Request extends ActionRequest, Response
protected final Request request;
protected BaseRequestBuilder(InternalClient client, Request request) {
this.client = client;
protected BaseRequestBuilder(Client client, Request request) {
this.client = (InternalClient) client;
this.request = request;
}