|
|
@@ -16,6 +16,7 @@ import org.elasticsearch.action.ingest.PutPipelineRequest;
|
|
|
import org.elasticsearch.action.ingest.SimulatePipelineRequest;
|
|
|
import org.elasticsearch.action.ingest.SimulatePipelineResponse;
|
|
|
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
|
|
+import org.elasticsearch.client.core.MainRequest;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.Collections;
|
|
|
@@ -39,13 +40,14 @@ public final class IngestClient {
|
|
|
* Add a pipeline or update an existing pipeline.
|
|
|
* See
|
|
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
|
|
|
+ *
|
|
|
* @param request the request
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @return the response
|
|
|
* @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
*/
|
|
|
public AcknowledgedResponse putPipeline(PutPipelineRequest request, RequestOptions options) throws IOException {
|
|
|
- return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::putPipeline, options,
|
|
|
+ return restHighLevelClient.performRequestAndParseEntity(request, IngestRequestConverters::putPipeline, options,
|
|
|
AcknowledgedResponse::fromXContent, emptySet());
|
|
|
}
|
|
|
|
|
|
@@ -53,13 +55,14 @@ public final class IngestClient {
|
|
|
* Asynchronously add a pipeline or update an existing pipeline.
|
|
|
* See
|
|
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
|
|
|
- * @param request the request
|
|
|
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ *
|
|
|
+ * @param request the request
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @param listener the listener to be notified upon request completion
|
|
|
* @return cancellable that may be used to cancel the request
|
|
|
*/
|
|
|
public Cancellable putPipelineAsync(PutPipelineRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener) {
|
|
|
- return restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::putPipeline, options,
|
|
|
+ return restHighLevelClient.performRequestAsyncAndParseEntity(request, IngestRequestConverters::putPipeline, options,
|
|
|
AcknowledgedResponse::fromXContent, listener, emptySet());
|
|
|
}
|
|
|
|
|
|
@@ -67,13 +70,14 @@ public final class IngestClient {
|
|
|
* Get an existing pipeline.
|
|
|
* See
|
|
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/get-pipeline-api.html"> Get Pipeline API on elastic.co</a>
|
|
|
+ *
|
|
|
* @param request the request
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @return the response
|
|
|
* @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
*/
|
|
|
public GetPipelineResponse getPipeline(GetPipelineRequest request, RequestOptions options) throws IOException {
|
|
|
- return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::getPipeline, options,
|
|
|
+ return restHighLevelClient.performRequestAndParseEntity(request, IngestRequestConverters::getPipeline, options,
|
|
|
GetPipelineResponse::fromXContent, Collections.singleton(404));
|
|
|
}
|
|
|
|
|
|
@@ -81,13 +85,14 @@ public final class IngestClient {
|
|
|
* Asynchronously get an existing pipeline.
|
|
|
* See
|
|
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html"> Get Pipeline API on elastic.co</a>
|
|
|
- * @param request the request
|
|
|
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ *
|
|
|
+ * @param request the request
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @param listener the listener to be notified upon request completion
|
|
|
* @return cancellable that may be used to cancel the request
|
|
|
*/
|
|
|
public Cancellable getPipelineAsync(GetPipelineRequest request, RequestOptions options, ActionListener<GetPipelineResponse> listener) {
|
|
|
- return restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::getPipeline, options,
|
|
|
+ return restHighLevelClient.performRequestAsyncAndParseEntity(request, IngestRequestConverters::getPipeline, options,
|
|
|
GetPipelineResponse::fromXContent, listener, Collections.singleton(404));
|
|
|
}
|
|
|
|
|
|
@@ -95,14 +100,15 @@ public final class IngestClient {
|
|
|
* Delete an existing pipeline.
|
|
|
* See
|
|
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html">
|
|
|
- * Delete Pipeline API on elastic.co</a>
|
|
|
+ * Delete Pipeline API on elastic.co</a>
|
|
|
+ *
|
|
|
* @param request the request
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @return the response
|
|
|
* @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
*/
|
|
|
public AcknowledgedResponse deletePipeline(DeletePipelineRequest request, RequestOptions options) throws IOException {
|
|
|
- return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::deletePipeline, options,
|
|
|
+ return restHighLevelClient.performRequestAndParseEntity(request, IngestRequestConverters::deletePipeline, options,
|
|
|
AcknowledgedResponse::fromXContent, emptySet());
|
|
|
}
|
|
|
|
|
|
@@ -110,15 +116,16 @@ public final class IngestClient {
|
|
|
* Asynchronously delete an existing pipeline.
|
|
|
* See
|
|
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html">
|
|
|
- * Delete Pipeline API on elastic.co</a>
|
|
|
- * @param request the request
|
|
|
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ * Delete Pipeline API on elastic.co</a>
|
|
|
+ *
|
|
|
+ * @param request the request
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @param listener the listener to be notified upon request completion
|
|
|
* @return cancellable that may be used to cancel the request
|
|
|
*/
|
|
|
public Cancellable deletePipelineAsync(DeletePipelineRequest request, RequestOptions options,
|
|
|
ActionListener<AcknowledgedResponse> listener) {
|
|
|
- return restHighLevelClient.performRequestAsyncAndParseEntity( request,
|
|
|
+ return restHighLevelClient.performRequestAsyncAndParseEntity(request,
|
|
|
IngestRequestConverters::deletePipeline, options,
|
|
|
AcknowledgedResponse::fromXContent, listener, emptySet());
|
|
|
}
|
|
|
@@ -128,14 +135,15 @@ public final class IngestClient {
|
|
|
* <p>
|
|
|
* See
|
|
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html">
|
|
|
- * Simulate Pipeline API on elastic.co</a>
|
|
|
+ * Simulate Pipeline API on elastic.co</a>
|
|
|
+ *
|
|
|
* @param request the request
|
|
|
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @return the response
|
|
|
* @throws IOException in case there is a problem sending the request or parsing back the response
|
|
|
*/
|
|
|
public SimulatePipelineResponse simulate(SimulatePipelineRequest request, RequestOptions options) throws IOException {
|
|
|
- return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::simulatePipeline, options,
|
|
|
+ return restHighLevelClient.performRequestAndParseEntity(request, IngestRequestConverters::simulatePipeline, options,
|
|
|
SimulatePipelineResponse::fromXContent, emptySet());
|
|
|
}
|
|
|
|
|
|
@@ -144,16 +152,27 @@ public final class IngestClient {
|
|
|
* <p>
|
|
|
* See
|
|
|
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html">
|
|
|
- * Simulate Pipeline API on elastic.co</a>
|
|
|
- * @param request the request
|
|
|
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
+ * Simulate Pipeline API on elastic.co</a>
|
|
|
+ *
|
|
|
+ * @param request the request
|
|
|
+ * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
|
|
|
* @param listener the listener to be notified upon request completion
|
|
|
* @return cancellable that may be used to cancel the request
|
|
|
*/
|
|
|
public Cancellable simulateAsync(SimulatePipelineRequest request,
|
|
|
RequestOptions options,
|
|
|
ActionListener<SimulatePipelineResponse> listener) {
|
|
|
- return restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::simulatePipeline, options,
|
|
|
+ return restHighLevelClient.performRequestAsyncAndParseEntity(request, IngestRequestConverters::simulatePipeline, options,
|
|
|
SimulatePipelineResponse::fromXContent, listener, emptySet());
|
|
|
}
|
|
|
+
|
|
|
+ public GeoIpStatsResponse geoIpStats(MainRequest request, RequestOptions options) throws IOException {
|
|
|
+ return restHighLevelClient.performRequestAndParseEntity(new MainRequest(), IngestRequestConverters::geoIpStats, options,
|
|
|
+ GeoIpStatsResponse::fromXContent, emptySet());
|
|
|
+ }
|
|
|
+
|
|
|
+ public Cancellable geoIpStatsAsync(MainRequest request, RequestOptions options, ActionListener<GeoIpStatsResponse> listener) {
|
|
|
+ return restHighLevelClient.performRequestAsyncAndParseEntity(request, IngestRequestConverters::geoIpStats, options,
|
|
|
+ GeoIpStatsResponse::fromXContent, listener, emptySet());
|
|
|
+ }
|
|
|
}
|