# Reindex w/field collapsing

**URL:** <https://discuss.elastic.co/t/reindex-w-field-collapsing/266725>\
**Category:** Elasticsearch\
**Tags:** reindex\
**Created:** [March 9, 2021, 4:51pm UTC](https://discuss.elastic.co/t/reindex-w-field-collapsing/266725 "2021-03-09T16:51:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![F\_Doe\_FW](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f_doe_fw/32/77781_2.png) [@F\_Doe\_FW](https://discuss.elastic.co/u/F_Doe_FW)\
**Post date:** [March 9, 2021, 4:51pm UTC](https://discuss.elastic.co/t/reindex-w-field-collapsing/266725/1 "2021-03-09T16:51:58Z")

</div>

Is there any way to collapse results with ReIndexing? I have a source index and want to get the most used pieces out, and only return their 'natural' key into a new index.  
I can't figure out how to stuff the collapse logic into the Reindex process... query? aggregation?

```auto
    {
      "max_docs": 1,
      "source": {
      "index": "toplanes",
    		"_source": ["compkey"],
    		"collapse":{"field":"compkey"}
    	},
    	
      "dest": {
        "index": "hot_lane_lookup"
      }
    }

```

---

<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:** [April 6, 2021, 4:52pm UTC](https://discuss.elastic.co/t/reindex-w-field-collapsing/266725/2 "2021-04-06T16:52:45Z")

</div>

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