# Requests and segments

**URL:** <https://discuss.elastic.co/t/requests-and-segments/194446>\
**Category:** Elasticsearch\
**Created:** [August 8, 2019, 2:03pm UTC](https://discuss.elastic.co/t/requests-and-segments/194446 "2019-08-08T14:03:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbie1](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@newbie1](https://discuss.elastic.co/u/newbie1)\
**Post date:** [August 8, 2019, 2:03pm UTC](https://discuss.elastic.co/t/requests-and-segments/194446/1 "2019-08-08T14:03:00Z")

</div>

Hi,  
During the course "Elasticsearch Engineer II", it is said :  
"A search request is distributed to the shards and on each  
shard it is performed sequentially over the segments"

Does that means that if tow requests arrive on a shard, the second waits until the first one finishes to request all segments ?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 9, 2019, 5:27am UTC](https://discuss.elastic.co/t/requests-and-segments/194446/2 "2019-08-09T05:27:28Z")

</div>

no, this is statement is not about concurrent searches, but how a single search is handled. Two searches coming in at parallel will also be searched in parallel.

Still a single search over a lucene index (which is essentially a shard) will go through each of the segments sequentially.

Hope this clears things up, if not, let's reiterate 🙂

---

<div class="post-metadata">

**Author:** ![newbie1](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@newbie1](https://discuss.elastic.co/u/newbie1)\
**Post date:** [August 9, 2019, 7:07am UTC](https://discuss.elastic.co/t/requests-and-segments/194446/3 "2019-08-09T07:07:49Z")

</div>

A great thanks, your answer is perfect.

A new question in this case, does the number of segments impact the request processing duiration ? If there is less segment does this duration decrease ? If yes is it a good practice to call a forcemerge after mass insertions ?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 9, 2019, 9:21am UTC](https://discuss.elastic.co/t/requests-and-segments/194446/4 "2019-08-09T09:21:33Z")

</div>

less segments is usually a faster search, this is why merging happens also in the background. forcemerging mostly makes sense if you have data that gets written once and then never is written again (no deletes, no update, no indexes).

---

<div class="post-metadata">

**Author:** ![newbie1](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@newbie1](https://discuss.elastic.co/u/newbie1)\
**Post date:** [August 9, 2019, 12:25pm UTC](https://discuss.elastic.co/t/requests-and-segments/194446/5 "2019-08-09T12:25:51Z")

</div>

Ok thanks again for this "tip" and for the whole explanation.

---

<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:** [September 6, 2019, 12:25pm UTC](https://discuss.elastic.co/t/requests-and-segments/194446/6 "2019-09-06T12:25:52Z")

</div>

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