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

Remove the update_all_types option. #28288

Merged
merged 2 commits into from
Jan 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ static Request createIndex(CreateIndexRequest createIndexRequest) throws IOExcep
parameters.withTimeout(createIndexRequest.timeout());
parameters.withMasterTimeout(createIndexRequest.masterNodeTimeout());
parameters.withWaitForActiveShards(createIndexRequest.waitForActiveShards());
parameters.withUpdateAllTypes(createIndexRequest.updateAllTypes());

HttpEntity entity = createEntity(createIndexRequest, REQUEST_BODY_CONTENT_TYPE);
return new Request(HttpPut.METHOD_NAME, endpoint, parameters.getParams(), entity);
Expand Down Expand Up @@ -585,13 +584,6 @@ Params withTimeout(TimeValue timeout) {
return putParam("timeout", timeout);
}

Params withUpdateAllTypes(boolean updateAllTypes) {
if (updateAllTypes) {
return putParam("update_all_types", Boolean.TRUE.toString());
}
return this;
}

Params withVersion(long version) {
if (version != Versions.MATCH_ANY) {
return putParam("version", Long.toString(version));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,6 @@ public void testCreateIndex() throws IOException {
setRandomMasterTimeout(createIndexRequest, expectedParams);
setRandomWaitForActiveShards(createIndexRequest::waitForActiveShards, expectedParams);

if (randomBoolean()) {
boolean updateAllTypes = randomBoolean();
createIndexRequest.updateAllTypes(updateAllTypes);
if (updateAllTypes) {
expectedParams.put("update_all_types", Boolean.TRUE.toString());
}
}

Request request = Request.createIndex(createIndexRequest);
assertEquals("/" + indexName, request.getEndpoint());
assertEquals(expectedParams, request.getParameters());
Expand Down
6 changes: 5 additions & 1 deletion docs/reference/migration/migrate_7_0/mappings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ The `index_options` field for numeric fields has been deprecated in 6 and has n

To safeguard against out of memory errors, the number of nested json objects within a single
document across all fields has been limited to 10000. This default limit can be changed with
the index setting `index.mapping.nested_objects.limit`.
the index setting `index.mapping.nested_objects.limit`.

==== The `update_all_types` option has been removed

This option is useless now that all indices have at most one type.
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ public String typeName() {
}

@Override
public void checkCompatibility(MappedFieldType other, List<String> conflicts, boolean strict) {
super.checkCompatibility(other, conflicts, strict);
public void checkCompatibility(MappedFieldType other, List<String> conflicts) {
super.checkCompatibility(other, conflicts);
if (scalingFactor != ((ScaledFloatFieldType) other).getScalingFactor()) {
conflicts.add("mapper [" + name() + "] has different [scaling_factor] values");
}
Expand Down Expand Up @@ -424,8 +424,8 @@ protected void parseCreateField(ParseContext context, List<IndexableField> field
}

@Override
protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
super.doMerge(mergeWith, updateAllTypes);
protected void doMerge(Mapper mergeWith) {
super.doMerge(mergeWith);
ScaledFloatFieldMapper other = (ScaledFloatFieldMapper) mergeWith;
if (other.ignoreMalformed.explicit()) {
this.ignoreMalformed = other.ignoreMalformed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ protected String contentType() {
}

@Override
protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
super.doMerge(mergeWith, updateAllTypes);
protected void doMerge(Mapper mergeWith) {
super.doMerge(mergeWith);
this.analyzer = ((TokenCountFieldMapper) mergeWith).analyzer;
this.enablePositionIncrements = ((TokenCountFieldMapper) mergeWith).enablePositionIncrements;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void testMerge() throws IOException {
.endObject().endObject().string();
MapperService mapperService = createIndex("test").mapperService();
DocumentMapper stage1 = mapperService.merge("person",
new CompressedXContent(stage1Mapping), MapperService.MergeReason.MAPPING_UPDATE, false);
new CompressedXContent(stage1Mapping), MapperService.MergeReason.MAPPING_UPDATE);

String stage2Mapping = XContentFactory.jsonBuilder().startObject()
.startObject("person")
Expand All @@ -75,7 +75,7 @@ public void testMerge() throws IOException {
.endObject()
.endObject().endObject().string();
DocumentMapper stage2 = mapperService.merge("person",
new CompressedXContent(stage2Mapping), MapperService.MergeReason.MAPPING_UPDATE, false);
new CompressedXContent(stage2Mapping), MapperService.MergeReason.MAPPING_UPDATE);

// previous mapper has not been modified
assertThat(((TokenCountFieldMapper) stage1.mappers().smartNameFieldMapper("tc")).analyzer(), equalTo("keyword"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ protected void parseCreateField(ParseContext context, List<IndexableField> field


@Override
protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
super.doMerge(mergeWith, updateAllTypes);
protected void doMerge(Mapper mergeWith) {
super.doMerge(mergeWith);
ParentIdFieldMapper parentMergeWith = (ParentIdFieldMapper) mergeWith;
this.children = parentMergeWith.children;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ public ParentIdFieldMapper getParentIdFieldMapper(String name, boolean isParent)
}

@Override
protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
super.doMerge(mergeWith, updateAllTypes);
protected void doMerge(Mapper mergeWith) {
super.doMerge(mergeWith);
ParentJoinFieldMapper joinMergeWith = (ParentJoinFieldMapper) mergeWith;
List<String> conflicts = new ArrayList<>();
for (ParentIdFieldMapper mapper : parentIdFields) {
Expand Down Expand Up @@ -347,7 +347,7 @@ protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
conflicts.add("cannot remove child [" + child + "] in join field [" + name() + "]");
}
}
ParentIdFieldMapper merged = (ParentIdFieldMapper) self.merge(mergeWithMapper, updateAllTypes);
ParentIdFieldMapper merged = (ParentIdFieldMapper) self.merge(mergeWithMapper);
newParentIdFields.add(merged);
}
}
Expand All @@ -356,7 +356,7 @@ protected void doMerge(Mapper mergeWith, boolean updateAllTypes) {
}
this.eagerGlobalOrdinals = joinMergeWith.eagerGlobalOrdinals;
this.parentIdFields = Collections.unmodifiableList(newParentIdFields);
this.uniqueFieldMapper = (MetaJoinFieldMapper) uniqueFieldMapper.merge(joinMergeWith.uniqueFieldMapper, updateAllTypes);
this.uniqueFieldMapper = (MetaJoinFieldMapper) uniqueFieldMapper.merge(joinMergeWith.uniqueFieldMapper);
uniqueFieldMapper.setFieldMapper(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testSingleLevel() throws Exception {
.endObject().string();
IndexService service = createIndex("test");
DocumentMapper docMapper = service.mapperService().merge("type", new CompressedXContent(mapping),
MapperService.MergeReason.MAPPING_UPDATE, false);
MapperService.MergeReason.MAPPING_UPDATE);
assertTrue(docMapper.mappers().getMapper("join_field") == ParentJoinFieldMapper.getMapper(service.mapperService()));

// Doc without join
Expand Down Expand Up @@ -106,7 +106,7 @@ public void testParentIdSpecifiedAsNumber() throws Exception {
.endObject().string();
IndexService service = createIndex("test");
DocumentMapper docMapper = service.mapperService().merge("type", new CompressedXContent(mapping),
MapperService.MergeReason.MAPPING_UPDATE, false);
MapperService.MergeReason.MAPPING_UPDATE);
ParsedDocument doc = docMapper.parse(SourceToParse.source("test", "type", "2",
XContentFactory.jsonBuilder().startObject()
.startObject("join_field")
Expand Down Expand Up @@ -141,7 +141,7 @@ public void testMultipleLevels() throws Exception {
.endObject().string();
IndexService service = createIndex("test");
DocumentMapper docMapper = service.mapperService().merge("type", new CompressedXContent(mapping),
MapperService.MergeReason.MAPPING_UPDATE, false);
MapperService.MergeReason.MAPPING_UPDATE);
assertTrue(docMapper.mappers().getMapper("join_field") == ParentJoinFieldMapper.getMapper(service.mapperService()));

// Doc without join
Expand Down Expand Up @@ -221,7 +221,7 @@ public void testUpdateRelations() throws Exception {
.endObject().endObject().string();
IndexService indexService = createIndex("test");
DocumentMapper docMapper = indexService.mapperService().merge("type", new CompressedXContent(mapping),
MapperService.MergeReason.MAPPING_UPDATE, false);
MapperService.MergeReason.MAPPING_UPDATE);
assertTrue(docMapper.mappers().getMapper("join_field") == ParentJoinFieldMapper.getMapper(indexService.mapperService()));

{
Expand All @@ -235,7 +235,7 @@ public void testUpdateRelations() throws Exception {
.endObject().endObject().string();
IllegalStateException exc = expectThrows(IllegalStateException.class,
() -> indexService.mapperService().merge("type", new CompressedXContent(updateMapping),
MapperService.MergeReason.MAPPING_UPDATE, false));
MapperService.MergeReason.MAPPING_UPDATE));
assertThat(exc.getMessage(), containsString("cannot remove parent [parent] in join field [join_field]"));
}

Expand All @@ -251,7 +251,7 @@ public void testUpdateRelations() throws Exception {
.endObject().endObject().string();
IllegalStateException exc = expectThrows(IllegalStateException.class,
() -> indexService.mapperService().merge("type", new CompressedXContent(updateMapping),
MapperService.MergeReason.MAPPING_UPDATE, false));
MapperService.MergeReason.MAPPING_UPDATE));
assertThat(exc.getMessage(), containsString("cannot remove child [grand_child2] in join field [join_field]"));
}

Expand All @@ -268,7 +268,7 @@ public void testUpdateRelations() throws Exception {
.endObject().endObject().string();
IllegalStateException exc = expectThrows(IllegalStateException.class,
() -> indexService.mapperService().merge("type", new CompressedXContent(updateMapping),
MapperService.MergeReason.MAPPING_UPDATE, false));
MapperService.MergeReason.MAPPING_UPDATE));
assertThat(exc.getMessage(), containsString("cannot create child [parent] from an existing parent"));
}

Expand All @@ -285,7 +285,7 @@ public void testUpdateRelations() throws Exception {
.endObject().endObject().string();
IllegalStateException exc = expectThrows(IllegalStateException.class,
() -> indexService.mapperService().merge("type", new CompressedXContent(updateMapping),
MapperService.MergeReason.MAPPING_UPDATE, false));
MapperService.MergeReason.MAPPING_UPDATE));
assertThat(exc.getMessage(), containsString("cannot create parent [grand_child2] from an existing child]"));
}

Expand All @@ -300,7 +300,7 @@ public void testUpdateRelations() throws Exception {
.endObject()
.endObject().endObject().string();
docMapper = indexService.mapperService().merge("type", new CompressedXContent(updateMapping),
MapperService.MergeReason.MAPPING_UPDATE, true);
MapperService.MergeReason.MAPPING_UPDATE);
assertTrue(docMapper.mappers().getMapper("join_field") == ParentJoinFieldMapper.getMapper(indexService.mapperService()));
ParentJoinFieldMapper mapper = ParentJoinFieldMapper.getMapper(indexService.mapperService());
assertTrue(mapper.hasChild("child2"));
Expand All @@ -321,7 +321,7 @@ public void testUpdateRelations() throws Exception {
.endObject()
.endObject().endObject().string();
docMapper = indexService.mapperService().merge("type", new CompressedXContent(updateMapping),
MapperService.MergeReason.MAPPING_UPDATE, true);
MapperService.MergeReason.MAPPING_UPDATE);
assertTrue(docMapper.mappers().getMapper("join_field") == ParentJoinFieldMapper.getMapper(indexService.mapperService()));
ParentJoinFieldMapper mapper = ParentJoinFieldMapper.getMapper(indexService.mapperService());
assertTrue(mapper.hasParent("other"));
Expand Down Expand Up @@ -349,7 +349,7 @@ public void testInvalidJoinFieldInsideObject() throws Exception {
IndexService indexService = createIndex("test");
MapperParsingException exc = expectThrows(MapperParsingException.class,
() -> indexService.mapperService().merge("type", new CompressedXContent(mapping),
MapperService.MergeReason.MAPPING_UPDATE, false));
MapperService.MergeReason.MAPPING_UPDATE));
assertThat(exc.getRootCause().getMessage(),
containsString("join field [object.join_field] cannot be added inside an object or in a multi-field"));
}
Expand All @@ -371,7 +371,7 @@ public void testInvalidJoinFieldInsideMultiFields() throws Exception {
IndexService indexService = createIndex("test");
MapperParsingException exc = expectThrows(MapperParsingException.class,
() -> indexService.mapperService().merge("type", new CompressedXContent(mapping),
MapperService.MergeReason.MAPPING_UPDATE, false));
MapperService.MergeReason.MAPPING_UPDATE));
assertThat(exc.getRootCause().getMessage(),
containsString("join field [number.join_field] cannot be added inside an object or in a multi-field"));
}
Expand All @@ -397,7 +397,7 @@ public void testMultipleJoinFields() throws Exception {
.endObject()
.endObject().string();
IllegalArgumentException exc = expectThrows(IllegalArgumentException.class, () -> indexService.mapperService().merge("type",
new CompressedXContent(mapping), MapperService.MergeReason.MAPPING_UPDATE, false));
new CompressedXContent(mapping), MapperService.MergeReason.MAPPING_UPDATE));
assertThat(exc.getMessage(), containsString("Field [_parent_join] is defined twice in [type]"));
}

