-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Conversation
@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? |
@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 && |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
LGTM! |
@@ -331,8 +359,7 @@ public void testRequiredRoutingWithPathNumericType() throws Exception { | |||
assertThat(client().prepareGet(indexOrAlias(), "type1", "1").setRouting("0").execute().actionGet().isExists(), equalTo(true)); | |||
} | |||
} | |||
|
|||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
LGTM too but can you please fix the |
…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
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...