# Why does reindex cause Updates?

**URL:** https://discuss.elastic.co/t/why-does-reindex-cause-updates/134867
**Category:** Elasticsearch
**Created:** [June 6, 2018, 7:50pm UTC](https://discuss.elastic.co/t/why-does-reindex-cause-updates/134867 "2018-06-06T19:50:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Matthew\_Field](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_field/32/26599_2.png) [@Matthew\_Field](https://discuss.elastic.co/u/Matthew_Field)
#### Post date: [June 6, 2018, 7:50pm UTC](https://discuss.elastic.co/t/why-does-reindex-cause-updates/134867/1 "2018-06-06T19:50:50Z")

</div>

I am carrying out a reindex operation, to a new index, but get results like

```auto
INFO: __main__ :completed task Xp8tUzxiScenFu_pV7gmQQ:1558654
INFO: __main__ :{'deleted': 0, 'batches': 149, 'version_conflicts': 0, 'total': 148161, 'created': 148159, 'noops': 0, 'throttled_until_millis': 0, 'updated': 2, 'requests_per_second': -1.0, 'throttled_millis': 0, 'retries': {'bulk': 0, 'search': 0}}

```

So as a result, i am creating new records for nearly all, but updated 2 records.

Before the reindex operation, the destination index does not exist. It gets created  
Why is the index creating these updates , if i am simply reindexing to a new virgin index?

I do not understand how this is possible.

Thanks for any help you can give.

---

<div class="post-metadata">

### Author: ![klof](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klof/32/31590_2.png) [@klof](https://discuss.elastic.co/u/klof)
#### Post date: [June 6, 2018, 8:34pm UTC](https://discuss.elastic.co/t/why-does-reindex-cause-updates/134867/2 "2018-06-06T20:34:19Z")

</div>

Could you show us the body of the reindex query? and Do you set the IDs manually?

---

<div class="post-metadata">

### Author: ![Matthew\_Field](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthew_field/32/26599_2.png) [@Matthew\_Field](https://discuss.elastic.co/u/Matthew_Field)
#### Post date: [June 7, 2018, 5:41am UTC](https://discuss.elastic.co/t/why-does-reindex-cause-updates/134867/3 "2018-06-07T05:41:53Z")

</div>

Thanks, please find the body of the reindex below. I don't set the ids manually. All i do is include an if id ="" noop, because i was getting failure because of non existent IDs..(didn't understand that either, but the script fixed it..)

Admittedly i am going from daily index to a monthly index...but all the same it seems to me that the probablity of 2 ids colliding by chance have to be much lower than the number of "updates" i am getting.

```auto
curl -XPOST "http://localhost:9200/_reindex?wait_for_completion=false" -H 'Content-Type: application/json' -d'
{
  "conflicts": "proceed",
  "source": {
    "remote": {
      "host": "http://xxx.xx.x.xxx:9200",
      "socket_timeout": "1m",
      "connect_timeout": "10s"
    },
    "index": "logstash-2017.01.*",
    "type": ["api-log", "search-log"]
    
  },
  "dest": {
    "index": "logstash-2017.01"
  },
  "script": {
    "source": "if (ctx._id==\"\"){ctx.op=\"noop\"}else{ctx._source.doctype=ctx._type;ctx._type=\"doc\";}",
    "lang": "painless"
  }
}'

```

---

<div class="post-metadata">

### Author: ![klof](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klof/32/31590_2.png) [@klof](https://discuss.elastic.co/u/klof)
#### Post date: [June 7, 2018, 6:24am UTC](https://discuss.elastic.co/t/why-does-reindex-cause-updates/134867/4 "2018-06-07T06:24:13Z")

</div>

Thank you,  
What is the error message you get when you remove the `"conflicts": "proceed"`?  
I noticed in the task response, there's no "noops" documents (`'noops': 0`). So maybe this condition is not working properly and lead to the update?  
Could you also check that you have unique Ids for documents in types "api-log" and "search-log", because you're reindexing them all in the same index "logstash-2017.01"?

---

<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, 2018, 6:32am UTC](https://discuss.elastic.co/t/why-does-reindex-cause-updates/134867/5 "2018-07-05T06:32:04Z")

</div>

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