Expand All @@ -414,7 +414,7 @@ public void testMultipleJoinFields() throws Exception {
.endObject()
.endObject().string();
indexService.mapperService().merge("type",
new CompressedXContent(mapping), MapperService.MergeReason.MAPPING_UPDATE, false);
new CompressedXContent(mapping), MapperService.MergeReason.MAPPING_UPDATE);
String updateMapping = XContentFactory.jsonBuilder().startObject()
.startObject("properties")
.startObject("another_join_field")
Expand All @@ -423,7 +423,7 @@ public void testMultipleJoinFields() throws Exception {
.endObject()
.endObject().string();
IllegalArgumentException exc = expectThrows(IllegalArgumentException.class, () -> indexService.mapperService().merge("type",
new CompressedXContent(updateMapping), MapperService.MergeReason.MAPPING_UPDATE, false));
new CompressedXContent(updateMapping), MapperService.MergeReason.MAPPING_UPDATE));
assertThat(exc.getMessage(), containsString("Field [_parent_join] is defined twice in [type]"));
}
}
Expand All @@ -442,7 +442,7 @@ public void testEagerGlobalOrdinals() throws Exception {
.endObject().string();
IndexService service = createIndex("test");
DocumentMapper docMapper = service.mapperService().merge("type", new CompressedXContent(mapping),
MapperService.MergeReason.MAPPING_UPDATE, false);
MapperService.MergeReason.MAPPING_UPDATE);
assertTrue(docMapper.mappers().getMapper("join_field") == ParentJoinFieldMapper.getMapper(service.mapperService()));
assertFalse(service.mapperService().fullName("join_field").eagerGlobalOrdinals());
assertNotNull(service.mapperService().fullName("join_field#parent"));
Expand All @@ -463,7 +463,7 @@ public void testEagerGlobalOrdinals() throws Exception {
.endObject()
.endObject().string();
service.mapperService().merge("type", new CompressedXContent(mapping),
MapperService.MergeReason.MAPPING_UPDATE, false);
MapperService.MergeReason.MAPPING_UPDATE);
assertFalse(service.mapperService().fullName("join_field").eagerGlobalOrdinals());
assertNotNull(service.mapperService().fullName("join_field#parent"));
assertFalse(service.mapperService().fullName("join_field#parent").eagerGlobalOrdinals());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws
.endObject().endObject().endObject();

