Merge pull request #15177 from jpountz/remove/MergeMappingException
Remove MergeMappingException.
This commit is contained in:
commit
3f18487afa
|
@ -554,7 +554,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
||||||
NODE_DISCONNECTED_EXCEPTION(org.elasticsearch.transport.NodeDisconnectedException.class, org.elasticsearch.transport.NodeDisconnectedException::new, 84),
|
NODE_DISCONNECTED_EXCEPTION(org.elasticsearch.transport.NodeDisconnectedException.class, org.elasticsearch.transport.NodeDisconnectedException::new, 84),
|
||||||
ALREADY_EXPIRED_EXCEPTION(org.elasticsearch.index.AlreadyExpiredException.class, org.elasticsearch.index.AlreadyExpiredException::new, 85),
|
ALREADY_EXPIRED_EXCEPTION(org.elasticsearch.index.AlreadyExpiredException.class, org.elasticsearch.index.AlreadyExpiredException::new, 85),
|
||||||
AGGREGATION_EXECUTION_EXCEPTION(org.elasticsearch.search.aggregations.AggregationExecutionException.class, org.elasticsearch.search.aggregations.AggregationExecutionException::new, 86),
|
AGGREGATION_EXECUTION_EXCEPTION(org.elasticsearch.search.aggregations.AggregationExecutionException.class, org.elasticsearch.search.aggregations.AggregationExecutionException::new, 86),
|
||||||
MERGE_MAPPING_EXCEPTION(org.elasticsearch.index.mapper.MergeMappingException.class, org.elasticsearch.index.mapper.MergeMappingException::new, 87),
|
// 87 used to be for MergeMappingException
|
||||||
INVALID_INDEX_TEMPLATE_EXCEPTION(org.elasticsearch.indices.InvalidIndexTemplateException.class, org.elasticsearch.indices.InvalidIndexTemplateException::new, 88),
|
INVALID_INDEX_TEMPLATE_EXCEPTION(org.elasticsearch.indices.InvalidIndexTemplateException.class, org.elasticsearch.indices.InvalidIndexTemplateException::new, 88),
|
||||||
PERCOLATE_EXCEPTION(org.elasticsearch.percolator.PercolateException.class, org.elasticsearch.percolator.PercolateException::new, 89),
|
PERCOLATE_EXCEPTION(org.elasticsearch.percolator.PercolateException.class, org.elasticsearch.percolator.PercolateException::new, 89),
|
||||||
REFRESH_FAILED_ENGINE_EXCEPTION(org.elasticsearch.index.engine.RefreshFailedEngineException.class, org.elasticsearch.index.engine.RefreshFailedEngineException::new, 90),
|
REFRESH_FAILED_ENGINE_EXCEPTION(org.elasticsearch.index.engine.RefreshFailedEngineException.class, org.elasticsearch.index.engine.RefreshFailedEngineException::new, 90),
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.index.IndexService;
|
||||||
import org.elasticsearch.index.NodeServicesProvider;
|
import org.elasticsearch.index.NodeServicesProvider;
|
||||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.indices.IndicesService;
|
import org.elasticsearch.indices.IndicesService;
|
||||||
import org.elasticsearch.indices.InvalidTypeNameException;
|
import org.elasticsearch.indices.InvalidTypeNameException;
|
||||||
|
@ -255,7 +254,7 @@ public class MetaDataMappingService extends AbstractComponent {
|
||||||
MergeResult mergeResult = existingMapper.merge(newMapper.mapping(), true, request.updateAllTypes());
|
MergeResult mergeResult = existingMapper.merge(newMapper.mapping(), true, request.updateAllTypes());
|
||||||
// if we have conflicts, throw an exception
|
// if we have conflicts, throw an exception
|
||||||
if (mergeResult.hasConflicts()) {
|
if (mergeResult.hasConflicts()) {
|
||||||
throw new MergeMappingException(mergeResult.buildConflicts());
|
throw new IllegalArgumentException("Merge failed with failures {" + Arrays.toString(mergeResult.buildConflicts()) + "}");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: can we find a better place for this validation?
|
// TODO: can we find a better place for this validation?
|
||||||
|
|
|
@ -360,7 +360,7 @@ public abstract class FieldMapper extends Mapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
if (!this.getClass().equals(mergeWith.getClass())) {
|
if (!this.getClass().equals(mergeWith.getClass())) {
|
||||||
String mergedType = mergeWith.getClass().getSimpleName();
|
String mergedType = mergeWith.getClass().getSimpleName();
|
||||||
if (mergeWith instanceof FieldMapper) {
|
if (mergeWith instanceof FieldMapper) {
|
||||||
|
@ -614,7 +614,7 @@ public abstract class FieldMapper extends Mapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need for locking, because locking is taken care of in ObjectMapper#merge and DocumentMapper#merge
|
// No need for locking, because locking is taken care of in ObjectMapper#merge and DocumentMapper#merge
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
FieldMapper mergeWithMultiField = (FieldMapper) mergeWith;
|
FieldMapper mergeWithMultiField = (FieldMapper) mergeWith;
|
||||||
|
|
||||||
List<FieldMapper> newFieldMappers = null;
|
List<FieldMapper> newFieldMappers = null;
|
||||||
|
|
|
@ -154,5 +154,5 @@ public abstract class Mapper implements ToXContent, Iterable<Mapper> {
|
||||||
/** Returns the canonical name which uniquely identifies the mapper against other mappers in a type. */
|
/** Returns the canonical name which uniquely identifies the mapper against other mappers in a type. */
|
||||||
public abstract String name();
|
public abstract String name();
|
||||||
|
|
||||||
public abstract void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException;
|
public abstract void merge(Mapper mergeWith, MergeResult mergeResult);
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
||||||
// simulate first
|
// simulate first
|
||||||
MergeResult result = oldMapper.merge(mapper.mapping(), true, updateAllTypes);
|
MergeResult result = oldMapper.merge(mapper.mapping(), true, updateAllTypes);
|
||||||
if (result.hasConflicts()) {
|
if (result.hasConflicts()) {
|
||||||
throw new MergeMappingException(result.buildConflicts());
|
throw new IllegalArgumentException("Merge failed with failures {" + Arrays.toString(result.buildConflicts()) + "}");
|
||||||
}
|
}
|
||||||
// then apply for real
|
// then apply for real
|
||||||
result = oldMapper.merge(mapper.mapping(), false, updateAllTypes);
|
result = oldMapper.merge(mapper.mapping(), false, updateAllTypes);
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.elasticsearch.index.mapper;
|
|
||||||
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
||||||
import org.elasticsearch.rest.RestStatus;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public final class MergeMappingException extends MapperException {
|
|
||||||
|
|
||||||
private final String[] failures;
|
|
||||||
|
|
||||||
public MergeMappingException(String[] failures) {
|
|
||||||
super("Merge failed with failures {" + Arrays.toString(failures) + "}");
|
|
||||||
Objects.requireNonNull(failures, "failures must be non-null");
|
|
||||||
this.failures = failures;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MergeMappingException(StreamInput in) throws IOException {
|
|
||||||
super(in);
|
|
||||||
failures = in.readStringArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeStringArray(failures);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] failures() {
|
|
||||||
return failures;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RestStatus status() {
|
|
||||||
return RestStatus.BAD_REQUEST;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -605,7 +605,7 @@ public class CompletionFieldMapper extends FieldMapper implements ArrayValueMapp
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
CompletionFieldMapper fieldMergeWith = (CompletionFieldMapper) mergeWith;
|
CompletionFieldMapper fieldMergeWith = (CompletionFieldMapper) mergeWith;
|
||||||
if (!mergeResult.simulate()) {
|
if (!mergeResult.simulate()) {
|
||||||
|
|
|
@ -245,7 +245,7 @@ public abstract class NumberFieldMapper extends FieldMapper implements AllFieldM
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
if (!this.getClass().equals(mergeWith.getClass())) {
|
if (!this.getClass().equals(mergeWith.getClass())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.index.mapper.FieldMapper;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
import org.elasticsearch.index.mapper.internal.AllFieldMapper;
|
import org.elasticsearch.index.mapper.internal.AllFieldMapper;
|
||||||
|
@ -360,7 +359,7 @@ public class StringFieldMapper extends FieldMapper implements AllFieldMapper.Inc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
if (!this.getClass().equals(mergeWith.getClass())) {
|
if (!this.getClass().equals(mergeWith.getClass())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.index.mapper.FieldMapper;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
import org.elasticsearch.index.mapper.core.StringFieldMapper.ValueAndBoost;
|
import org.elasticsearch.index.mapper.core.StringFieldMapper.ValueAndBoost;
|
||||||
|
@ -191,7 +190,7 @@ public class TokenCountFieldMapper extends IntegerFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
if (!this.getClass().equals(mergeWith.getClass())) {
|
if (!this.getClass().equals(mergeWith.getClass())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.index.mapper.FieldMapper;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
import org.elasticsearch.index.mapper.core.DoubleFieldMapper;
|
import org.elasticsearch.index.mapper.core.DoubleFieldMapper;
|
||||||
|
@ -389,7 +388,7 @@ public abstract class BaseGeoPointFieldMapper extends FieldMapper implements Arr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
if (!this.getClass().equals(mergeWith.getClass())) {
|
if (!this.getClass().equals(mergeWith.getClass())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.elasticsearch.index.mapper.ContentPath;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
import org.elasticsearch.index.mapper.core.DoubleFieldMapper;
|
import org.elasticsearch.index.mapper.core.DoubleFieldMapper;
|
||||||
|
@ -298,7 +297,7 @@ public class GeoPointFieldMapperLegacy extends BaseGeoPointFieldMapper implement
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
if (!this.getClass().equals(mergeWith.getClass())) {
|
if (!this.getClass().equals(mergeWith.getClass())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -45,7 +45,6 @@ import org.elasticsearch.index.mapper.FieldMapper;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
|
||||||
|
@ -472,7 +471,7 @@ public class GeoShapeFieldMapper extends FieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
if (!this.getClass().equals(mergeWith.getClass())) {
|
if (!this.getClass().equals(mergeWith.getClass())) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -310,7 +309,7 @@ public class AllFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
if (((AllFieldMapper)mergeWith).enabled() != this.enabled() && ((AllFieldMapper)mergeWith).enabledState != Defaults.ENABLED) {
|
if (((AllFieldMapper)mergeWith).enabled() != this.enabled() && ((AllFieldMapper)mergeWith).enabledState != Defaults.ENABLED) {
|
||||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] enabled is " + this.enabled() + " now encountering "+ ((AllFieldMapper)mergeWith).enabled());
|
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] enabled is " + this.enabled() + " now encountering "+ ((AllFieldMapper)mergeWith).enabled());
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -332,7 +331,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
// do nothing here, no merging, but also no exception
|
// do nothing here, no merging, but also no exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -280,7 +279,7 @@ public class IndexFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
IndexFieldMapper indexFieldMapperMergeWith = (IndexFieldMapper) mergeWith;
|
IndexFieldMapper indexFieldMapperMergeWith = (IndexFieldMapper) mergeWith;
|
||||||
if (!mergeResult.simulate()) {
|
if (!mergeResult.simulate()) {
|
||||||
if (indexFieldMapperMergeWith.enabledState != enabledState && !indexFieldMapperMergeWith.enabledState.unset()) {
|
if (indexFieldMapperMergeWith.enabledState != enabledState && !indexFieldMapperMergeWith.enabledState.unset()) {
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.index.mapper.DocumentMapper;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -372,7 +371,7 @@ public class ParentFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
ParentFieldMapper fieldMergeWith = (ParentFieldMapper) mergeWith;
|
ParentFieldMapper fieldMergeWith = (ParentFieldMapper) mergeWith;
|
||||||
if (Objects.equals(parentType, fieldMergeWith.parentType) == false) {
|
if (Objects.equals(parentType, fieldMergeWith.parentType) == false) {
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -250,7 +249,7 @@ public class RoutingFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
// do nothing here, no merging, but also no exception
|
// do nothing here, no merging, but also no exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -442,7 +441,7 @@ public class SourceFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
SourceFieldMapper sourceMergeWith = (SourceFieldMapper) mergeWith;
|
SourceFieldMapper sourceMergeWith = (SourceFieldMapper) mergeWith;
|
||||||
if (mergeResult.simulate()) {
|
if (mergeResult.simulate()) {
|
||||||
if (this.enabled != sourceMergeWith.enabled) {
|
if (this.enabled != sourceMergeWith.enabled) {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.elasticsearch.index.analysis.NumericLongAnalyzer;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -259,7 +258,7 @@ public class TTLFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
TTLFieldMapper ttlMergeWith = (TTLFieldMapper) mergeWith;
|
TTLFieldMapper ttlMergeWith = (TTLFieldMapper) mergeWith;
|
||||||
if (((TTLFieldMapper) mergeWith).enabledState != Defaults.ENABLED_STATE) {//only do something if actually something was set for the document mapper that we merge with
|
if (((TTLFieldMapper) mergeWith).enabledState != Defaults.ENABLED_STATE) {//only do something if actually something was set for the document mapper that we merge with
|
||||||
if (this.enabledState == EnabledAttributeMapper.ENABLED && ((TTLFieldMapper) mergeWith).enabledState == EnabledAttributeMapper.DISABLED) {
|
if (this.enabledState == EnabledAttributeMapper.ENABLED && ((TTLFieldMapper) mergeWith).enabledState == EnabledAttributeMapper.DISABLED) {
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.index.analysis.NumericDateAnalyzer;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
|
@ -380,7 +379,7 @@ public class TimestampFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
TimestampFieldMapper timestampFieldMapperMergeWith = (TimestampFieldMapper) mergeWith;
|
TimestampFieldMapper timestampFieldMapperMergeWith = (TimestampFieldMapper) mergeWith;
|
||||||
super.merge(mergeWith, mergeResult);
|
super.merge(mergeWith, mergeResult);
|
||||||
if (!mergeResult.simulate()) {
|
if (!mergeResult.simulate()) {
|
||||||
|
|
|
@ -40,7 +40,6 @@ import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -226,7 +225,7 @@ public class TypeFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
// do nothing here, no merging, but also no exception
|
// do nothing here, no merging, but also no exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -226,7 +225,7 @@ public class UidFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
// do nothing here, no merging, but also no exception
|
// do nothing here, no merging, but also no exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -167,7 +166,7 @@ public class VersionFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,7 +464,7 @@ public class ObjectMapper extends Mapper implements AllFieldMapper.IncludeInAll,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(final Mapper mergeWith, final MergeResult mergeResult) throws MergeMappingException {
|
public void merge(final Mapper mergeWith, final MergeResult mergeResult) {
|
||||||
if (!(mergeWith instanceof ObjectMapper)) {
|
if (!(mergeWith instanceof ObjectMapper)) {
|
||||||
mergeResult.addConflict("Can't merge a non object mapping [" + mergeWith.name() + "] with an object mapping [" + name() + "]");
|
mergeResult.addConflict("Can't merge a non object mapping [" + mergeWith.name() + "] with an object mapping [" + name() + "]");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -51,7 +51,6 @@ import org.elasticsearch.index.AlreadyExpiredException;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.engine.IndexFailedEngineException;
|
import org.elasticsearch.index.engine.IndexFailedEngineException;
|
||||||
import org.elasticsearch.index.engine.RecoveryEngineException;
|
import org.elasticsearch.index.engine.RecoveryEngineException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.query.QueryShardException;
|
import org.elasticsearch.index.query.QueryShardException;
|
||||||
import org.elasticsearch.index.shard.IllegalIndexShardStateException;
|
import org.elasticsearch.index.shard.IllegalIndexShardStateException;
|
||||||
import org.elasticsearch.index.shard.IndexShardState;
|
import org.elasticsearch.index.shard.IndexShardState;
|
||||||
|
@ -275,11 +274,6 @@ public class ExceptionSerializationTests extends ESTestCase {
|
||||||
assertEquals(-3, alreadyExpiredException.now());
|
assertEquals(-3, alreadyExpiredException.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMergeMappingException() throws IOException {
|
|
||||||
MergeMappingException ex = serialize(new MergeMappingException(new String[]{"one", "two"}));
|
|
||||||
assertArrayEquals(ex.failures(), new String[]{"one", "two"});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testActionNotFoundTransportException() throws IOException {
|
public void testActionNotFoundTransportException() throws IOException {
|
||||||
ActionNotFoundTransportException ex = serialize(new ActionNotFoundTransportException("AACCCTION"));
|
ActionNotFoundTransportException ex = serialize(new ActionNotFoundTransportException("AACCCTION"));
|
||||||
assertEquals("AACCCTION", ex.action());
|
assertEquals("AACCCTION", ex.action());
|
||||||
|
@ -725,7 +719,6 @@ public class ExceptionSerializationTests extends ESTestCase {
|
||||||
ids.put(84, org.elasticsearch.transport.NodeDisconnectedException.class);
|
ids.put(84, org.elasticsearch.transport.NodeDisconnectedException.class);
|
||||||
ids.put(85, org.elasticsearch.index.AlreadyExpiredException.class);
|
ids.put(85, org.elasticsearch.index.AlreadyExpiredException.class);
|
||||||
ids.put(86, org.elasticsearch.search.aggregations.AggregationExecutionException.class);
|
ids.put(86, org.elasticsearch.search.aggregations.AggregationExecutionException.class);
|
||||||
ids.put(87, org.elasticsearch.index.mapper.MergeMappingException.class);
|
|
||||||
ids.put(88, org.elasticsearch.indices.InvalidIndexTemplateException.class);
|
ids.put(88, org.elasticsearch.indices.InvalidIndexTemplateException.class);
|
||||||
ids.put(89, org.elasticsearch.percolator.PercolateException.class);
|
ids.put(89, org.elasticsearch.percolator.PercolateException.class);
|
||||||
ids.put(90, org.elasticsearch.index.engine.RefreshFailedEngineException.class);
|
ids.put(90, org.elasticsearch.index.engine.RefreshFailedEngineException.class);
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.index.mapper.FieldMapper;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
import org.elasticsearch.index.mapper.core.BinaryFieldMapper;
|
import org.elasticsearch.index.mapper.core.BinaryFieldMapper;
|
||||||
|
@ -220,7 +219,7 @@ public class ExternalMapper extends FieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
// ignore this for now
|
// ignore this for now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -67,7 +66,7 @@ public class ExternalMetadataMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
if (!(mergeWith instanceof ExternalMetadataMapper)) {
|
if (!(mergeWith instanceof ExternalMetadataMapper)) {
|
||||||
mergeResult.addConflict("Trying to merge " + mergeWith + " with " + this);
|
mergeResult.addConflict("Trying to merge " + mergeWith + " with " + this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.index.IndexService;
|
||||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||||
import org.elasticsearch.index.mapper.DocumentMapperParser;
|
import org.elasticsearch.index.mapper.DocumentMapperParser;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.ParsedDocument;
|
import org.elasticsearch.index.mapper.ParsedDocument;
|
||||||
import org.elasticsearch.index.mapper.SourceToParse;
|
import org.elasticsearch.index.mapper.SourceToParse;
|
||||||
|
@ -169,8 +168,8 @@ public class TTLMappingTests extends ESSingleNodeTestCase {
|
||||||
try {
|
try {
|
||||||
client().admin().indices().preparePutMapping("testindex").setSource(mappingWithTtlDisabled).setType("type").get();
|
client().admin().indices().preparePutMapping("testindex").setSource(mappingWithTtlDisabled).setType("type").get();
|
||||||
fail();
|
fail();
|
||||||
} catch (MergeMappingException mme) {
|
} catch (IllegalArgumentException e) {
|
||||||
assertThat(mme.getDetailedMessage(), containsString("_ttl cannot be disabled once it was enabled."));
|
assertThat(e.getMessage(), containsString("_ttl cannot be disabled once it was enabled."));
|
||||||
}
|
}
|
||||||
GetMappingsResponse mappingsAfterUpdateResponse = client().admin().indices().prepareGetMappings("testindex").addTypes("type").get();
|
GetMappingsResponse mappingsAfterUpdateResponse = client().admin().indices().prepareGetMappings("testindex").addTypes("type").get();
|
||||||
assertThat(mappingsBeforeUpdateResponse.getMappings().get("testindex").get("type").source(), equalTo(mappingsAfterUpdateResponse.getMappings().get("testindex").get("type").source()));
|
assertThat(mappingsBeforeUpdateResponse.getMappings().get("testindex").get("type").source(), equalTo(mappingsAfterUpdateResponse.getMappings().get("testindex").get("type").source()));
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -150,9 +149,9 @@ public class UpdateMappingOnClusterIT extends ESIntegTestCase {
|
||||||
try {
|
try {
|
||||||
client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(mappingUpdate).get();
|
client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(mappingUpdate).get();
|
||||||
fail();
|
fail();
|
||||||
} catch (MergeMappingException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
for (String errorMessage : errorMessages) {
|
for (String errorMessage : errorMessages) {
|
||||||
assertThat(e.getDetailedMessage(), containsString(errorMessage));
|
assertThat(e.getMessage(), containsString(errorMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compareMappingOnNodes(mappingsBeforeUpdateResponse);
|
compareMappingOnNodes(mappingsBeforeUpdateResponse);
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
import org.elasticsearch.index.IndexService;
|
import org.elasticsearch.index.IndexService;
|
||||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.core.LongFieldMapper;
|
import org.elasticsearch.index.mapper.core.LongFieldMapper;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
|
@ -38,6 +37,7 @@ import java.io.IOException;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath;
|
import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath;
|
||||||
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,15 +122,15 @@ public class UpdateMappingTests extends ESSingleNodeTestCase {
|
||||||
try {
|
try {
|
||||||
mapperService.merge("type", new CompressedXContent(update.string()), false, false);
|
mapperService.merge("type", new CompressedXContent(update.string()), false, false);
|
||||||
fail();
|
fail();
|
||||||
} catch (MergeMappingException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// expected
|
assertThat(e.getMessage(), containsString("Merge failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mapperService.merge("type", new CompressedXContent(update.string()), false, false);
|
mapperService.merge("type", new CompressedXContent(update.string()), false, false);
|
||||||
fail();
|
fail();
|
||||||
} catch (MergeMappingException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// expected
|
assertThat(e.getMessage(), containsString("Merge failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(mapperService.documentMapper("type").mapping().root().getMapper("foo") instanceof LongFieldMapper);
|
assertTrue(mapperService.documentMapper("type").mapping().root().getMapper("foo") instanceof LongFieldMapper);
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.MapperService;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
|
@ -140,7 +139,7 @@ public class UpdateMappingIntegrationIT extends ESIntegTestCase {
|
||||||
client().admin().indices().preparePutMapping("test").setType("type")
|
client().admin().indices().preparePutMapping("test").setType("type")
|
||||||
.setSource("{\"type\":{\"properties\":{\"body\":{\"type\":\"integer\"}}}}").execute().actionGet();
|
.setSource("{\"type\":{\"properties\":{\"body\":{\"type\":\"integer\"}}}}").execute().actionGet();
|
||||||
fail("Expected MergeMappingException");
|
fail("Expected MergeMappingException");
|
||||||
} catch (MergeMappingException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
assertThat(e.getMessage(), containsString("mapper [body] of different type"));
|
assertThat(e.getMessage(), containsString("mapper [body] of different type"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +153,7 @@ public class UpdateMappingIntegrationIT extends ESIntegTestCase {
|
||||||
.setSource("{\"type\":{\"properties\":{\"body\":{\"type\":\"string\", \"norms\": { \"enabled\": true }}}}}").execute()
|
.setSource("{\"type\":{\"properties\":{\"body\":{\"type\":\"string\", \"norms\": { \"enabled\": true }}}}}").execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
fail("Expected MergeMappingException");
|
fail("Expected MergeMappingException");
|
||||||
} catch (MergeMappingException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
assertThat(e.getMessage(), containsString("mapper [body] has different [omit_norms]"));
|
assertThat(e.getMessage(), containsString("mapper [body] has different [omit_norms]"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.common.lucene.search.function.FiltersFunctionScoreQuery
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.index.IndexModule;
|
import org.elasticsearch.index.IndexModule;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.query.HasChildQueryBuilder;
|
import org.elasticsearch.index.query.HasChildQueryBuilder;
|
||||||
import org.elasticsearch.index.query.IdsQueryBuilder;
|
import org.elasticsearch.index.query.IdsQueryBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
|
@ -1176,7 +1175,7 @@ public class ChildQuerySearchIT extends ESIntegTestCase {
|
||||||
.startObject("_parent").field("type", "parent").endObject()
|
.startObject("_parent").field("type", "parent").endObject()
|
||||||
.endObject().endObject()).get();
|
.endObject().endObject()).get();
|
||||||
fail();
|
fail();
|
||||||
} catch (MergeMappingException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
assertThat(e.toString(), containsString("Merge failed with failures {[The _parent field's type option can't be changed: [null]->[parent]"));
|
assertThat(e.toString(), containsString("Merge failed with failures {[The _parent field's type option can't be changed: [null]->[parent]"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -602,7 +602,7 @@ public class AttachmentMapper extends FieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
// ignore this for now
|
// ignore this for now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.Mapper;
|
import org.elasticsearch.index.mapper.Mapper;
|
||||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
|
||||||
import org.elasticsearch.index.mapper.MergeResult;
|
import org.elasticsearch.index.mapper.MergeResult;
|
||||||
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
import org.elasticsearch.index.mapper.MetadataFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.ParseContext;
|
import org.elasticsearch.index.mapper.ParseContext;
|
||||||
|
@ -178,7 +177,7 @@ public class SizeFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
public void merge(Mapper mergeWith, MergeResult mergeResult) {
|
||||||
SizeFieldMapper sizeFieldMapperMergeWith = (SizeFieldMapper) mergeWith;
|
SizeFieldMapper sizeFieldMapperMergeWith = (SizeFieldMapper) mergeWith;
|
||||||
if (!mergeResult.simulate()) {
|
if (!mergeResult.simulate()) {
|
||||||
if (sizeFieldMapperMergeWith.enabledState != enabledState && !sizeFieldMapperMergeWith.enabledState.unset()) {
|
if (sizeFieldMapperMergeWith.enabledState != enabledState && !sizeFieldMapperMergeWith.enabledState.unset()) {
|
||||||
|
|
Loading…
Reference in New Issue