# How will High level rest client async calls return value

**URL:** <https://discuss.elastic.co/t/how-will-high-level-rest-client-async-calls-return-value/105469>\
**Category:** Elasticsearch\
**Created:** [October 26, 2017, 6:52pm UTC](https://discuss.elastic.co/t/how-will-high-level-rest-client-async-calls-return-value/105469 "2017-10-26T18:52:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhavalk123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dhavalk123/32/63294_2.png) [@dhavalk123](https://discuss.elastic.co/u/dhavalk123)\
**Post date:** [October 26, 2017, 6:52pm UTC](https://discuss.elastic.co/t/how-will-high-level-rest-client-async-calls-return-value/105469/1 "2017-10-26T18:52:54Z")

</div>

I am using the high level rest client and calling:

client.indexAsync(request, new ActionListener() {  
public void onResponse(IndexResponse indexResponse) {  
}  
public void onFailure(Exception e) {  
}  
}

I want to convert the response to RxJava observable and give it back to the controller. But indexAsync does not have a return. Could someone please help me out?

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [November 3, 2017, 10:29am UTC](https://discuss.elastic.co/t/how-will-high-level-rest-client-async-calls-return-value/105469/2 "2017-11-03T10:29:21Z")

</div>

Hi,  
the response is returned via the ActionListener, the way to get it is to create your own ActionListener and pass it in to your indexAsync call. Why would you need a return value and what type would it be?

Cheers  
Luca

---

<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:** [December 1, 2017, 10:30am UTC](https://discuss.elastic.co/t/how-will-high-level-rest-client-async-calls-return-value/105469/3 "2017-12-01T10:30:03Z")

</div>

Closed on December 1, 2017, 10:30am UTC

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