Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version and version_type to utils.DOC_META_FIELDS #1432

Closed
lijok opened this issue Oct 2, 2020 · 1 comment · Fixed by #1461
Closed

Add version and version_type to utils.DOC_META_FIELDS #1432

lijok opened this issue Oct 2, 2020 · 1 comment · Fixed by #1461

Comments

@lijok
Copy link

lijok commented Oct 2, 2020

That way I can index something like this

FileDocument(
    id=3000,
    alive=True,
    access_level=1,
    caption='test',
    meta={
        'id': 3000,
        'version_type': 'external',
        'version': 99,
    }
)

using bulk helper and utilize versioning

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html#bulk-versioning

@armando1793
Copy link
Contributor

armando1793 commented Dec 3, 2020

@lijok I did

doc = Document.get(id=somevalue)
// manipulate doc values
doc.meta["version"] = None

I think version in meta should be overridden when retry_on_conflict is not None

edit/additional info: This was done inside a kafka consumer so in my case there might not be immediate problems when doing this since the document is queried for every message consumed but I'm not sure if this is safe for uses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants