How to reindex part of the data?

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?

What version are you on?

2.3.4

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

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?

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

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

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"
        }
    }
}

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

thank you ,it realy help me.