Resetting versions


I've seen a few posts on this in the past but was wondering if there's any newer solution:

We have had issues in production where we indexed documents with an external, then had to restore older versions of the document from backups to our external stores. We've since re-indexed updates to these documents content in Elasticsearch but the old external version remains.

e.g. as a primitive example

Datastore version 1000
ES _version 10000

with the same document content.

Is there any way, aside from:

  1. Delete document by ID from ES
  2. Wait index.gc_deletes
  3. Index into ES with same document

to reset these version numbers?

For example, if we still have the intended version in the _source.version field, can we replace the _version field with _source.version in a reindex API call and have elasticsearch respect that?

We have a large elasticsearch cluster (>1.5 billion documents of very high complexity). As such, we have no strong desire to re-index the whole cluster to reset these versioning issues which affect ~2 million documents.

Additionally, we have issues where processes have been known write to ES with versioning not set to external. This is causing us later pain with versioning, as we have to design our entire external versioning schema to take into account that ES increments versions by 1 in these cases. Is there any way to change this behaviour so as to not increment the version?

Thanks for any help on this topic.

Welcome to our community! :smiley:

What version of Elasticsearch are you on?

Are you using the same _id and putting it into the same index?

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