Get Pipeline API

edit

Get Pipeline Request

edit

A GetPipelineRequest requires one or more pipelineIds to fetch.

GetPipelineRequest request = new GetPipelineRequest("my-pipeline-id"); 

The pipeline id to fetch

Optional arguments

edit

The following arguments can optionally be provided:

request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); 
request.masterNodeTimeout("1m"); 

Timeout to connect to the master node as a TimeValue

Timeout to connect to the master node as a String

Synchronous Execution

edit
GetPipelineResponse response = client.ingest().getPipeline(request, RequestOptions.DEFAULT); 

Execute the request and get back the response in a GetPipelineResponse object.

Asynchronous Execution

edit

The asynchronous execution of a get pipeline request requires both the GetPipelineRequest instance and an ActionListener instance to be passed to the asynchronous method:

client.ingest().getPipelineAsync(request, RequestOptions.DEFAULT, listener); 

The GetPipelineRequest to execute and the ActionListener to use when the execution completes

The asynchronous method does not block and returns immediately. Once it is completed the ActionListener is called back using the onResponse method if the execution successfully completed or using the onFailure method if it failed.

A typical listener for GetPipelineResponse looks like:

ActionListener<GetPipelineResponse> listener =
    new ActionListener<GetPipelineResponse>() {
        @Override
        public void onResponse(GetPipelineResponse response) {
            
        }

        @Override
        public void onFailure(Exception e) {
            
        }
    };

Called when the execution is successfully completed. The response is provided as an argument

Called in case of failure. The raised exception is provided as an argument

Get Pipeline Response

edit

The returned GetPipelineResponse allows to retrieve information about the executed operation as follows:

boolean successful = response.isFound(); 
List<PipelineConfiguration> pipelines = response.pipelines(); 
for(PipelineConfiguration pipeline: pipelines) {
    Map<String, Object> config = pipeline.getConfigAsMap(); 
}

Check if a matching pipeline id was found or not.

Get the list of pipelines found as a list of PipelineConfig objects.

Get the individual configuration of each pipeline as a Map<String, Object>.