diff --git a/core/src/main/java/org/elasticsearch/client/Client.java b/core/src/main/java/org/elasticsearch/client/Client.java index dbcd9121c97..9e05cd01371 100644 --- a/core/src/main/java/org/elasticsearch/client/Client.java +++ b/core/src/main/java/org/elasticsearch/client/Client.java @@ -51,17 +51,9 @@ 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.DeletePipelineRequest; -import org.elasticsearch.action.ingest.DeletePipelineRequestBuilder; -import org.elasticsearch.action.ingest.GetPipelineRequest; -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.action.percolate.MultiPercolateRequest; import org.elasticsearch.action.percolate.MultiPercolateRequestBuilder; import org.elasticsearch.action.percolate.MultiPercolateResponse; @@ -604,51 +596,6 @@ public interface Client extends ElasticsearchClient, Releasable { void fieldStats(FieldStatsRequest request, ActionListener listener); - /** - * Stores an ingest pipeline - */ - void putPipeline(PutPipelineRequest request, ActionListener listener); - - /** - * Stores an ingest pipeline - */ - ActionFuture putPipeline(PutPipelineRequest request); - - /** - * Stores an ingest pipeline - */ - PutPipelineRequestBuilder preparePutPipeline(String id, BytesReference source); - - /** - * Deletes a stored ingest pipeline - */ - void deletePipeline(DeletePipelineRequest request, ActionListener listener); - - /** - * Deletes a stored ingest pipeline - */ - ActionFuture deletePipeline(DeletePipelineRequest request); - - /** - * Deletes a stored ingest pipeline - */ - DeletePipelineRequestBuilder prepareDeletePipeline(); - - /** - * Returns a stored ingest pipeline - */ - void getPipeline(GetPipelineRequest request, ActionListener listener); - - /** - * Returns a stored ingest pipeline - */ - ActionFuture getPipeline(GetPipelineRequest request); - - /** - * Returns a stored ingest pipeline - */ - GetPipelineRequestBuilder prepareGetPipeline(String... ids); - /** * Simulates an ingest pipeline */ diff --git a/core/src/main/java/org/elasticsearch/client/ClusterAdminClient.java b/core/src/main/java/org/elasticsearch/client/ClusterAdminClient.java index 2cee4341a39..761ab1a529c 100644 --- a/core/src/main/java/org/elasticsearch/client/ClusterAdminClient.java +++ b/core/src/main/java/org/elasticsearch/client/ClusterAdminClient.java @@ -84,6 +84,15 @@ import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse; import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateRequest; import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateRequestBuilder; import org.elasticsearch.action.admin.cluster.validate.template.RenderSearchTemplateResponse; +import org.elasticsearch.action.ingest.DeletePipelineRequest; +import org.elasticsearch.action.ingest.DeletePipelineRequestBuilder; +import org.elasticsearch.action.ingest.GetPipelineRequest; +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.WritePipelineResponse; +import org.elasticsearch.common.bytes.BytesReference; /** * Administrative actions/operations against indices. @@ -474,4 +483,49 @@ public interface ClusterAdminClient extends ElasticsearchClient { * Return the rendered search request for a given search template. */ RenderSearchTemplateRequestBuilder prepareRenderSearchTemplate(); + + /** + * Stores an ingest pipeline + */ + void putPipeline(PutPipelineRequest request, ActionListener listener); + + /** + * Stores an ingest pipeline + */ + ActionFuture putPipeline(PutPipelineRequest request); + + /** + * Stores an ingest pipeline + */ + PutPipelineRequestBuilder preparePutPipeline(String id, BytesReference source); + + /** + * Deletes a stored ingest pipeline + */ + void deletePipeline(DeletePipelineRequest request, ActionListener listener); + + /** + * Deletes a stored ingest pipeline + */ + ActionFuture deletePipeline(DeletePipelineRequest request); + + /** + * Deletes a stored ingest pipeline + */ + DeletePipelineRequestBuilder prepareDeletePipeline(); + + /** + * Returns a stored ingest pipeline + */ + void getPipeline(GetPipelineRequest request, ActionListener listener); + + /** + * Returns a stored ingest pipeline + */ + ActionFuture getPipeline(GetPipelineRequest request); + + /** + * Returns a stored ingest pipeline + */ + GetPipelineRequestBuilder prepareGetPipeline(String... ids); } diff --git a/core/src/main/java/org/elasticsearch/client/support/AbstractClient.java b/core/src/main/java/org/elasticsearch/client/support/AbstractClient.java index 182f31a1bee..08a57e68d60 100644 --- a/core/src/main/java/org/elasticsearch/client/support/AbstractClient.java +++ b/core/src/main/java/org/elasticsearch/client/support/AbstractClient.java @@ -810,51 +810,6 @@ public abstract class AbstractClient extends AbstractComponent implements Client return new FieldStatsRequestBuilder(this, FieldStatsAction.INSTANCE); } - @Override - public void putPipeline(PutPipelineRequest request, ActionListener listener) { - execute(PutPipelineAction.INSTANCE, request, listener); - } - - @Override - public ActionFuture putPipeline(PutPipelineRequest request) { - return execute(PutPipelineAction.INSTANCE, request); - } - - @Override - public PutPipelineRequestBuilder preparePutPipeline(String id, BytesReference source) { - return new PutPipelineRequestBuilder(this, PutPipelineAction.INSTANCE, id, source); - } - - @Override - public void deletePipeline(DeletePipelineRequest request, ActionListener listener) { - execute(DeletePipelineAction.INSTANCE, request, listener); - } - - @Override - public ActionFuture deletePipeline(DeletePipelineRequest request) { - return execute(DeletePipelineAction.INSTANCE, request); - } - - @Override - public DeletePipelineRequestBuilder prepareDeletePipeline() { - return new DeletePipelineRequestBuilder(this, DeletePipelineAction.INSTANCE); - } - - @Override - public void getPipeline(GetPipelineRequest request, ActionListener listener) { - execute(GetPipelineAction.INSTANCE, request, listener); - } - - @Override - public ActionFuture getPipeline(GetPipelineRequest request) { - return execute(GetPipelineAction.INSTANCE, request); - } - - @Override - public GetPipelineRequestBuilder prepareGetPipeline(String... ids) { - return new GetPipelineRequestBuilder(this, GetPipelineAction.INSTANCE, ids); - } - @Override public void simulatePipeline(SimulatePipelineRequest request, ActionListener listener) { execute(SimulatePipelineAction.INSTANCE, request, listener); @@ -1249,6 +1204,51 @@ public abstract class AbstractClient extends AbstractComponent implements Client public RenderSearchTemplateRequestBuilder prepareRenderSearchTemplate() { return new RenderSearchTemplateRequestBuilder(this, RenderSearchTemplateAction.INSTANCE); } + + @Override + public void putPipeline(PutPipelineRequest request, ActionListener listener) { + execute(PutPipelineAction.INSTANCE, request, listener); + } + + @Override + public ActionFuture putPipeline(PutPipelineRequest request) { + return execute(PutPipelineAction.INSTANCE, request); + } + + @Override + public PutPipelineRequestBuilder preparePutPipeline(String id, BytesReference source) { + return new PutPipelineRequestBuilder(this, PutPipelineAction.INSTANCE, id, source); + } + + @Override + public void deletePipeline(DeletePipelineRequest request, ActionListener listener) { + execute(DeletePipelineAction.INSTANCE, request, listener); + } + + @Override + public ActionFuture deletePipeline(DeletePipelineRequest request) { + return execute(DeletePipelineAction.INSTANCE, request); + } + + @Override + public DeletePipelineRequestBuilder prepareDeletePipeline() { + return new DeletePipelineRequestBuilder(this, DeletePipelineAction.INSTANCE); + } + + @Override + public void getPipeline(GetPipelineRequest request, ActionListener listener) { + execute(GetPipelineAction.INSTANCE, request, listener); + } + + @Override + public ActionFuture getPipeline(GetPipelineRequest request) { + return execute(GetPipelineAction.INSTANCE, request); + } + + @Override + public GetPipelineRequestBuilder prepareGetPipeline(String... ids) { + return new GetPipelineRequestBuilder(this, GetPipelineAction.INSTANCE, ids); + } } static class IndicesAdmin implements IndicesAdminClient { diff --git a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java index c4526d49368..2978b894996 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java @@ -42,6 +42,6 @@ public class RestDeletePipelineAction extends BaseRestHandler { DeletePipelineRequest request = new DeletePipelineRequest(restRequest.param("id")); request.masterNodeTimeout(restRequest.paramAsTime("master_timeout", request.masterNodeTimeout())); request.timeout(restRequest.paramAsTime("timeout", request.timeout())); - client.deletePipeline(request, new AcknowledgedRestListener<>(channel)); + client.admin().cluster().deletePipeline(request, new AcknowledgedRestListener<>(channel)); } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java index b483a84c116..e038202a325 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java @@ -42,6 +42,6 @@ public class RestGetPipelineAction extends BaseRestHandler { protected void handleRequest(RestRequest restRequest, RestChannel channel, Client client) throws Exception { GetPipelineRequest request = new GetPipelineRequest(Strings.splitStringByCommaToArray(restRequest.param("id"))); request.masterNodeTimeout(restRequest.paramAsTime("master_timeout", request.masterNodeTimeout())); - client.getPipeline(request, new RestStatusToXContentListener<>(channel)); + client.admin().cluster().getPipeline(request, new RestStatusToXContentListener<>(channel)); } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java index 5cdd9a893f2..ef7853e3ed8 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java @@ -43,6 +43,6 @@ public class RestPutPipelineAction extends BaseRestHandler { PutPipelineRequest request = new PutPipelineRequest(restRequest.param("id"), RestActions.getRestContent(restRequest)); request.masterNodeTimeout(restRequest.paramAsTime("master_timeout", request.masterNodeTimeout())); request.timeout(restRequest.paramAsTime("timeout", request.timeout())); - client.putPipeline(request, new AcknowledgedRestListener<>(channel)); + client.admin().cluster().putPipeline(request, new AcknowledgedRestListener<>(channel)); } } diff --git a/core/src/test/java/org/elasticsearch/ingest/IngestClientIT.java b/core/src/test/java/org/elasticsearch/ingest/IngestClientIT.java index ae724a59f78..a645677a729 100644 --- a/core/src/test/java/org/elasticsearch/ingest/IngestClientIT.java +++ b/core/src/test/java/org/elasticsearch/ingest/IngestClientIT.java @@ -77,9 +77,9 @@ public class IngestClientIT extends ESIntegTestCase { .endObject() .endArray() .endObject().bytes(); - client().preparePutPipeline("_id", pipelineSource) + client().admin().cluster().preparePutPipeline("_id", pipelineSource) .get(); - GetPipelineResponse getResponse = client().prepareGetPipeline("_id") + GetPipelineResponse getResponse = client().admin().cluster().prepareGetPipeline("_id") .get(); assertThat(getResponse.isFound(), is(true)); assertThat(getResponse.pipelines().size(), equalTo(1)); @@ -134,7 +134,7 @@ public class IngestClientIT extends ESIntegTestCase { .endArray() .endObject().bytes(); PutPipelineRequest putPipelineRequest = new PutPipelineRequest("_id", source); - client().putPipeline(putPipelineRequest).get(); + client().admin().cluster().putPipeline(putPipelineRequest).get(); int numRequests = scaledRandomIntBetween(32, 128); BulkRequest bulkRequest = new BulkRequest(); @@ -170,10 +170,10 @@ public class IngestClientIT extends ESIntegTestCase { .endArray() .endObject().bytes(); PutPipelineRequest putPipelineRequest = new PutPipelineRequest("_id", source); - client().putPipeline(putPipelineRequest).get(); + client().admin().cluster().putPipeline(putPipelineRequest).get(); GetPipelineRequest getPipelineRequest = new GetPipelineRequest("_id"); - GetPipelineResponse getResponse = client().getPipeline(getPipelineRequest).get(); + GetPipelineResponse getResponse = client().admin().cluster().getPipeline(getPipelineRequest).get(); assertThat(getResponse.isFound(), is(true)); assertThat(getResponse.pipelines().size(), equalTo(1)); assertThat(getResponse.pipelines().get(0).getId(), equalTo("_id")); @@ -192,10 +192,10 @@ public class IngestClientIT extends ESIntegTestCase { assertThat(doc.get("processed"), equalTo(true)); DeletePipelineRequest deletePipelineRequest = new DeletePipelineRequest("_id"); - WritePipelineResponse response = client().deletePipeline(deletePipelineRequest).get(); + WritePipelineResponse response = client().admin().cluster().deletePipeline(deletePipelineRequest).get(); assertThat(response.isAcknowledged(), is(true)); - getResponse = client().prepareGetPipeline("_id").get(); + getResponse = client().admin().cluster().prepareGetPipeline("_id").get(); assertThat(getResponse.isFound(), is(false)); assertThat(getResponse.pipelines().size(), equalTo(0)); }