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

Mappings: Remove ability to set path for _id and _routing on 2.0+ indexes #9623

Merged
merged 1 commit into from
Feb 10, 2015

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Feb 10, 2015

closes #6730

Note: I would like to keep the BulkTests checking pre-parsing when path is set works, but I don't see a way without moving that to the static backcompat tests. It would be nice if we could fake out the index settings (ie set the index_created_version) but I don't think that is possible...

@martijnvg
Copy link
Member

@rjernst I like the cleanup! If I recall correctly, setting the version is a way of the fake the index version. So maybe try this out?

@rjernst
Copy link
Member Author

rjernst commented Feb 10, 2015

@martijnvg That worked! I've added back a couple of the tests so there is some direct testing of backcompat here.

@@ -144,6 +146,8 @@ protected IdFieldMapper(String name, String indexName, float boost, FieldType fi
super(new Names(name, indexName, indexName, name), boost, fieldType, docValues, Lucene.KEYWORD_ANALYZER,
Lucene.KEYWORD_ANALYZER, postingsProvider, docValuesProvider, null, null, fieldDataSettings, indexSettings);
this.path = path;
this.writePre20Settings = indexSettings.equals(ImmutableSettings.EMPTY) == false &&
Copy link
Member

Choose a reason for hiding this comment

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

Just wondering, but I don't think that the indexSettings.equals(ImmutableSettings.EMPTY) == false part of the expression is needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is, because Version.indexCreated throws an exception if it cannot find the version setting (and the default constructor above uses empty settings).

Copy link
Member

Choose a reason for hiding this comment

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

Right I see... I think the Version.indexCreated should just return null in that case, but that is outside of the scope of this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rjernst It looks like we can easily make this constructor take some index settings. It is only called from DocumentMapper.Builder which has index settings available (btw some other mappers already take settings).

Copy link
Member

Choose a reason for hiding this comment

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

Since all 1.x versions will have the created version in the index settings, the empty settings check can be removed.

@martijnvg
Copy link
Member

LGTM!

@@ -331,8 +359,7 @@ public void testRequiredRoutingWithPathNumericType() throws Exception {
assertThat(client().prepareGet(indexOrAlias(), "type1", "1").setRouting("0").execute().actionGet().isExists(), equalTo(true));
}
}

@Test
Copy link
Contributor

Choose a reason for hiding this comment

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

:)

@jpountz
Copy link
Contributor

jpountz commented Feb 10, 2015

LGTM too but can you please fix the indexSettings.equals(ImmutableSettings.EMPTY) hack before pushing?

…exes

_id and _routing now no longer support the 'path' setting on indexes
created with 2.0.  Indexes created before 2.0 still support this
setting for backcompat.

closes elastic#6730
@rjernst rjernst merged commit b3474f6 into elastic:master Feb 10, 2015
@rjernst rjernst deleted the fix/6730 branch March 24, 2015 03:01
@clintongormley clintongormley added >breaking :Search Foundations/Mapping Index mappings, including merging and defining field types v2.0.0-beta1 v5.0.0-alpha1 labels Dec 14, 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.

Deprecate extracting _routing and _id from document fields
4 participants