# Good way to implement "Next hit"

**URL:** <https://discuss.elastic.co/t/good-way-to-implement-next-hit/7964>\
**Category:** Elasticsearch\
**Created:** [June 4, 2012, 12:37pm UTC](https://discuss.elastic.co/t/good-way-to-implement-next-hit/7964 "2012-06-04T12:37:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremie\_BORDIER1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeremie_bordier1/32/2860_2.png) [@Jeremie\_BORDIER1](https://discuss.elastic.co/u/Jeremie_BORDIER1)\
**Post date:** [June 4, 2012, 12:37pm UTC](https://discuss.elastic.co/t/good-way-to-implement-next-hit/7964/1 "2012-06-04T12:37:20Z")

</div>

Hi,

What would be the best way to implement a more or less consistent  
"Next hit" feature ?

Use case would be to display a hit details page, and be able to go  
straight to the next document without going back on the search page.  
If possible, the next hit request would still be consistent even if  
new documents were indexed in the meantime.

Any non hacky suggestion ?

Thanks,  
Jérémie

---

<div class="post-metadata">

**Author:** ![Benjamin\_Deveze](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benjamin_deveze/32/1577_2.png) [@Benjamin\_Deveze](https://discuss.elastic.co/u/Benjamin_Deveze)\
**Post date:** [June 4, 2012, 3:26pm UTC](https://discuss.elastic.co/t/good-way-to-implement-next-hit/7964/2 "2012-06-04T15:26:13Z")

</div>

Hi,

maybe a search request for N hits with preference param set to session  
id and maybe a date\<=first\_request\_time.  
Then if the user hit next you display next result. When user reaches  
Nth result you do the same request with preference  
and date condition to fetch N new result etc.

On Mon, Jun 4, 2012 at 2:37 PM, Jérémie BORDIER  
[jeremie.bordier@gmail.com](mailto:jeremie.bordier@gmail.com) wrote:

> Hi,
> 
> What would be the best way to implement a more or less consistent  
> "Next hit" feature ?
> 
> Use case would be to display a hit details page, and be able to go  
> straight to the next document without going back on the search page.  
> If possible, the next hit request would still be consistent even if  
> new documents were indexed in the meantime.
> 
> Any non hacky suggestion ?
> 
> Thanks,  
> Jérémie

--  
Benjamin DEVEZE

---

<div class="post-metadata">

**Author:** ![Jeremie\_BORDIER1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeremie_bordier1/32/2860_2.png) [@Jeremie\_BORDIER1](https://discuss.elastic.co/u/Jeremie_BORDIER1)\
**Post date:** [June 4, 2012, 9:40pm UTC](https://discuss.elastic.co/t/good-way-to-implement-next-hit/7964/3 "2012-06-04T21:40:31Z")

</div>

Thanks for your suggestion Benjamin, that's more or less what I had in  
mind.. I'll keep the last search hit ids in session and fetch the  
previous / next batches if required.

Cheers,  
Jérémie

On Mon, Jun 4, 2012 at 5:26 PM, Benjamin Devèze  
[benjamin.deveze@gmail.com](mailto:benjamin.deveze@gmail.com) wrote:

> Hi,
> 
> maybe a search request for N hits with preference param set to session  
> id and maybe a date\<=first\_request\_time.  
> Then if the user hit next you display next result. When user reaches  
> Nth result you do the same request with preference  
> and date condition to fetch N new result etc.
> 
> On Mon, Jun 4, 2012 at 2:37 PM, Jérémie BORDIER  
> [jeremie.bordier@gmail.com](mailto:jeremie.bordier@gmail.com) wrote:
> 
> > Hi,
> > 
> > What would be the best way to implement a more or less consistent  
> > "Next hit" feature ?
> > 
> > Use case would be to display a hit details page, and be able to go  
> > straight to the next document without going back on the search page.  
> > If possible, the next hit request would still be consistent even if  
> > new documents were indexed in the meantime.
> > 
> > Any non hacky suggestion ?
> > 
> > Thanks,  
> > Jérémie
> 
> --  
> Benjamin DEVEZE

--  
Jérémie 'ahFeel' BORDIER

---

<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, 3:25am UTC](https://discuss.elastic.co/t/good-way-to-implement-next-hit/7964/4 "2017-07-06T03:25:40Z")

</div>

Closed on July 6, 2017, 3:25am UTC