mapperService.merge(TYPE,
new CompressedXContent(mapping.string()), MapperService.MergeReason.MAPPING_UPDATE, false);
new CompressedXContent(mapping.string()), MapperService.MergeReason.MAPPING_UPDATE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws
.endObject().endObject().endObject();

mapperService.merge(TYPE,
new CompressedXContent(mapping.string()), MapperService.MergeReason.MAPPING_UPDATE, false);
new CompressedXContent(mapping.string()), MapperService.MergeReason.MAPPING_UPDATE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws
BOOLEAN_FIELD_NAME, "type=boolean",
DATE_FIELD_NAME, "type=date",
OBJECT_FIELD_NAME, "type=object"
).string()), MapperService.MergeReason.MAPPING_UPDATE, false);
).string()), MapperService.MergeReason.MAPPING_UPDATE);
mapperService.merge(CHILD_TYPE, new CompressedXContent(PutMappingRequest.buildFromSimplifiedDef(CHILD_TYPE,
"_parent", "type=" + PARENT_TYPE,
STRING_FIELD_NAME, "type=text",
Expand All @@ -107,7 +107,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws
BOOLEAN_FIELD_NAME, "type=boolean",
DATE_FIELD_NAME, "type=date",
OBJECT_FIELD_NAME, "type=object"
).string()), MapperService.MergeReason.MAPPING_UPDATE, false);
).string()), MapperService.MergeReason.MAPPING_UPDATE);
}

@Override
Expand Down
Loading