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

Lock down _id field #9842

Merged
merged 1 commit into from
Feb 24, 2015
Merged

Lock down _id field #9842

merged 1 commit into from
Feb 24, 2015

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Feb 24, 2015

There are two implications to this change.
First, percolator now uses _uid internally, extracting the id portion
when needed. Second, sorting on _id is no longer possible, since you
can no longer index _id. However, _uid can still be used to sort, and
is better anyways as indexing _id just to make it available to
fielddata for sorting is wasteful.

see #8143

@@ -122,12 +122,15 @@ public IdFieldMapper build(BuilderContext context) {
@Override
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
IdFieldMapper.Builder builder = id();
if (parserContext.indexVersionCreated().onOrAfter(Version.V_2_0_0)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it move one line up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good point, will move it up.

@jpountz
Copy link
Contributor

jpountz commented Feb 24, 2015

LGTM

@jpountz
Copy link
Contributor

jpountz commented Feb 24, 2015

Maybe it should have an entry in the migration guide?

@jpountz
Copy link
Contributor

jpountz commented Feb 24, 2015

LGTM^2

@martijnvg
Copy link
Member

the reason the percolator was using the _id field was that the type part of the uid wouldn't be needed to be loaded in memory via field data and to prevent the splitting of the type and id at percolate time.

I'm less concerned about the type being loaded in memory, since at some point _uid will be doc values by default. But I'm not a big fan of the type/id splitting. Maybe the percolator should have its own field that can be used for id lookup? But this can potentially be explored in a different issue.

But LGTM and worry about that later.

@jpountz
Copy link
Contributor

jpountz commented Feb 24, 2015

There are already at least two reasons why we would need doc values on _uid:

  • search stability (since we don't always query the same copy of the data)
  • random scores with seed

So maybe we should have doc values on _uid (at least by default, maybe enforced). I think this would also fix this percolator concern and it would be fine to work with the _uid instead of _id?

There are two implications to this change.
First, percolator now uses _uid internally, extracting the id portion
when needed. Second, sorting on _id is no longer possible, since you
can no longer index _id. However, _uid can still be used to sort, and
is better anyways as indexing _id just to make it available to
fielddata for sorting is wasteful.

see elastic#8143
closes elastic#9842
@rjernst rjernst merged commit b96bd20 into elastic:master Feb 24, 2015
@martijnvg
Copy link
Member

@jpountz yes that makes sense and fix the concern. I lean towards enforcing doc values on the _uid field.

@javanna
Copy link
Member

javanna commented Feb 25, 2015

@rjernst labels please?

@rjernst rjernst added v2.0.0-beta1 :Search Foundations/Mapping Index mappings, including merging and defining field types labels Feb 25, 2015
@rjernst rjernst deleted the pr/8143-id branch March 24, 2015 03:18
@clintongormley clintongormley changed the title Mappings: Lock down _id field Lock down _id field Jun 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking :Search Foundations/Mapping Index mappings, including merging and defining field types v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants