# Scrolling and lucene segments

**URL:** <https://discuss.elastic.co/t/scrolling-and-lucene-segments/21680>\
**Category:** Elasticsearch\
**Created:** [January 16, 2015, 9:15am UTC](https://discuss.elastic.co/t/scrolling-and-lucene-segments/21680 "2015-01-16T09:15:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Wee](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@Jason\_Wee](https://discuss.elastic.co/u/Jason_Wee)\
**Post date:** [January 16, 2015, 9:15am UTC](https://discuss.elastic.co/t/scrolling-and-lucene-segments/21680/1 "2015-01-16T09:15:48Z")

</div>

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-scroll.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-scroll.html)

Normally, the background merge process optimizes the index by merging  
together smaller segments to create new bigger segments, at which time the  
smaller segments are deleted. This process continues during scrolling, but  
an open search context prevents the old segments from being deleted while  
they are still in use. This is how Elasticsearch is able to return the  
results of the initial search request, regardless of subsequent changes to  
documents.

Tip  
Keeping older segments alive means that more file handles are needed.  
Ensure that you have configured your nodes to have ample free file handles.  
See the section called “File Descriptorsedit”.

Hello,

Read the above description, can anyone tell what happened to the segments  
after the scroll time expired? Does the segments will automatically merge?  
What if a lot (like 50 active) of scroll happened and how will it impact  
the lucene segment/elasticsearch? comments?

Jason

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2971e92d-397f-4d4b-a6da-0428a6cde638%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2971e92d-397f-4d4b-a6da-0428a6cde638%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [January 16, 2015, 5:20pm UTC](https://discuss.elastic.co/t/scrolling-and-lucene-segments/21680/2 "2015-01-16T17:20:41Z")

</div>

The segments are effectively ref counted, so once the last scroll still  
using an old (already merged away) segment is deleted, it will be removed.

Mike McCandless

[http://blog.mikemccandless.com](http://blog.mikemccandless.com)

On Fri, Jan 16, 2015 at 4:15 AM, Jason Wee [peichieh@gmail.com](mailto:peichieh@gmail.com) wrote:

> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-scroll.html)
> 
> Normally, the background merge process optimizes the index by merging  
> together smaller segments to create new bigger segments, at which time the  
> smaller segments are deleted. This process continues during scrolling, but  
> an open search context prevents the old segments from being deleted while  
> they are still in use. This is how Elasticsearch is able to return the  
> results of the initial search request, regardless of subsequent changes to  
> documents.
> 
> Tip  
> Keeping older segments alive means that more file handles are needed.  
> Ensure that you have configured your nodes to have ample free file handles.  
> See the section called “File Descriptorsedit”.
> 
> Hello,
> 
> Read the above description, can anyone tell what happened to the segments  
> after the scroll time expired? Does the segments will automatically merge?  
> What if a lot (like 50 active) of scroll happened and how will it impact  
> the lucene segment/elasticsearch? comments?
> 
> Jason
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/2971e92d-397f-4d4b-a6da-0428a6cde638%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2971e92d-397f-4d4b-a6da-0428a6cde638%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/2971e92d-397f-4d4b-a6da-0428a6cde638%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/2971e92d-397f-4d4b-a6da-0428a6cde638%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAD7smRfPHTg6K7A9jn%3D3nT26hjmCBUkydzFZzyJNn8pxv8g%3DdA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAD7smRfPHTg6K7A9jn%3D3nT26hjmCBUkydzFZzyJNn8pxv8g%3DdA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:38am UTC](https://discuss.elastic.co/t/scrolling-and-lucene-segments/21680/3 "2017-07-06T00:38:21Z")

</div>


