# Asynchronous search using Java API?

**URL:** <https://discuss.elastic.co/t/asynchronous-search-using-java-api/4849>\
**Category:** Elasticsearch\
**Created:** [July 13, 2011, 8:51am UTC](https://discuss.elastic.co/t/asynchronous-search-using-java-api/4849 "2011-07-13T08:51:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hari\_Shankar](https://avatars.discourse-cdn.com/v4/letter/h/ad7895/32.png) [@Hari\_Shankar](https://discuss.elastic.co/u/Hari_Shankar)\
**Post date:** [July 13, 2011, 8:51am UTC](https://discuss.elastic.co/t/asynchronous-search-using-java-api/4849/1 "2011-07-13T08:51:42Z")

</div>

Hi,

I am trying to implement pre-fetching of results from elasticsearch. For  
this, it would be good if there was a way to search asynchronously. For  
example, if I have get the first 100 results in the first query and I have  
reached result # 80, then I can asynchronously fetch the next 100 hits so  
that when I reach result # 100, the user doesn't have to wait before she can  
view result # 101. How can I implement this?

Thanks,  
Hari

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [July 13, 2011, 11:06am UTC](https://discuss.elastic.co/t/asynchronous-search-using-java-api/4849/2 "2011-07-13T11:06:27Z")

</div>

Normally queries are in the millisecond range. So intercepting them  
shouldn't be necessary for a responsive UI. You can simple spawn a  
thread or hold further results in 'cache' (e.g. fetching 20 records +  
showing only 10).

On 13 Jul., 10:51, Hari Shankar [shaan.h...@gmail.com](mailto:shaan.h...@gmail.com) wrote:

> Hi,
> 
> I am trying to implement pre-fetching of results from elasticsearch. For  
> this, it would be good if there was a way to search asynchronously. For  
> example, if I have get the first 100 results in the first query and I have  
> reached result # 80, then I can asynchronously fetch the next 100 hits so  
> that when I reach result # 100, the user doesn't have to wait before she can  
> view result # 101. How can I implement this?
> 
> Thanks,  
> Hari

---

<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:** [July 6, 2017, 4:00am UTC](https://discuss.elastic.co/t/asynchronous-search-using-java-api/4849/3 "2017-07-06T04:00:48Z")

</div>


