Merge branch 'master' into index-lifecycle
This commit is contained in:
commit
e242052520
|
@ -23,11 +23,6 @@ import org.apache.http.Header;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
||||||
import org.elasticsearch.action.ingest.PutPipelineRequest;
|
|
||||||
import org.elasticsearch.action.ingest.GetPipelineRequest;
|
|
||||||
import org.elasticsearch.action.ingest.GetPipelineResponse;
|
|
||||||
import org.elasticsearch.action.ingest.DeletePipelineRequest;
|
|
||||||
import org.elasticsearch.action.ingest.WritePipelineResponse;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -68,72 +63,4 @@ public final class ClusterClient {
|
||||||
restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
|
restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
|
||||||
ClusterUpdateSettingsResponse::fromXContent, listener, emptySet(), headers);
|
ClusterUpdateSettingsResponse::fromXContent, listener, emptySet(), headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a pipeline or update an existing pipeline in the cluster
|
|
||||||
* <p>
|
|
||||||
* See
|
|
||||||
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
|
|
||||||
*/
|
|
||||||
public WritePipelineResponse putPipeline(PutPipelineRequest request, Header... headers) throws IOException {
|
|
||||||
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::putPipeline,
|
|
||||||
WritePipelineResponse::fromXContent, emptySet(), headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Asynchronously add a pipeline or update an existing pipeline in the cluster
|
|
||||||
* <p>
|
|
||||||
* See
|
|
||||||
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
|
|
||||||
*/
|
|
||||||
public void putPipelineAsync(PutPipelineRequest request, ActionListener<WritePipelineResponse> listener, Header... headers) {
|
|
||||||
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::putPipeline,
|
|
||||||
WritePipelineResponse::fromXContent, listener, emptySet(), headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an existing pipeline
|
|
||||||
* <p>
|
|
||||||
* See
|
|
||||||
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/get-pipeline-api.html"> Get Pipeline API on elastic.co</a>
|
|
||||||
*/
|
|
||||||
public GetPipelineResponse getPipeline(GetPipelineRequest request, Header... headers) throws IOException {
|
|
||||||
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::getPipeline,
|
|
||||||
GetPipelineResponse::fromXContent, emptySet(), headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Asynchronously get an existing pipeline
|
|
||||||
* <p>
|
|
||||||
* See
|
|
||||||
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html"> Get Pipeline API on elastic.co</a>
|
|
||||||
*/
|
|
||||||
public void getPipelineAsync(GetPipelineRequest request, ActionListener<GetPipelineResponse> listener, Header... headers) {
|
|
||||||
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::getPipeline,
|
|
||||||
GetPipelineResponse::fromXContent, listener, emptySet(), headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete an existing pipeline
|
|
||||||
* <p>
|
|
||||||
* See
|
|
||||||
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html">
|
|
||||||
* Delete Pipeline API on elastic.co</a>
|
|
||||||
*/
|
|
||||||
public WritePipelineResponse deletePipeline(DeletePipelineRequest request, Header... headers) throws IOException {
|
|
||||||
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::deletePipeline,
|
|
||||||
WritePipelineResponse::fromXContent, emptySet(), headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Asynchronously delete an existing pipeline
|
|
||||||
* <p>
|
|
||||||
* See
|
|
||||||
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html">
|
|
||||||
* Delete Pipeline API on elastic.co</a>
|
|
||||||
*/
|
|
||||||
public void deletePipelineAsync(DeletePipelineRequest request, ActionListener<WritePipelineResponse> listener, Header... headers) {
|
|
||||||
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::deletePipeline,
|
|
||||||
WritePipelineResponse::fromXContent, listener, emptySet(), headers);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.client;
|
||||||
|
|
||||||
|
import org.apache.http.Header;
|
||||||
|
import org.elasticsearch.action.ActionListener;
|
||||||
|
import org.elasticsearch.action.ingest.DeletePipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.GetPipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.GetPipelineResponse;
|
||||||
|
import org.elasticsearch.action.ingest.PutPipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.WritePipelineResponse;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static java.util.Collections.emptySet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Ingest API.
|
||||||
|
* <p>
|
||||||
|
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html">Ingest API on elastic.co</a>
|
||||||
|
*/
|
||||||
|
public final class IngestClient {
|
||||||
|
|
||||||
|
private final RestHighLevelClient restHighLevelClient;
|
||||||
|
|
||||||
|
IngestClient(RestHighLevelClient restHighLevelClient) {
|
||||||
|
this.restHighLevelClient = restHighLevelClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a pipeline or update an existing pipeline
|
||||||
|
* <p>
|
||||||
|
* See
|
||||||
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
|
||||||
|
*/
|
||||||
|
public WritePipelineResponse putPipeline(PutPipelineRequest request, Header... headers) throws IOException {
|
||||||
|
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::putPipeline,
|
||||||
|
WritePipelineResponse::fromXContent, emptySet(), headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously add a pipeline or update an existing pipeline
|
||||||
|
* <p>
|
||||||
|
* See
|
||||||
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
|
||||||
|
*/
|
||||||
|
public void putPipelineAsync(PutPipelineRequest request, ActionListener<WritePipelineResponse> listener, Header... headers) {
|
||||||
|
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::putPipeline,
|
||||||
|
WritePipelineResponse::fromXContent, listener, emptySet(), headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an existing pipeline
|
||||||
|
* <p>
|
||||||
|
* See
|
||||||
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/get-pipeline-api.html"> Get Pipeline API on elastic.co</a>
|
||||||
|
*/
|
||||||
|
public GetPipelineResponse getPipeline(GetPipelineRequest request, Header... headers) throws IOException {
|
||||||
|
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::getPipeline,
|
||||||
|
GetPipelineResponse::fromXContent, emptySet(), headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously get an existing pipeline
|
||||||
|
* <p>
|
||||||
|
* See
|
||||||
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html"> Get Pipeline API on elastic.co</a>
|
||||||
|
*/
|
||||||
|
public void getPipelineAsync(GetPipelineRequest request, ActionListener<GetPipelineResponse> listener, Header... headers) {
|
||||||
|
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::getPipeline,
|
||||||
|
GetPipelineResponse::fromXContent, listener, emptySet(), headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an existing pipeline
|
||||||
|
* <p>
|
||||||
|
* See
|
||||||
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html">
|
||||||
|
* Delete Pipeline API on elastic.co</a>
|
||||||
|
*/
|
||||||
|
public WritePipelineResponse deletePipeline(DeletePipelineRequest request, Header... headers) throws IOException {
|
||||||
|
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::deletePipeline,
|
||||||
|
WritePipelineResponse::fromXContent, emptySet(), headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously delete an existing pipeline
|
||||||
|
* <p>
|
||||||
|
* See
|
||||||
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html">
|
||||||
|
* Delete Pipeline API on elastic.co</a>
|
||||||
|
*/
|
||||||
|
public void deletePipelineAsync(DeletePipelineRequest request, ActionListener<WritePipelineResponse> listener, Header... headers) {
|
||||||
|
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::deletePipeline,
|
||||||
|
WritePipelineResponse::fromXContent, listener, emptySet(), headers);
|
||||||
|
}
|
||||||
|
}
|
|
@ -191,6 +191,7 @@ public class RestHighLevelClient implements Closeable {
|
||||||
|
|
||||||
private final IndicesClient indicesClient = new IndicesClient(this);
|
private final IndicesClient indicesClient = new IndicesClient(this);
|
||||||
private final ClusterClient clusterClient = new ClusterClient(this);
|
private final ClusterClient clusterClient = new ClusterClient(this);
|
||||||
|
private final IngestClient ingestClient = new IngestClient(this);
|
||||||
private final SnapshotClient snapshotClient = new SnapshotClient(this);
|
private final SnapshotClient snapshotClient = new SnapshotClient(this);
|
||||||
private final TasksClient tasksClient = new TasksClient(this);
|
private final TasksClient tasksClient = new TasksClient(this);
|
||||||
|
|
||||||
|
@ -256,6 +257,15 @@ public class RestHighLevelClient implements Closeable {
|
||||||
return clusterClient;
|
return clusterClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a {@link IngestClient} which can be used to access the Ingest API.
|
||||||
|
*
|
||||||
|
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html">Ingest API on elastic.co</a>
|
||||||
|
*/
|
||||||
|
public final IngestClient ingest() {
|
||||||
|
return ingestClient;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a {@link SnapshotClient} which can be used to access the Snapshot API.
|
* Provides a {@link SnapshotClient} which can be used to access the Snapshot API.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,20 +22,12 @@ package org.elasticsearch.client;
|
||||||
import org.elasticsearch.ElasticsearchException;
|
import org.elasticsearch.ElasticsearchException;
|
||||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
||||||
import org.elasticsearch.action.ingest.GetPipelineRequest;
|
|
||||||
import org.elasticsearch.action.ingest.GetPipelineResponse;
|
|
||||||
import org.elasticsearch.action.ingest.PutPipelineRequest;
|
|
||||||
import org.elasticsearch.action.ingest.DeletePipelineRequest;
|
|
||||||
import org.elasticsearch.action.ingest.WritePipelineResponse;
|
|
||||||
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
|
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
import org.elasticsearch.indices.recovery.RecoverySettings;
|
import org.elasticsearch.indices.recovery.RecoverySettings;
|
||||||
import org.elasticsearch.ingest.PipelineConfiguration;
|
|
||||||
import org.elasticsearch.rest.RestStatus;
|
import org.elasticsearch.rest.RestStatus;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -113,53 +105,4 @@ public class ClusterClientIT extends ESRestHighLevelClientTestCase {
|
||||||
assertThat(exception.getMessage(), equalTo(
|
assertThat(exception.getMessage(), equalTo(
|
||||||
"Elasticsearch exception [type=illegal_argument_exception, reason=transient setting [" + setting + "], not recognized]"));
|
"Elasticsearch exception [type=illegal_argument_exception, reason=transient setting [" + setting + "], not recognized]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPutPipeline() throws IOException {
|
|
||||||
String id = "some_pipeline_id";
|
|
||||||
XContentBuilder pipelineBuilder = buildRandomXContentPipeline();
|
|
||||||
PutPipelineRequest request = new PutPipelineRequest(
|
|
||||||
id,
|
|
||||||
BytesReference.bytes(pipelineBuilder),
|
|
||||||
pipelineBuilder.contentType());
|
|
||||||
|
|
||||||
WritePipelineResponse putPipelineResponse =
|
|
||||||
execute(request, highLevelClient().cluster()::putPipeline, highLevelClient().cluster()::putPipelineAsync);
|
|
||||||
assertTrue(putPipelineResponse.isAcknowledged());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testGetPipeline() throws IOException {
|
|
||||||
String id = "some_pipeline_id";
|
|
||||||
XContentBuilder pipelineBuilder = buildRandomXContentPipeline();
|
|
||||||
{
|
|
||||||
PutPipelineRequest request = new PutPipelineRequest(
|
|
||||||
id,
|
|
||||||
BytesReference.bytes(pipelineBuilder),
|
|
||||||
pipelineBuilder.contentType()
|
|
||||||
);
|
|
||||||
createPipeline(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
GetPipelineRequest request = new GetPipelineRequest(id);
|
|
||||||
|
|
||||||
GetPipelineResponse response =
|
|
||||||
execute(request, highLevelClient().cluster()::getPipeline, highLevelClient().cluster()::getPipelineAsync);
|
|
||||||
assertTrue(response.isFound());
|
|
||||||
assertEquals(response.pipelines().get(0).getId(), id);
|
|
||||||
PipelineConfiguration expectedConfig =
|
|
||||||
new PipelineConfiguration(id, BytesReference.bytes(pipelineBuilder), pipelineBuilder.contentType());
|
|
||||||
assertEquals(expectedConfig.getConfigAsMap(), response.pipelines().get(0).getConfigAsMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDeletePipeline() throws IOException {
|
|
||||||
String id = "some_pipeline_id";
|
|
||||||
{
|
|
||||||
createPipeline(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeletePipelineRequest request = new DeletePipelineRequest(id);
|
|
||||||
|
|
||||||
WritePipelineResponse response =
|
|
||||||
execute(request, highLevelClient().cluster()::deletePipeline, highLevelClient().cluster()::deletePipelineAsync);
|
|
||||||
assertTrue(response.isAcknowledged());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.client;
|
||||||
|
|
||||||
|
import org.elasticsearch.action.ingest.DeletePipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.GetPipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.GetPipelineResponse;
|
||||||
|
import org.elasticsearch.action.ingest.PutPipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.WritePipelineResponse;
|
||||||
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
import org.elasticsearch.ingest.PipelineConfiguration;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class IngestClientIT extends ESRestHighLevelClientTestCase {
|
||||||
|
|
||||||
|
public void testPutPipeline() throws IOException {
|
||||||
|
String id = "some_pipeline_id";
|
||||||
|
XContentBuilder pipelineBuilder = buildRandomXContentPipeline();
|
||||||
|
PutPipelineRequest request = new PutPipelineRequest(
|
||||||
|
id,
|
||||||
|
BytesReference.bytes(pipelineBuilder),
|
||||||
|
pipelineBuilder.contentType());
|
||||||
|
|
||||||
|
WritePipelineResponse putPipelineResponse =
|
||||||
|
execute(request, highLevelClient().ingest()::putPipeline, highLevelClient().ingest()::putPipelineAsync);
|
||||||
|
assertTrue(putPipelineResponse.isAcknowledged());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetPipeline() throws IOException {
|
||||||
|
String id = "some_pipeline_id";
|
||||||
|
XContentBuilder pipelineBuilder = buildRandomXContentPipeline();
|
||||||
|
{
|
||||||
|
PutPipelineRequest request = new PutPipelineRequest(
|
||||||
|
id,
|
||||||
|
BytesReference.bytes(pipelineBuilder),
|
||||||
|
pipelineBuilder.contentType()
|
||||||
|
);
|
||||||
|
createPipeline(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetPipelineRequest request = new GetPipelineRequest(id);
|
||||||
|
|
||||||
|
GetPipelineResponse response =
|
||||||
|
execute(request, highLevelClient().ingest()::getPipeline, highLevelClient().ingest()::getPipelineAsync);
|
||||||
|
assertTrue(response.isFound());
|
||||||
|
assertEquals(response.pipelines().get(0).getId(), id);
|
||||||
|
PipelineConfiguration expectedConfig =
|
||||||
|
new PipelineConfiguration(id, BytesReference.bytes(pipelineBuilder), pipelineBuilder.contentType());
|
||||||
|
assertEquals(expectedConfig.getConfigAsMap(), response.pipelines().get(0).getConfigAsMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeletePipeline() throws IOException {
|
||||||
|
String id = "some_pipeline_id";
|
||||||
|
{
|
||||||
|
createPipeline(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
DeletePipelineRequest request = new DeletePipelineRequest(id);
|
||||||
|
|
||||||
|
WritePipelineResponse response =
|
||||||
|
execute(request, highLevelClient().ingest()::deletePipeline, highLevelClient().ingest()::deletePipelineAsync);
|
||||||
|
assertTrue(response.isAcknowledged());
|
||||||
|
}
|
||||||
|
}
|
|
@ -186,220 +186,4 @@ public class ClusterClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPutPipeline() throws IOException {
|
|
||||||
RestHighLevelClient client = highLevelClient();
|
|
||||||
|
|
||||||
{
|
|
||||||
// tag::put-pipeline-request
|
|
||||||
String source =
|
|
||||||
"{\"description\":\"my set of processors\"," +
|
|
||||||
"\"processors\":[{\"set\":{\"field\":\"foo\",\"value\":\"bar\"}}]}";
|
|
||||||
PutPipelineRequest request = new PutPipelineRequest(
|
|
||||||
"my-pipeline-id", // <1>
|
|
||||||
new BytesArray(source.getBytes(StandardCharsets.UTF_8)), // <2>
|
|
||||||
XContentType.JSON // <3>
|
|
||||||
);
|
|
||||||
// end::put-pipeline-request
|
|
||||||
|
|
||||||
// tag::put-pipeline-request-timeout
|
|
||||||
request.timeout(TimeValue.timeValueMinutes(2)); // <1>
|
|
||||||
request.timeout("2m"); // <2>
|
|
||||||
// end::put-pipeline-request-timeout
|
|
||||||
|
|
||||||
// tag::put-pipeline-request-masterTimeout
|
|
||||||
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
|
||||||
request.masterNodeTimeout("1m"); // <2>
|
|
||||||
// end::put-pipeline-request-masterTimeout
|
|
||||||
|
|
||||||
// tag::put-pipeline-execute
|
|
||||||
WritePipelineResponse response = client.cluster().putPipeline(request); // <1>
|
|
||||||
// end::put-pipeline-execute
|
|
||||||
|
|
||||||
// tag::put-pipeline-response
|
|
||||||
boolean acknowledged = response.isAcknowledged(); // <1>
|
|
||||||
// end::put-pipeline-response
|
|
||||||
assertTrue(acknowledged);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPutPipelineAsync() throws Exception {
|
|
||||||
RestHighLevelClient client = highLevelClient();
|
|
||||||
|
|
||||||
{
|
|
||||||
String source =
|
|
||||||
"{\"description\":\"my set of processors\"," +
|
|
||||||
"\"processors\":[{\"set\":{\"field\":\"foo\",\"value\":\"bar\"}}]}";
|
|
||||||
PutPipelineRequest request = new PutPipelineRequest(
|
|
||||||
"my-pipeline-id",
|
|
||||||
new BytesArray(source.getBytes(StandardCharsets.UTF_8)),
|
|
||||||
XContentType.JSON
|
|
||||||
);
|
|
||||||
|
|
||||||
// tag::put-pipeline-execute-listener
|
|
||||||
ActionListener<WritePipelineResponse> listener =
|
|
||||||
new ActionListener<WritePipelineResponse>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(WritePipelineResponse response) {
|
|
||||||
// <1>
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Exception e) {
|
|
||||||
// <2>
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// end::put-pipeline-execute-listener
|
|
||||||
|
|
||||||
// Replace the empty listener by a blocking listener in test
|
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
|
||||||
listener = new LatchedActionListener<>(listener, latch);
|
|
||||||
|
|
||||||
// tag::put-pipeline-execute-async
|
|
||||||
client.cluster().putPipelineAsync(request, listener); // <1>
|
|
||||||
// end::put-pipeline-execute-async
|
|
||||||
|
|
||||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testGetPipeline() throws IOException {
|
|
||||||
RestHighLevelClient client = highLevelClient();
|
|
||||||
|
|
||||||
{
|
|
||||||
createPipeline("my-pipeline-id");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// tag::get-pipeline-request
|
|
||||||
GetPipelineRequest request = new GetPipelineRequest("my-pipeline-id"); // <1>
|
|
||||||
// end::get-pipeline-request
|
|
||||||
|
|
||||||
// tag::get-pipeline-request-masterTimeout
|
|
||||||
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
|
||||||
request.masterNodeTimeout("1m"); // <2>
|
|
||||||
// end::get-pipeline-request-masterTimeout
|
|
||||||
|
|
||||||
// tag::get-pipeline-execute
|
|
||||||
GetPipelineResponse response = client.cluster().getPipeline(request); // <1>
|
|
||||||
// end::get-pipeline-execute
|
|
||||||
|
|
||||||
// tag::get-pipeline-response
|
|
||||||
boolean successful = response.isFound(); // <1>
|
|
||||||
List<PipelineConfiguration> pipelines = response.pipelines(); // <2>
|
|
||||||
for(PipelineConfiguration pipeline: pipelines) {
|
|
||||||
Map<String, Object> config = pipeline.getConfigAsMap(); // <3>
|
|
||||||
}
|
|
||||||
// end::get-pipeline-response
|
|
||||||
|
|
||||||
assertTrue(successful);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testGetPipelineAsync() throws Exception {
|
|
||||||
RestHighLevelClient client = highLevelClient();
|
|
||||||
|
|
||||||
{
|
|
||||||
createPipeline("my-pipeline-id");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
GetPipelineRequest request = new GetPipelineRequest("my-pipeline-id");
|
|
||||||
|
|
||||||
// tag::get-pipeline-execute-listener
|
|
||||||
ActionListener<GetPipelineResponse> listener =
|
|
||||||
new ActionListener<GetPipelineResponse>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(GetPipelineResponse response) {
|
|
||||||
// <1>
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Exception e) {
|
|
||||||
// <2>
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// end::get-pipeline-execute-listener
|
|
||||||
|
|
||||||
// Replace the empty listener by a blocking listener in test
|
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
|
||||||
listener = new LatchedActionListener<>(listener, latch);
|
|
||||||
|
|
||||||
// tag::get-pipeline-execute-async
|
|
||||||
client.cluster().getPipelineAsync(request, listener); // <1>
|
|
||||||
// end::get-pipeline-execute-async
|
|
||||||
|
|
||||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDeletePipeline() throws IOException {
|
|
||||||
RestHighLevelClient client = highLevelClient();
|
|
||||||
|
|
||||||
{
|
|
||||||
createPipeline("my-pipeline-id");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// tag::delete-pipeline-request
|
|
||||||
DeletePipelineRequest request = new DeletePipelineRequest("my-pipeline-id"); // <1>
|
|
||||||
// end::delete-pipeline-request
|
|
||||||
|
|
||||||
// tag::delete-pipeline-request-timeout
|
|
||||||
request.timeout(TimeValue.timeValueMinutes(2)); // <1>
|
|
||||||
request.timeout("2m"); // <2>
|
|
||||||
// end::delete-pipeline-request-timeout
|
|
||||||
|
|
||||||
// tag::delete-pipeline-request-masterTimeout
|
|
||||||
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
|
||||||
request.masterNodeTimeout("1m"); // <2>
|
|
||||||
// end::delete-pipeline-request-masterTimeout
|
|
||||||
|
|
||||||
// tag::delete-pipeline-execute
|
|
||||||
WritePipelineResponse response = client.cluster().deletePipeline(request); // <1>
|
|
||||||
// end::delete-pipeline-execute
|
|
||||||
|
|
||||||
// tag::delete-pipeline-response
|
|
||||||
boolean acknowledged = response.isAcknowledged(); // <1>
|
|
||||||
// end::delete-pipeline-response
|
|
||||||
assertTrue(acknowledged);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDeletePipelineAsync() throws Exception {
|
|
||||||
RestHighLevelClient client = highLevelClient();
|
|
||||||
|
|
||||||
{
|
|
||||||
createPipeline("my-pipeline-id");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
DeletePipelineRequest request = new DeletePipelineRequest("my-pipeline-id");
|
|
||||||
|
|
||||||
// tag::delete-pipeline-execute-listener
|
|
||||||
ActionListener<WritePipelineResponse> listener =
|
|
||||||
new ActionListener<WritePipelineResponse>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(WritePipelineResponse response) {
|
|
||||||
// <1>
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Exception e) {
|
|
||||||
// <2>
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// end::delete-pipeline-execute-listener
|
|
||||||
|
|
||||||
// Replace the empty listener by a blocking listener in test
|
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
|
||||||
listener = new LatchedActionListener<>(listener, latch);
|
|
||||||
|
|
||||||
// tag::delete-pipeline-execute-async
|
|
||||||
client.cluster().deletePipelineAsync(request, listener); // <1>
|
|
||||||
// end::delete-pipeline-execute-async
|
|
||||||
|
|
||||||
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,279 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.client.documentation;
|
||||||
|
|
||||||
|
import org.elasticsearch.action.ActionListener;
|
||||||
|
import org.elasticsearch.action.LatchedActionListener;
|
||||||
|
import org.elasticsearch.action.ingest.DeletePipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.GetPipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.GetPipelineResponse;
|
||||||
|
import org.elasticsearch.action.ingest.PutPipelineRequest;
|
||||||
|
import org.elasticsearch.action.ingest.WritePipelineResponse;
|
||||||
|
import org.elasticsearch.client.ESRestHighLevelClientTestCase;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
|
import org.elasticsearch.ingest.PipelineConfiguration;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is used to generate the Java Ingest API documentation.
|
||||||
|
* You need to wrap your code between two tags like:
|
||||||
|
* // tag::example
|
||||||
|
* // end::example
|
||||||
|
*
|
||||||
|
* Where example is your tag name.
|
||||||
|
*
|
||||||
|
* Then in the documentation, you can extract what is between tag and end tags with
|
||||||
|
* ["source","java",subs="attributes,callouts,macros"]
|
||||||
|
* --------------------------------------------------
|
||||||
|
* include-tagged::{doc-tests}/IngestClientDocumentationIT.java[example]
|
||||||
|
* --------------------------------------------------
|
||||||
|
*
|
||||||
|
* The column width of the code block is 84. If the code contains a line longer
|
||||||
|
* than 84, the line will be cut and a horizontal scroll bar will be displayed.
|
||||||
|
* (the code indentation of the tag is not included in the width)
|
||||||
|
*/
|
||||||
|
public class IngestClientDocumentationIT extends ESRestHighLevelClientTestCase {
|
||||||
|
|
||||||
|
public void testPutPipeline() throws IOException {
|
||||||
|
RestHighLevelClient client = highLevelClient();
|
||||||
|
|
||||||
|
{
|
||||||
|
// tag::put-pipeline-request
|
||||||
|
String source =
|
||||||
|
"{\"description\":\"my set of processors\"," +
|
||||||
|
"\"processors\":[{\"set\":{\"field\":\"foo\",\"value\":\"bar\"}}]}";
|
||||||
|
PutPipelineRequest request = new PutPipelineRequest(
|
||||||
|
"my-pipeline-id", // <1>
|
||||||
|
new BytesArray(source.getBytes(StandardCharsets.UTF_8)), // <2>
|
||||||
|
XContentType.JSON // <3>
|
||||||
|
);
|
||||||
|
// end::put-pipeline-request
|
||||||
|
|
||||||
|
// tag::put-pipeline-request-timeout
|
||||||
|
request.timeout(TimeValue.timeValueMinutes(2)); // <1>
|
||||||
|
request.timeout("2m"); // <2>
|
||||||
|
// end::put-pipeline-request-timeout
|
||||||
|
|
||||||
|
// tag::put-pipeline-request-masterTimeout
|
||||||
|
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
||||||
|
request.masterNodeTimeout("1m"); // <2>
|
||||||
|
// end::put-pipeline-request-masterTimeout
|
||||||
|
|
||||||
|
// tag::put-pipeline-execute
|
||||||
|
WritePipelineResponse response = client.ingest().putPipeline(request); // <1>
|
||||||
|
// end::put-pipeline-execute
|
||||||
|
|
||||||
|
// tag::put-pipeline-response
|
||||||
|
boolean acknowledged = response.isAcknowledged(); // <1>
|
||||||
|
// end::put-pipeline-response
|
||||||
|
assertTrue(acknowledged);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testPutPipelineAsync() throws Exception {
|
||||||
|
RestHighLevelClient client = highLevelClient();
|
||||||
|
|
||||||
|
{
|
||||||
|
String source =
|
||||||
|
"{\"description\":\"my set of processors\"," +
|
||||||
|
"\"processors\":[{\"set\":{\"field\":\"foo\",\"value\":\"bar\"}}]}";
|
||||||
|
PutPipelineRequest request = new PutPipelineRequest(
|
||||||
|
"my-pipeline-id",
|
||||||
|
new BytesArray(source.getBytes(StandardCharsets.UTF_8)),
|
||||||
|
XContentType.JSON
|
||||||
|
);
|
||||||
|
|
||||||
|
// tag::put-pipeline-execute-listener
|
||||||
|
ActionListener<WritePipelineResponse> listener =
|
||||||
|
new ActionListener<WritePipelineResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(WritePipelineResponse response) {
|
||||||
|
// <1>
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Exception e) {
|
||||||
|
// <2>
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// end::put-pipeline-execute-listener
|
||||||
|
|
||||||
|
// Replace the empty listener by a blocking listener in test
|
||||||
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
listener = new LatchedActionListener<>(listener, latch);
|
||||||
|
|
||||||
|
// tag::put-pipeline-execute-async
|
||||||
|
client.ingest().putPipelineAsync(request, listener); // <1>
|
||||||
|
// end::put-pipeline-execute-async
|
||||||
|
|
||||||
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetPipeline() throws IOException {
|
||||||
|
RestHighLevelClient client = highLevelClient();
|
||||||
|
|
||||||
|
{
|
||||||
|
createPipeline("my-pipeline-id");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// tag::get-pipeline-request
|
||||||
|
GetPipelineRequest request = new GetPipelineRequest("my-pipeline-id"); // <1>
|
||||||
|
// end::get-pipeline-request
|
||||||
|
|
||||||
|
// tag::get-pipeline-request-masterTimeout
|
||||||
|
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
||||||
|
request.masterNodeTimeout("1m"); // <2>
|
||||||
|
// end::get-pipeline-request-masterTimeout
|
||||||
|
|
||||||
|
// tag::get-pipeline-execute
|
||||||
|
GetPipelineResponse response = client.ingest().getPipeline(request); // <1>
|
||||||
|
// end::get-pipeline-execute
|
||||||
|
|
||||||
|
// tag::get-pipeline-response
|
||||||
|
boolean successful = response.isFound(); // <1>
|
||||||
|
List<PipelineConfiguration> pipelines = response.pipelines(); // <2>
|
||||||
|
for(PipelineConfiguration pipeline: pipelines) {
|
||||||
|
Map<String, Object> config = pipeline.getConfigAsMap(); // <3>
|
||||||
|
}
|
||||||
|
// end::get-pipeline-response
|
||||||
|
|
||||||
|
assertTrue(successful);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetPipelineAsync() throws Exception {
|
||||||
|
RestHighLevelClient client = highLevelClient();
|
||||||
|
|
||||||
|
{
|
||||||
|
createPipeline("my-pipeline-id");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
GetPipelineRequest request = new GetPipelineRequest("my-pipeline-id");
|
||||||
|
|
||||||
|
// tag::get-pipeline-execute-listener
|
||||||
|
ActionListener<GetPipelineResponse> listener =
|
||||||
|
new ActionListener<GetPipelineResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(GetPipelineResponse response) {
|
||||||
|
// <1>
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Exception e) {
|
||||||
|
// <2>
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// end::get-pipeline-execute-listener
|
||||||
|
|
||||||
|
// Replace the empty listener by a blocking listener in test
|
||||||
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
listener = new LatchedActionListener<>(listener, latch);
|
||||||
|
|
||||||
|
// tag::get-pipeline-execute-async
|
||||||
|
client.ingest().getPipelineAsync(request, listener); // <1>
|
||||||
|
// end::get-pipeline-execute-async
|
||||||
|
|
||||||
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeletePipeline() throws IOException {
|
||||||
|
RestHighLevelClient client = highLevelClient();
|
||||||
|
|
||||||
|
{
|
||||||
|
createPipeline("my-pipeline-id");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// tag::delete-pipeline-request
|
||||||
|
DeletePipelineRequest request = new DeletePipelineRequest("my-pipeline-id"); // <1>
|
||||||
|
// end::delete-pipeline-request
|
||||||
|
|
||||||
|
// tag::delete-pipeline-request-timeout
|
||||||
|
request.timeout(TimeValue.timeValueMinutes(2)); // <1>
|
||||||
|
request.timeout("2m"); // <2>
|
||||||
|
// end::delete-pipeline-request-timeout
|
||||||
|
|
||||||
|
// tag::delete-pipeline-request-masterTimeout
|
||||||
|
request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); // <1>
|
||||||
|
request.masterNodeTimeout("1m"); // <2>
|
||||||
|
// end::delete-pipeline-request-masterTimeout
|
||||||
|
|
||||||
|
// tag::delete-pipeline-execute
|
||||||
|
WritePipelineResponse response = client.ingest().deletePipeline(request); // <1>
|
||||||
|
// end::delete-pipeline-execute
|
||||||
|
|
||||||
|
// tag::delete-pipeline-response
|
||||||
|
boolean acknowledged = response.isAcknowledged(); // <1>
|
||||||
|
// end::delete-pipeline-response
|
||||||
|
assertTrue(acknowledged);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDeletePipelineAsync() throws Exception {
|
||||||
|
RestHighLevelClient client = highLevelClient();
|
||||||
|
|
||||||
|
{
|
||||||
|
createPipeline("my-pipeline-id");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
DeletePipelineRequest request = new DeletePipelineRequest("my-pipeline-id");
|
||||||
|
|
||||||
|
// tag::delete-pipeline-execute-listener
|
||||||
|
ActionListener<WritePipelineResponse> listener =
|
||||||
|
new ActionListener<WritePipelineResponse>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(WritePipelineResponse response) {
|
||||||
|
// <1>
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Exception e) {
|
||||||
|
// <2>
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// end::delete-pipeline-execute-listener
|
||||||
|
|
||||||
|
// Replace the empty listener by a blocking listener in test
|
||||||
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
|
listener = new LatchedActionListener<>(listener, latch);
|
||||||
|
|
||||||
|
// tag::delete-pipeline-execute-async
|
||||||
|
client.ingest().deletePipelineAsync(request, listener); // <1>
|
||||||
|
// end::delete-pipeline-execute-async
|
||||||
|
|
||||||
|
assertTrue(latch.await(30L, TimeUnit.SECONDS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
[[java-rest-high-cluster-delete-pipeline]]
|
[[java-rest-high-ingest-delete-pipeline]]
|
||||||
=== Delete Pipeline API
|
=== Delete Pipeline API
|
||||||
|
|
||||||
[[java-rest-high-cluster-delete-pipeline-request]]
|
[[java-rest-high-ingest-delete-pipeline-request]]
|
||||||
==== Delete Pipeline Request
|
==== Delete Pipeline Request
|
||||||
|
|
||||||
A `DeletePipelineRequest` requires a pipeline `id` to delete.
|
A `DeletePipelineRequest` requires a pipeline `id` to delete.
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[delete-pipeline-request]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[delete-pipeline-request]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> The pipeline id to delete
|
<1> The pipeline id to delete
|
||||||
|
|
||||||
|
@ -17,28 +17,28 @@ The following arguments can optionally be provided:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[delete-pipeline-request-timeout]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[delete-pipeline-request-timeout]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Timeout to wait for the all the nodes to acknowledge the pipeline deletion as a `TimeValue`
|
<1> Timeout to wait for the all the nodes to acknowledge the pipeline deletion as a `TimeValue`
|
||||||
<2> Timeout to wait for the all the nodes to acknowledge the pipeline deletion as a `String`
|
<2> Timeout to wait for the all the nodes to acknowledge the pipeline deletion as a `String`
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[delete-pipeline-request-masterTimeout]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[delete-pipeline-request-masterTimeout]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Timeout to connect to the master node as a `TimeValue`
|
<1> Timeout to connect to the master node as a `TimeValue`
|
||||||
<2> Timeout to connect to the master node as a `String`
|
<2> Timeout to connect to the master node as a `String`
|
||||||
|
|
||||||
[[java-rest-high-cluster-delete-pipeline-sync]]
|
[[java-rest-high-ingest-delete-pipeline-sync]]
|
||||||
==== Synchronous Execution
|
==== Synchronous Execution
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[delete-pipeline-execute]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[delete-pipeline-execute]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Execute the request and get back the response in a `WritePipelineResponse` object.
|
<1> Execute the request and get back the response in a `WritePipelineResponse` object.
|
||||||
|
|
||||||
[[java-rest-high-cluster-delete-pipeline-async]]
|
[[java-rest-high-ingest-delete-pipeline-async]]
|
||||||
==== Asynchronous Execution
|
==== Asynchronous Execution
|
||||||
|
|
||||||
The asynchronous execution of a delete pipeline request requires both the `DeletePipelineRequest`
|
The asynchronous execution of a delete pipeline request requires both the `DeletePipelineRequest`
|
||||||
|
@ -47,7 +47,7 @@ method:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[delete-pipeline-execute-async]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[delete-pipeline-execute-async]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> The `DeletePipelineRequest` to execute and the `ActionListener` to use when
|
<1> The `DeletePipelineRequest` to execute and the `ActionListener` to use when
|
||||||
the execution completes
|
the execution completes
|
||||||
|
@ -61,13 +61,13 @@ A typical listener for `WritePipelineResponse` looks like:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[delete-pipeline-execute-listener]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[delete-pipeline-execute-listener]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Called when the execution is successfully completed. The response is
|
<1> Called when the execution is successfully completed. The response is
|
||||||
provided as an argument
|
provided as an argument
|
||||||
<2> Called in case of failure. The raised exception is provided as an argument
|
<2> Called in case of failure. The raised exception is provided as an argument
|
||||||
|
|
||||||
[[java-rest-high-cluster-delete-pipeline-response]]
|
[[java-rest-high-ingest-delete-pipeline-response]]
|
||||||
==== Delete Pipeline Response
|
==== Delete Pipeline Response
|
||||||
|
|
||||||
The returned `WritePipelineResponse` allows to retrieve information about the executed
|
The returned `WritePipelineResponse` allows to retrieve information about the executed
|
||||||
|
@ -75,6 +75,6 @@ The returned `WritePipelineResponse` allows to retrieve information about the ex
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[delete-pipeline-response]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[delete-pipeline-response]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Indicates whether all of the nodes have acknowledged the request
|
<1> Indicates whether all of the nodes have acknowledged the request
|
|
@ -1,14 +1,14 @@
|
||||||
[[java-rest-high-cluster-get-pipeline]]
|
[[java-rest-high-ingest-get-pipeline]]
|
||||||
=== Get Pipeline API
|
=== Get Pipeline API
|
||||||
|
|
||||||
[[java-rest-high-cluster-get-pipeline-request]]
|
[[java-rest-high-ingest-get-pipeline-request]]
|
||||||
==== Get Pipeline Request
|
==== Get Pipeline Request
|
||||||
|
|
||||||
A `GetPipelineRequest` requires one or more `pipelineIds` to fetch.
|
A `GetPipelineRequest` requires one or more `pipelineIds` to fetch.
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-pipeline-request]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[get-pipeline-request]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> The pipeline id to fetch
|
<1> The pipeline id to fetch
|
||||||
|
|
||||||
|
@ -17,21 +17,21 @@ The following arguments can optionally be provided:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-pipeline-request-masterTimeout]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[get-pipeline-request-masterTimeout]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Timeout to connect to the master node as a `TimeValue`
|
<1> Timeout to connect to the master node as a `TimeValue`
|
||||||
<2> Timeout to connect to the master node as a `String`
|
<2> Timeout to connect to the master node as a `String`
|
||||||
|
|
||||||
[[java-rest-high-cluster-get-pipeline-sync]]
|
[[java-rest-high-ingest-get-pipeline-sync]]
|
||||||
==== Synchronous Execution
|
==== Synchronous Execution
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-pipeline-execute]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[get-pipeline-execute]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Execute the request and get back the response in a GetPipelineResponse object.
|
<1> Execute the request and get back the response in a GetPipelineResponse object.
|
||||||
|
|
||||||
[[java-rest-high-cluster-get-pipeline-async]]
|
[[java-rest-high-ingest-get-pipeline-async]]
|
||||||
==== Asynchronous Execution
|
==== Asynchronous Execution
|
||||||
|
|
||||||
The asynchronous execution of a get pipeline request requires both the `GetPipelineRequest`
|
The asynchronous execution of a get pipeline request requires both the `GetPipelineRequest`
|
||||||
|
@ -40,7 +40,7 @@ method:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-pipeline-execute-async]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[get-pipeline-execute-async]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> The `GetPipelineRequest` to execute and the `ActionListener` to use when
|
<1> The `GetPipelineRequest` to execute and the `ActionListener` to use when
|
||||||
the execution completes
|
the execution completes
|
||||||
|
@ -54,13 +54,13 @@ A typical listener for `GetPipelineResponse` looks like:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-pipeline-execute-listener]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[get-pipeline-execute-listener]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Called when the execution is successfully completed. The response is
|
<1> Called when the execution is successfully completed. The response is
|
||||||
provided as an argument
|
provided as an argument
|
||||||
<2> Called in case of failure. The raised exception is provided as an argument
|
<2> Called in case of failure. The raised exception is provided as an argument
|
||||||
|
|
||||||
[[java-rest-high-cluster-get-pipeline-response]]
|
[[java-rest-high-ingest-get-pipeline-response]]
|
||||||
==== Get Pipeline Response
|
==== Get Pipeline Response
|
||||||
|
|
||||||
The returned `GetPipelineResponse` allows to retrieve information about the executed
|
The returned `GetPipelineResponse` allows to retrieve information about the executed
|
||||||
|
@ -68,7 +68,7 @@ The returned `GetPipelineResponse` allows to retrieve information about the exec
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[get-pipeline-response]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[get-pipeline-response]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Check if a matching pipeline id was found or not.
|
<1> Check if a matching pipeline id was found or not.
|
||||||
<2> Get the list of pipelines found as a list of `PipelineConfig` objects.
|
<2> Get the list of pipelines found as a list of `PipelineConfig` objects.
|
|
@ -1,7 +1,7 @@
|
||||||
[[java-rest-high-cluster-put-pipeline]]
|
[[java-rest-high-ingest-put-pipeline]]
|
||||||
=== Put Pipeline API
|
=== Put Pipeline API
|
||||||
|
|
||||||
[[java-rest-high-cluster-put-pipeline-request]]
|
[[java-rest-high-ingest-put-pipeline-request]]
|
||||||
==== Put Pipeline Request
|
==== Put Pipeline Request
|
||||||
|
|
||||||
A `PutPipelineRequest` requires an `id` argument, a source and a `XContentType`. The source consists
|
A `PutPipelineRequest` requires an `id` argument, a source and a `XContentType`. The source consists
|
||||||
|
@ -9,7 +9,7 @@ of a description and a list of `Processor` objects.
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-pipeline-request]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-request]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> The pipeline id
|
<1> The pipeline id
|
||||||
<2> The source for the pipeline as a `ByteArray`.
|
<2> The source for the pipeline as a `ByteArray`.
|
||||||
|
@ -20,28 +20,28 @@ The following arguments can optionally be provided:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-pipeline-request-timeout]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-request-timeout]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Timeout to wait for the all the nodes to acknowledge the pipeline creation as a `TimeValue`
|
<1> Timeout to wait for the all the nodes to acknowledge the pipeline creation as a `TimeValue`
|
||||||
<2> Timeout to wait for the all the nodes to acknowledge the pipeline creation as a `String`
|
<2> Timeout to wait for the all the nodes to acknowledge the pipeline creation as a `String`
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-pipeline-request-masterTimeout]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-request-masterTimeout]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Timeout to connect to the master node as a `TimeValue`
|
<1> Timeout to connect to the master node as a `TimeValue`
|
||||||
<2> Timeout to connect to the master node as a `String`
|
<2> Timeout to connect to the master node as a `String`
|
||||||
|
|
||||||
[[java-rest-high-cluster-put-pipeline-sync]]
|
[[java-rest-high-ingest-put-pipeline-sync]]
|
||||||
==== Synchronous Execution
|
==== Synchronous Execution
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-pipeline-execute]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-execute]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Execute the request and get back the response in a WritePipelineResponse object.
|
<1> Execute the request and get back the response in a WritePipelineResponse object.
|
||||||
|
|
||||||
[[java-rest-high-cluster-put-pipeline-async]]
|
[[java-rest-high-ingest-put-pipeline-async]]
|
||||||
==== Asynchronous Execution
|
==== Asynchronous Execution
|
||||||
|
|
||||||
The asynchronous execution of a put pipeline request requires both the `PutPipelineRequest`
|
The asynchronous execution of a put pipeline request requires both the `PutPipelineRequest`
|
||||||
|
@ -50,7 +50,7 @@ method:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-pipeline-execute-async]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-execute-async]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> The `PutPipelineRequest` to execute and the `ActionListener` to use when
|
<1> The `PutPipelineRequest` to execute and the `ActionListener` to use when
|
||||||
the execution completes
|
the execution completes
|
||||||
|
@ -64,13 +64,13 @@ A typical listener for `WritePipelineResponse` looks like:
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-pipeline-execute-listener]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-execute-listener]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Called when the execution is successfully completed. The response is
|
<1> Called when the execution is successfully completed. The response is
|
||||||
provided as an argument
|
provided as an argument
|
||||||
<2> Called in case of failure. The raised exception is provided as an argument
|
<2> Called in case of failure. The raised exception is provided as an argument
|
||||||
|
|
||||||
[[java-rest-high-cluster-put-pipeline-response]]
|
[[java-rest-high-ingest-put-pipeline-response]]
|
||||||
==== Put Pipeline Response
|
==== Put Pipeline Response
|
||||||
|
|
||||||
The returned `WritePipelineResponse` allows to retrieve information about the executed
|
The returned `WritePipelineResponse` allows to retrieve information about the executed
|
||||||
|
@ -78,6 +78,6 @@ The returned `WritePipelineResponse` allows to retrieve information about the ex
|
||||||
|
|
||||||
["source","java",subs="attributes,callouts,macros"]
|
["source","java",subs="attributes,callouts,macros"]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
include-tagged::{doc-tests}/ClusterClientDocumentationIT.java[put-pipeline-response]
|
include-tagged::{doc-tests}/IngestClientDocumentationIT.java[put-pipeline-response]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
<1> Indicates whether all of the nodes have acknowledged the request
|
<1> Indicates whether all of the nodes have acknowledged the request
|
|
@ -106,14 +106,19 @@ include::indices/put_template.asciidoc[]
|
||||||
The Java High Level REST Client supports the following Cluster APIs:
|
The Java High Level REST Client supports the following Cluster APIs:
|
||||||
|
|
||||||
* <<java-rest-high-cluster-put-settings>>
|
* <<java-rest-high-cluster-put-settings>>
|
||||||
* <<java-rest-high-cluster-put-pipeline>>
|
|
||||||
* <<java-rest-high-cluster-get-pipeline>>
|
|
||||||
* <<java-rest-high-cluster-delete-pipeline>>
|
|
||||||
|
|
||||||
include::cluster/put_settings.asciidoc[]
|
include::cluster/put_settings.asciidoc[]
|
||||||
include::cluster/put_pipeline.asciidoc[]
|
|
||||||
include::cluster/get_pipeline.asciidoc[]
|
== Ingest APIs
|
||||||
include::cluster/delete_pipeline.asciidoc[]
|
The Java High Level REST Client supports the following Ingest APIs:
|
||||||
|
|
||||||
|
* <<java-rest-high-ingest-put-pipeline>>
|
||||||
|
* <<java-rest-high-ingest-get-pipeline>>
|
||||||
|
* <<java-rest-high-ingest-delete-pipeline>>
|
||||||
|
|
||||||
|
include::ingest/put_pipeline.asciidoc[]
|
||||||
|
include::ingest/get_pipeline.asciidoc[]
|
||||||
|
include::ingest/delete_pipeline.asciidoc[]
|
||||||
|
|
||||||
== Snapshot APIs
|
== Snapshot APIs
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue