Elasticsearch reindex parsing error

Hi all, i'm trying to copy data of specified fields from one index to another using reindex.

curl -XPOST --header 'Content-Type: application/json' http://localhost:9200/_reindex -d '{

"source": {
"index1": "sunny_1"
},
"dest": {
"index2": "sunny_1_copy"
}
}'

I get a parsing error

{"error":{"root_cause":[{"type":"parsing_exception","reason":"Unknown key for a VALUE_STRING in [index1].","line":1,"col":11}],"type":"x_content_parse_exception","reason":"[4:3] [reindex] failed to parse field [source]","caused_by":{"type":"parsing_exception","reason":"Unknown key for a VALUE_STRING in [index1].","line":1,"col":11}},"status":400}

I want to where this error is coming from and why is this error coming when i have selected only some fields to reindex?

Should be like this, same keyword index

{
  "source": {
    "index": "sunny_1"
  },
  "dest": {
    "index": "sunny_1_copy"
  }
}
1 Like

Thanks! that solved the issue!