Class ElasticsearchTasksClient
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
Fields inherited from class co.elastic.clients.ApiClient
transport, transportOptions -
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchTasksClient(ElasticsearchTransport transport) ElasticsearchTasksClient(ElasticsearchTransport transport, TransportOptions transportOptions) -
Method Summary
Modifier and TypeMethodDescriptioncancel()Cancel a task.cancel(CancelRequest request) Cancel a task.final CancelResponseCancel a task.get(GetTasksRequest request) Get task information.final GetTasksResponseGet task information.list()Get all tasks.list(ListRequest request) Get all tasks.final ListResponseGet all tasks.withTransportOptions(TransportOptions transportOptions) Creates a new client with some request optionsMethods inherited from class co.elastic.clients.ApiClient
_jsonpMapper, _transport, _transportOptions, close, getDeserializer, withTransportOptions
-
Constructor Details
-
ElasticsearchTasksClient
-
ElasticsearchTasksClient
public ElasticsearchTasksClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions)
-
-
Method Details
-
withTransportOptions
Description copied from class:ApiClientCreates a new client with some request options- Specified by:
withTransportOptionsin classApiClient<ElasticsearchTransport,ElasticsearchTasksClient>
-
cancel
Cancel a task.WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible.
A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. The get task information API will continue to list these cancelled tasks until they complete. The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible.
To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the
?detailedparameter to identify the other tasks the system is running. You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task.- Throws:
IOExceptionElasticsearchException- See Also:
-
cancel
public final CancelResponse cancel(Function<CancelRequest.Builder, ObjectBuilder<CancelRequest>> fn) throws IOException, ElasticsearchExceptionCancel a task.WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible.
A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. The get task information API will continue to list these cancelled tasks until they complete. The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible.
To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the
?detailedparameter to identify the other tasks the system is running. You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task.- Parameters:
fn- a function that initializes a builder to create theCancelRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
cancel
Cancel a task.WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible.
A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. The get task information API will continue to list these cancelled tasks until they complete. The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible.
To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the
?detailedparameter to identify the other tasks the system is running. You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task.- Throws:
IOExceptionElasticsearchException- See Also:
-
get
Get task information. Get information about a task currently running in the cluster.WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible.
If the task identifier is not found, a 404 response code indicates that there are no resources that match the request.
- Throws:
IOExceptionElasticsearchException- See Also:
-
get
public final GetTasksResponse get(Function<GetTasksRequest.Builder, ObjectBuilder<GetTasksRequest>> fn) throws IOException, ElasticsearchExceptionGet task information. Get information about a task currently running in the cluster.WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible.
If the task identifier is not found, a 404 response code indicates that there are no resources that match the request.
- Parameters:
fn- a function that initializes a builder to create theGetTasksRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
list
Get all tasks. Get information about the tasks currently running on one or more nodes in the cluster.WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible.
Identifying running tasks
The
X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. This enables you to track certain calls or associate certain tasks with the client that started them. For example:curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents"The API returns the following result:
HTTP/1.1 200 OK X-Opaque-Id: 123456 content-type: application/json; charset=UTF-8 content-length: 831 { "tasks" : { "u5lcZHqcQhu-rUoFaqDphA:45" : { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 45, "type" : "transport", "action" : "cluster:monitor/tasks/lists", "start_time_in_millis" : 1513823752749, "running_time_in_nanos" : 293139, "cancellable" : false, "headers" : { "X-Opaque-Id" : "123456" }, "children" : [ { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 46, "type" : "direct", "action" : "cluster:monitor/tasks/lists[n]", "start_time_in_millis" : 1513823752750, "running_time_in_nanos" : 92133, "cancellable" : false, "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", "headers" : { "X-Opaque-Id" : "123456" } } ] } } }In this example,
X-Opaque-Id: 123456is the ID as a part of the response header. TheX-Opaque-Idin the taskheadersis the ID for the task that was initiated by the REST request. TheX-Opaque-Idin the childrenheadersis the child task of the task that was initiated by the REST request.- Throws:
IOExceptionElasticsearchException- See Also:
-
list
public final ListResponse list(Function<ListRequest.Builder, ObjectBuilder<ListRequest>> fn) throws IOException, ElasticsearchExceptionGet all tasks. Get information about the tasks currently running on one or more nodes in the cluster.WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible.
Identifying running tasks
The
X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. This enables you to track certain calls or associate certain tasks with the client that started them. For example:curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents"The API returns the following result:
HTTP/1.1 200 OK X-Opaque-Id: 123456 content-type: application/json; charset=UTF-8 content-length: 831 { "tasks" : { "u5lcZHqcQhu-rUoFaqDphA:45" : { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 45, "type" : "transport", "action" : "cluster:monitor/tasks/lists", "start_time_in_millis" : 1513823752749, "running_time_in_nanos" : 293139, "cancellable" : false, "headers" : { "X-Opaque-Id" : "123456" }, "children" : [ { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 46, "type" : "direct", "action" : "cluster:monitor/tasks/lists[n]", "start_time_in_millis" : 1513823752750, "running_time_in_nanos" : 92133, "cancellable" : false, "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", "headers" : { "X-Opaque-Id" : "123456" } } ] } } }In this example,
X-Opaque-Id: 123456is the ID as a part of the response header. TheX-Opaque-Idin the taskheadersis the ID for the task that was initiated by the REST request. TheX-Opaque-Idin the childrenheadersis the child task of the task that was initiated by the REST request.- Parameters:
fn- a function that initializes a builder to create theListRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
list
Get all tasks. Get information about the tasks currently running on one or more nodes in the cluster.WARNING: The task management API is new and should still be considered a beta feature. The API may change in ways that are not backwards compatible.
Identifying running tasks
The
X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. This enables you to track certain calls or associate certain tasks with the client that started them. For example:curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents"The API returns the following result:
HTTP/1.1 200 OK X-Opaque-Id: 123456 content-type: application/json; charset=UTF-8 content-length: 831 { "tasks" : { "u5lcZHqcQhu-rUoFaqDphA:45" : { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 45, "type" : "transport", "action" : "cluster:monitor/tasks/lists", "start_time_in_millis" : 1513823752749, "running_time_in_nanos" : 293139, "cancellable" : false, "headers" : { "X-Opaque-Id" : "123456" }, "children" : [ { "node" : "u5lcZHqcQhu-rUoFaqDphA", "id" : 46, "type" : "direct", "action" : "cluster:monitor/tasks/lists[n]", "start_time_in_millis" : 1513823752750, "running_time_in_nanos" : 92133, "cancellable" : false, "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45", "headers" : { "X-Opaque-Id" : "123456" } } ] } } }In this example,
X-Opaque-Id: 123456is the ID as a part of the response header. TheX-Opaque-Idin the taskheadersis the ID for the task that was initiated by the REST request. TheX-Opaque-Idin the childrenheadersis the child task of the task that was initiated by the REST request.- Throws:
IOExceptionElasticsearchException- See Also:
-