Get Rollup Job API

edit

This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.

The Get Rollup Job API can be used to get one or all rollup jobs from the cluster. It accepts a GetRollupJobRequest object as a request and returns a GetRollupJobResponse.

Get Rollup Job Request

edit

A GetRollupJobRequest can be built without any parameters to get all of the rollup jobs or with a job name to get a single job:

GetRollupJobRequest getAll = new GetRollupJobRequest();        
GetRollupJobRequest getJob = new GetRollupJobRequest("job_1"); 

Gets all jobs.

Gets job_1.

Execution

edit

The Get Rollup Job API can be executed through a RollupClient instance. Such instance can be retrieved from a RestHighLevelClient using the rollup() method:

GetRollupJobResponse response = client.rollup().getRollupJob(getJob, RequestOptions.DEFAULT);

Response

edit

The returned GetRollupJobResponse includes a JobWrapper per returned job which contains the configuration of the job, the job’s current status, and statistics about the job’s past execution.

assertThat(response.getJobs(), hasSize(1));
JobWrapper job = response.getJobs().get(0); 
RollupJobConfig config = job.getJob();
RollupJobStatus status = job.getStatus();
RollupIndexerJobStats stats = job.getStats();

We only asked for a single job

Asynchronous Execution

edit

This request can be executed asynchronously:

client.rollup().getRollupJobAsync(getJob, RequestOptions.DEFAULT, listener); 

The GetRollupJobRequest 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 GetRollupJobResponse looks like:

ActionListener<GetRollupJobResponse> listener = new ActionListener<GetRollupJobResponse>() {
    @Override
    public void onResponse(GetRollupJobResponse 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