# Segment Merge query

**URL:** <https://discuss.elastic.co/t/segment-merge-query/57418>\
**Category:** Elasticsearch\
**Created:** [August 7, 2016, 9:05am UTC](https://discuss.elastic.co/t/segment-merge-query/57418 "2016-08-07T09:05:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hariharan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hariharan/32/130501_2.png) [@Hariharan](https://discuss.elastic.co/u/Hariharan)\
**Post date:** [August 7, 2016, 9:05am UTC](https://discuss.elastic.co/t/segment-merge-query/57418/1 "2016-08-07T09:05:28Z")

</div>

So I've been working on Elasticsearch for nearly two years now, and I love it 😌 I've a question regarding the underlying mechanism during a merge.

When two segments S1 and S2 are merged together, the data from S1 and S2 are written to a new segment S3 and S1 and S2 are then discarded.

So my question is, the data transferred into S3, is it like a copy of data from S1 and S2 (meaning like the inverted index, stored fields, doc values, etc are copied) ?? Or is it like the \_source from S1 and S2 are used to "reindex" data internally to S3 ?? 🤔

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [August 7, 2016, 9:12am UTC](https://discuss.elastic.co/t/segment-merge-query/57418/2 "2016-08-07T09:12:49Z")

</div>

It's more the former, not a reindex.

I don't know the low level "how" of it though, maybe one of the core team can point you to the code if you are really interested 🙂

---

<div class="post-metadata">

**Author:** ![Hariharan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hariharan/32/130501_2.png) [@Hariharan](https://discuss.elastic.co/u/Hariharan)\
**Post date:** [August 7, 2016, 8:13pm UTC](https://discuss.elastic.co/t/segment-merge-query/57418/3 "2016-08-07T20:13:39Z")

</div>

Yeah any of that information would be great 🙂

---

<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 5, 2017, 10:29pm UTC](https://discuss.elastic.co/t/segment-merge-query/57418/4 "2017-07-05T22:29:31Z")

</div>


