# Document version number not advancing

**URL:** <https://discuss.elastic.co/t/document-version-number-not-advancing/115888>\
**Category:** Elasticsearch\
**Created:** [January 17, 2018, 1:51pm UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888 "2018-01-17T13:51:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorj1234](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorj1234/32/21339_2.png) [@dorj1234](https://discuss.elastic.co/u/dorj1234)\
**Post date:** [January 17, 2018, 1:51pm UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/1 "2018-01-17T13:51:04Z")

</div>

Hello,  
I just tested how versions work, loaded the same set of CSV files again, same loading script and everything is the same.

Looking at the "discover" section of Kibana I expected to see the @version number in my documents advance from "1" to "2" but that did not happen.

What could be the cause?

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 17, 2018, 1:55pm UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/2 "2018-01-17T13:55:24Z")

</div>

How do you perform your updates? In bulk? Can you show your script?

Note that if you use the Update API and nothing changes in your document, the version is not increased (i.e. that's a `noop` operation)

---

<div class="post-metadata">

**Author:** ![dorj1234](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorj1234/32/21339_2.png) [@dorj1234](https://discuss.elastic.co/u/dorj1234)\
**Post date:** [January 17, 2018, 3:21pm UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/3 "2018-01-17T15:21:19Z")

</div>

Good point - I am using logstash to re-ingest the same csv files.  
I have fingerprinted the records, so next time I run logstash it should greate the same document ID for the same record.

Are you saying that if the record data is identical then no new version will be created? that could be the explanation and I will test it later today and update the thread.

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 17, 2018, 3:25pm UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/4 "2018-01-17T15:25:11Z")

</div>

If you use the Index API, then the version will increase as the Index API does not retrieve the document to perform a diff. However, if you use the Update API and the document hasn't changed, then the version won't be bumped (i.e. `noop` operation)

---

<div class="post-metadata">

**Author:** ![dorj1234](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorj1234/32/21339_2.png) [@dorj1234](https://discuss.elastic.co/u/dorj1234)\
**Post date:** [January 17, 2018, 6:45pm UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/5 "2018-01-17T18:45:37Z")

</div>

I use neither. Indexing is done via logstash CSV plugin. What does it do in the background? I think it does index API calls.

So far versioning does not work as expected.

1. I have many columns in my CSV
2. I fingerprint 2 of the columns, and index the csv file using logstash
3. I change one of the columns that does not participate in the fingerprint and re-run logstash

The result is new documents instead of incrementing the version of the existing documents.

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 17, 2018, 9:18pm UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/6 "2018-01-17T21:18:52Z")

</div>

This is because the ID is different on each indexation and thus the existing document is not updated but a new one is created instead. What configuration do you have for the `document_id` setting in the `elasticsearch` output?

---

<div class="post-metadata">

**Author:** ![dorj1234](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorj1234/32/21339_2.png) [@dorj1234](https://discuss.elastic.co/u/dorj1234)\
**Post date:** [January 17, 2018, 10:25pm UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/7 "2018-01-17T22:25:17Z")

</div>

I use the fingerprint result for document ID  
`document_id => "%{[@metadata][fingerprint]}"`

After setting fingerprint to:  
`fingerprint {`  
`method => "SHA1"`  
`source => ["column_a","run_date"]`  
`concatenate_sources => true`  
`target => "[@metadata][fingerprint]"`  
`key => "SOMEKEY"`  
`}`

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 18, 2018, 4:05am UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/8 "2018-01-18T04:05:18Z")

</div>

Ok then I guess `column_a` is constant, but where does `run_date` come from'

---

<div class="post-metadata">

**Author:** ![dorj1234](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dorj1234/32/21339_2.png) [@dorj1234](https://discuss.elastic.co/u/dorj1234)\
**Post date:** [January 18, 2018, 4:50am UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/9 "2018-01-18T04:50:15Z")

</div>

run\_date is also a constant (example: 2017-10-25), you can call it column\_b. Once run\_date is in the csv file it's never changing changing.

When I combine column\_a+column\_b (run\_date) using fingerprint, and use the hash as document\_id, then the next time I index the same record, I expect the same hash ==\> the same document ID because nothing has changed (maybe the timestamp).  
However column\_a+column\_b are not changing

---

<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:** [February 15, 2018, 4:50am UTC](https://discuss.elastic.co/t/document-version-number-not-advancing/115888/10 "2018-02-15T04:50:41Z")

</div>

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