# How to reindex part of the data?

**URL:** <https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753>\
**Category:** Elasticsearch\
**Created:** [August 11, 2016, 3:53am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753 "2016-08-11T03:53:32Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [August 11, 2016, 3:53am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/1 "2016-08-11T03:53:32Z")

</div>

I want to reindex a old index's data to a new index, but only part of the old index is useful, I don't need to reindex all of the old index's data. So, is there any way to do this?

---

<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 11, 2016, 5:34am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/2 "2016-08-11T05:34:01Z")

</div>

What version are you on?

---

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [August 11, 2016, 5:54am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/3 "2016-08-11T05:54:53Z")

</div>

2.3.4

---

<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 11, 2016, 5:55am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/4 "2016-08-11T05:55:24Z")

</div>

Use the `_reindex` API then [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-reindex.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/docs-reindex.html)

---

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [August 11, 2016, 6:01am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/5 "2016-08-11T06:01:07Z")

</div>

yeah，I know use reindex, but it seems that it dosen't apply the function to fliter data , for example, the index save the data of student, I only want to reindex the boy's data to the new index.How do this?

---

<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 11, 2016, 6:01am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/6 "2016-08-11T06:01:45Z")

</div>

Perhaps if you provide some examples of what you have tried and why they didn't appear to work we can help.

---

<div class="post-metadata">

**Author:** ![1222kkk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/1222kkk/32/23635_2.png) [@1222kkk](https://discuss.elastic.co/u/1222kkk)\
**Post date:** [August 11, 2016, 7:17am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/7 "2016-08-11T07:17:20Z")

</div>

```
POST /_reindex
{
  "source": {
    "index": "source"
    "query": {
      "match": {
        "gender": "boy"
      }
    }
  },
  "dest": {
    "index": "dest"
  }
}
```

---

<div class="post-metadata">

**Author:** ![rodrigoalviani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rodrigoalviani/32/11288_2.png) [@rodrigoalviani](https://discuss.elastic.co/u/rodrigoalviani)\
**Post date:** [August 11, 2016, 1:53pm UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/8 "2016-08-11T13:53:36Z")

</div>

To "\_reindex" to same index, you can update your mapping and use "\_update\_by\_query".

Example:

```
POST /students/_update_by_query?conflicts=proceed
{
    "query": { 
        "term": {
            "gender": "male"
        }
    }
}
```

---

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [August 12, 2016, 1:47am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/9 "2016-08-12T01:47:35Z")

</div>

Thank you for your reply, I have resolve this by 1222kkk 's answer.

---

<div class="post-metadata">

**Author:** ![WangXiangUSTC](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@WangXiangUSTC](https://discuss.elastic.co/u/WangXiangUSTC)\
**Post date:** [August 12, 2016, 1:48am UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/10 "2016-08-12T01:48:00Z")

</div>

thank you ,it realy help me.

---

<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:28pm UTC](https://discuss.elastic.co/t/how-to-reindex-part-of-the-data/57753/11 "2017-07-05T22:28:11Z")

</div>


