See the guide below to implement searchAsync.
Search API
However, I get the following error.
The method searchAsync(SearchRequest, RequestOptions, ActionListener<SearchResponse>) from the type RestHighLevelClient refers to the missing type Cancellable
Below is the API I used.
ActionListener<SearchResponse> listener = new ActionListener<SearchResponse>() {
@Override
public void onResponse(SearchResponse searchResponse) {
}
@Override
public void onFailure(Exception e) {
}
};
elasticClient.searchAsync(searchRequest, RequestOptions.DEFAULT, listener);