Submit Async Search API
editSubmit Async Search API
editRequest
editA SubmitAsyncSearchRequest
allows to submit an asynchronous search task to
the cluster. Required arguments are the SearchSourceBuilder
defining
the search and the target indices:
Optional arguments
editThe following arguments can optionally be provided:
Synchronous Execution
editAsynchronous Execution
editThe asynchronous execution of a SubmitAsyncSearchRequest
allows to use an
ActionListener
to be called back when the submit request returns. Note
that this is does not concern the execution of the submitted search request,
which always executes asynchronously. The listener, however, waits for the
submit request itself to come back:
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 AsyncSearchResponse
looks like:
Response
editThe returned AsyncSearchResponse
allows to retrieve information about the executed
operation as follows:
response.getSearchResponse(); response.getId(); response.isPartial(); response.isRunning(); response.getStartTime(); response.getExpirationTime(); response.getFailure();
The |
|
The id of the async search request, |
|
|
|
|
|
The time the response was created (millis since epoch) |
|
The time the response expires (millis since epoch) |
|
Get failure reasons or |