Ingest: move also simulate to ClusterAdminClient

This commit is contained in:
javanna 2016-01-27 13:29:02 +01:00 committed by Luca Cavanna
parent 1317cf2132
commit 1a13022847
5 changed files with 36 additions and 37 deletions

View File

@ -51,9 +51,6 @@ import org.elasticsearch.action.indexedscripts.get.GetIndexedScriptResponse;
import org.elasticsearch.action.indexedscripts.put.PutIndexedScriptRequest;
import org.elasticsearch.action.indexedscripts.put.PutIndexedScriptRequestBuilder;
import org.elasticsearch.action.indexedscripts.put.PutIndexedScriptResponse;
import org.elasticsearch.action.ingest.SimulatePipelineRequest;
import org.elasticsearch.action.ingest.SimulatePipelineRequestBuilder;
import org.elasticsearch.action.ingest.SimulatePipelineResponse;
import org.elasticsearch.action.percolate.MultiPercolateRequest;
import org.elasticsearch.action.percolate.MultiPercolateRequestBuilder;
import org.elasticsearch.action.percolate.MultiPercolateResponse;
@ -85,7 +82,6 @@ import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.support.Headers;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.lease.Releasable;
import org.elasticsearch.common.settings.Settings;
@ -596,21 +592,6 @@ public interface Client extends ElasticsearchClient, Releasable {
void fieldStats(FieldStatsRequest request, ActionListener<FieldStatsResponse> listener);
/**
* Simulates an ingest pipeline
*/
void simulatePipeline(SimulatePipelineRequest request, ActionListener<SimulatePipelineResponse> listener);
/**
* Simulates an ingest pipeline
*/
ActionFuture<SimulatePipelineResponse> simulatePipeline(SimulatePipelineRequest request);
/**
* Simulates an ingest pipeline
*/
SimulatePipelineRequestBuilder prepareSimulatePipeline(BytesReference source);
/**
* Returns this clients settings
*/

View File

@ -91,6 +91,9 @@ import org.elasticsearch.action.ingest.GetPipelineRequestBuilder;
import org.elasticsearch.action.ingest.GetPipelineResponse;
import org.elasticsearch.action.ingest.PutPipelineRequest;
import org.elasticsearch.action.ingest.PutPipelineRequestBuilder;
import org.elasticsearch.action.ingest.SimulatePipelineRequest;
import org.elasticsearch.action.ingest.SimulatePipelineRequestBuilder;
import org.elasticsearch.action.ingest.SimulatePipelineResponse;
import org.elasticsearch.action.ingest.WritePipelineResponse;
import org.elasticsearch.common.bytes.BytesReference;
@ -528,4 +531,19 @@ public interface ClusterAdminClient extends ElasticsearchClient {
* Returns a stored ingest pipeline
*/
GetPipelineRequestBuilder prepareGetPipeline(String... ids);
/**
* Simulates an ingest pipeline
*/
void simulatePipeline(SimulatePipelineRequest request, ActionListener<SimulatePipelineResponse> listener);
/**
* Simulates an ingest pipeline
*/
ActionFuture<SimulatePipelineResponse> simulatePipeline(SimulatePipelineRequest request);
/**
* Simulates an ingest pipeline
*/
SimulatePipelineRequestBuilder prepareSimulatePipeline(BytesReference source);
}

View File

@ -810,21 +810,6 @@ public abstract class AbstractClient extends AbstractComponent implements Client
return new FieldStatsRequestBuilder(this, FieldStatsAction.INSTANCE);
}
@Override
public void simulatePipeline(SimulatePipelineRequest request, ActionListener<SimulatePipelineResponse> listener) {
execute(SimulatePipelineAction.INSTANCE, request, listener);
}
@Override
public ActionFuture<SimulatePipelineResponse> simulatePipeline(SimulatePipelineRequest request) {
return execute(SimulatePipelineAction.INSTANCE, request);
}
@Override
public SimulatePipelineRequestBuilder prepareSimulatePipeline(BytesReference source) {
return new SimulatePipelineRequestBuilder(this, SimulatePipelineAction.INSTANCE, source);
}
static class Admin implements AdminClient {
private final ClusterAdmin clusterAdmin;
@ -1249,6 +1234,21 @@ public abstract class AbstractClient extends AbstractComponent implements Client
public GetPipelineRequestBuilder prepareGetPipeline(String... ids) {
return new GetPipelineRequestBuilder(this, GetPipelineAction.INSTANCE, ids);
}
@Override
public void simulatePipeline(SimulatePipelineRequest request, ActionListener<SimulatePipelineResponse> listener) {
execute(SimulatePipelineAction.INSTANCE, request, listener);
}
@Override
public ActionFuture<SimulatePipelineResponse> simulatePipeline(SimulatePipelineRequest request) {
return execute(SimulatePipelineAction.INSTANCE, request);
}
@Override
public SimulatePipelineRequestBuilder prepareSimulatePipeline(BytesReference source) {
return new SimulatePipelineRequestBuilder(this, SimulatePipelineAction.INSTANCE, source);
}
}
static class IndicesAdmin implements IndicesAdminClient {

View File

@ -46,6 +46,6 @@ public class RestSimulatePipelineAction extends BaseRestHandler {
SimulatePipelineRequest request = new SimulatePipelineRequest(RestActions.getRestContent(restRequest));
request.setId(restRequest.param("id"));
request.setVerbose(restRequest.paramAsBoolean("verbose", false));
client.simulatePipeline(request, new RestToXContentListener<>(channel));
client.admin().cluster().simulatePipeline(request, new RestToXContentListener<>(channel));
}
}

View File

@ -100,12 +100,12 @@ public class IngestClientIT extends ESIntegTestCase {
.endObject().bytes();
SimulatePipelineResponse response;
if (randomBoolean()) {
response = client().prepareSimulatePipeline(bytes)
response = client().admin().cluster().prepareSimulatePipeline(bytes)
.setId("_id").get();
} else {
SimulatePipelineRequest request = new SimulatePipelineRequest(bytes);
request.setId("_id");
response = client().simulatePipeline(request).get();
response = client().admin().cluster().simulatePipeline(request).get();
}
assertThat(response.isVerbose(), equalTo(false));
assertThat(response.getPipelineId(), equalTo("_id"));