1

I am going to reindex with below query like.

{
  "source": {
    "index": "demodata"
  },
  "dest": {
    "index": "new_twitter",
    "op_type": "create"
  },
   "script": {
    "source": "ctx._source['project'] = 'Personal3'",
    "lang": "painless"
  }
}

When project change same data/index need to reindex with new project name. But I am getting Conflict. I hope if there is any options to update the Id I can solve this issue.

James Z
  • 12,209
  • 10
  • 24
  • 44
Janny
  • 681
  • 1
  • 8
  • 33

1 Answers1

0

If you want to generate new ids in each time you reindex your data you need to do something like this:

POST _reindex
{
  "source": {
    "index": "demodata"
  },
  "dest": {
    "index": "new_twitter"
  },
  "script": {
    "source": "ctx._source['foo'] = 'Personal3'; ctx._id=null",
    "lang": "painless"
  }
}

This reindex query make a null id for each document and elasticsearch creates new id for each of them. Please let me know if you have any problem with this.

Saeed Nasehi
  • 940
  • 1
  • 11
  • 27