Adapt bwc version after backport

Relates #34225
This commit is contained in:
Jim Ferenczi 2018-10-03 12:24:07 +02:00
parent 5a3e031831
commit 1aa8e72be7
2 changed files with 5 additions and 5 deletions

View File

@ -458,9 +458,9 @@ public abstract class ParseContext implements Iterable<ParseContext.Document>{
void postParse() { void postParse() {
if (documents.size() > 1) { if (documents.size() > 1) {
docsReversed = true; docsReversed = true;
if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_6_5_0)) {
/** /**
* For indices created on or after {@link Version#V_7_0_0_alpha1} we preserve the order * For indices created on or after {@link Version#V_6_5_0} we preserve the order
* of the children while ensuring that parents appear after them. * of the children while ensuring that parents appear after them.
*/ */
List<Document> newDocs = reorderParent(documents); List<Document> newDocs = reorderParent(documents);

View File

@ -651,8 +651,8 @@ public class NestedObjectMapperTests extends ESSingleNodeTestCase {
.endObject().endObject().endObject()); .endObject().endObject().endObject());
Version bwcVersion = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version bwcVersion = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0,
Version.V_7_0_0_alpha1.minimumCompatibilityVersion()); Version.V_6_5_0);
for (Version version : new Version[] {Version.V_7_0_0_alpha1, bwcVersion}) { for (Version version : new Version[] {Version.V_6_5_0, bwcVersion}) {
DocumentMapper docMapper = createIndex("test-" + version, DocumentMapper docMapper = createIndex("test-" + version,
Settings.builder().put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), version).build()) Settings.builder().put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), version).build())
.mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping)); .mapperService().documentMapperParser().parse("type", new CompressedXContent(mapping));
@ -679,7 +679,7 @@ public class NestedObjectMapperTests extends ESSingleNodeTestCase {
XContentType.JSON)); XContentType.JSON));
assertThat(doc.docs().size(), equalTo(3)); assertThat(doc.docs().size(), equalTo(3));
if (version.onOrAfter(Version.V_7_0_0_alpha1)) { if (version.onOrAfter(Version.V_6_5_0)) {
assertThat(doc.docs().get(0).get(TypeFieldMapper.NAME), equalTo(nested1Mapper.nestedTypePathAsString())); assertThat(doc.docs().get(0).get(TypeFieldMapper.NAME), equalTo(nested1Mapper.nestedTypePathAsString()));
assertThat(doc.docs().get(0).get("nested1.field1"), equalTo("1")); assertThat(doc.docs().get(0).get("nested1.field1"), equalTo("1"));
assertThat(doc.docs().get(0).get("nested1.field2"), equalTo("2")); assertThat(doc.docs().get(0).get("nested1.field2"), equalTo("2"));