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

Store _version as a numeric doc values field #3103

Closed
jpountz opened this Issue May 28, 2013 · 6 comments

Comments

Projects
None yet
3 participants
@jpountz
Copy link
Contributor

jpountz commented May 28, 2013

_version is today stored as a payload alongside the postings of the _uid field.

Storing it as a numeric doc values field would help save space, since _uid could be indexed with IndexOptions.DOCS_ONLY and numeric doc values formats can be very compact since they don't need to be byte-aligned. For example, all doc values formats in Lucene but SimpleText store numbers into blocks of packed integers.

@s1monw

This comment has been minimized.

Copy link
Contributor

s1monw commented May 29, 2013

I left a couple of minor comments on the PullRequest aside of those here is my +1

LGTM push it!

@brusic

This comment has been minimized.

Copy link
Contributor

brusic commented May 29, 2013

Would this change help in making the _version field indexable? I can contribute a patch if so, since I would love that functionality.

@jpountz

This comment has been minimized.

Copy link
Contributor Author

jpountz commented May 29, 2013

What is your use-case for querying the _version field?

@brusic

This comment has been minimized.

Copy link
Contributor

brusic commented May 29, 2013

Simple. Give me any document that has been updated (version >= 2).

I actually started looking into creating a VersionFieldMapper a couple of weeks ago, but I have not had time to look into it more. This change could potentially simplify things or at least not have to rewrite things twice.

@jpountz

This comment has been minimized.

Copy link
Contributor Author

jpountz commented May 29, 2013

I'm not sure this is a good idea to try to expand the scope of _version. For example, if you delete a document and add again soon after a document with the same _uid, its _version won't be 1 although it is a new document which has never been updated?

@s1monw

This comment has been minimized.

Copy link
Contributor

s1monw commented May 29, 2013

I'd agree with adrien this is pretty internal and the behaviour might be unexpected. Searching on a version should be external I guess that way you can index the actual version as a field and search for it

@jpountz jpountz closed this in 490c710 May 30, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.