# Can not uses "searchAsync"

**URL:** <https://discuss.elastic.co/t/can-not-uses-searchasync/212795>\
**Category:** Elasticsearch\
**Created:** [December 23, 2019, 1:27am UTC](https://discuss.elastic.co/t/can-not-uses-searchasync/212795 "2019-12-23T01:27:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xodn0812](https://avatars.discourse-cdn.com/v4/letter/x/c5a1d2/32.png) [@xodn0812](https://discuss.elastic.co/u/xodn0812)\
**Post date:** [December 23, 2019, 1:27am UTC](https://discuss.elastic.co/t/can-not-uses-searchasync/212795/1 "2019-12-23T01:27:32Z")

</div>

See the guide below to implement searchAsync.  
[Search API](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.5/java-rest-high-search.html)

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);
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 20, 2020, 1:27am UTC](https://discuss.elastic.co/t/can-not-uses-searchasync/212795/2 "2020-01-20T01:27:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
