Be stricter about parsing boolean values in mappings.

Parsing is currently very lenient, which has the bad side-effect that if you
have a typo and pass eg. `store: fasle` this will actually be interpreted as
`store: true`. Since mappings can't be changed after the fact, it is quite bad
if it happens on an index that already contains data.

Note that this does not cover all settings that accept a boolean, but since the
PR was quite hard to build and already covers some main settirgs like `store`
or `doc_values` this would already be a good incremental improvement.
This commit is contained in:
Adrien Grand 2016-01-21 14:22:20 +01:00
parent f959d39ac3
commit 35709f62b6
60 changed files with 262 additions and 232 deletions

View File

@ -45,7 +45,7 @@ import static org.elasticsearch.common.Strings.hasLength;
import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS;
import static org.elasticsearch.common.settings.Settings.readSettingsFromStream;
import static org.elasticsearch.common.settings.Settings.writeSettingsToStream;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
/**
* Create snapshot request
@ -379,14 +379,14 @@ public class CreateSnapshotRequest extends MasterNodeRequest<CreateSnapshotReque
throw new IllegalArgumentException("malformed indices section, should be an array of strings");
}
} else if (name.equals("partial")) {
partial(nodeBooleanValue(entry.getValue()));
partial(lenientNodeBooleanValue(entry.getValue()));
} else if (name.equals("settings")) {
if (!(entry.getValue() instanceof Map)) {
throw new IllegalArgumentException("malformed settings section, should indices an inner object");
}
settings((Map<String, Object>) entry.getValue());
} else if (name.equals("include_global_state")) {
includeGlobalState = nodeBooleanValue(entry.getValue());
includeGlobalState = lenientNodeBooleanValue(entry.getValue());
}
}
indicesOptions(IndicesOptions.fromMap((Map<String, Object>) source, IndicesOptions.lenientExpandOpen()));

View File

@ -43,7 +43,7 @@ import static org.elasticsearch.common.Strings.hasLength;
import static org.elasticsearch.common.settings.Settings.Builder.EMPTY_SETTINGS;
import static org.elasticsearch.common.settings.Settings.readSettingsFromStream;
import static org.elasticsearch.common.settings.Settings.writeSettingsToStream;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
/**
* Restore snapshot request
@ -498,16 +498,16 @@ public class RestoreSnapshotRequest extends MasterNodeRequest<RestoreSnapshotReq
throw new IllegalArgumentException("malformed indices section, should be an array of strings");
}
} else if (name.equals("partial")) {
partial(nodeBooleanValue(entry.getValue()));
partial(lenientNodeBooleanValue(entry.getValue()));
} else if (name.equals("settings")) {
if (!(entry.getValue() instanceof Map)) {
throw new IllegalArgumentException("malformed settings section");
}
settings((Map<String, Object>) entry.getValue());
} else if (name.equals("include_global_state")) {
includeGlobalState = nodeBooleanValue(entry.getValue());
includeGlobalState = lenientNodeBooleanValue(entry.getValue());
} else if (name.equals("include_aliases")) {
includeAliases = nodeBooleanValue(entry.getValue());
includeAliases = lenientNodeBooleanValue(entry.getValue());
} else if (name.equals("rename_pattern")) {
if (entry.getValue() instanceof String) {
renamePattern((String) entry.getValue());

View File

@ -26,7 +26,7 @@ import org.elasticsearch.rest.RestRequest;
import java.io.IOException;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeStringArrayValue;
/**
@ -195,8 +195,8 @@ public class IndicesOptions {
//note that allowAliasesToMultipleIndices is not exposed, always true (only for internal use)
return fromOptions(
nodeBooleanValue(ignoreUnavailableString, defaultSettings.ignoreUnavailable()),
nodeBooleanValue(allowNoIndicesString, defaultSettings.allowNoIndices()),
lenientNodeBooleanValue(ignoreUnavailableString, defaultSettings.ignoreUnavailable()),
lenientNodeBooleanValue(allowNoIndicesString, defaultSettings.allowNoIndices()),
expandWildcardsOpen,
expandWildcardsClosed,
defaultSettings.allowAliasesToMultipleIndices(),

View File

@ -41,7 +41,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
/**
* Mapping configuration for a type.
@ -237,7 +237,7 @@ public class MappingMetaData extends AbstractDiffable<MappingMetaData> {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("required")) {
required = nodeBooleanValue(fieldNode);
required = lenientNodeBooleanValue(fieldNode);
}
}
this.routing = new Routing(required);
@ -254,13 +254,13 @@ public class MappingMetaData extends AbstractDiffable<MappingMetaData> {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
enabled = nodeBooleanValue(fieldNode);
enabled = lenientNodeBooleanValue(fieldNode);
} else if (fieldName.equals("format")) {
format = fieldNode.toString();
} else if (fieldName.equals("default") && fieldNode != null) {
defaultTimestamp = fieldNode.toString();
} else if (fieldName.equals("ignore_missing")) {
ignoreMissing = nodeBooleanValue(fieldNode);
ignoreMissing = lenientNodeBooleanValue(fieldNode);
}
}
this.timestamp = new Timestamp(enabled, format, defaultTimestamp, ignoreMissing);

View File

@ -347,14 +347,20 @@ public class XContentMapValues {
return Long.parseLong(node.toString());
}
public static boolean nodeBooleanValue(Object node, boolean defaultValue) {
/**
* This method is very lenient, use {@link #nodeBooleanValue} instead.
*/
public static boolean lenientNodeBooleanValue(Object node, boolean defaultValue) {
if (node == null) {
return defaultValue;
}
return nodeBooleanValue(node);
return lenientNodeBooleanValue(node);
}
public static boolean nodeBooleanValue(Object node) {
/**
* This method is very lenient, use {@link #nodeBooleanValue} instead.
*/
public static boolean lenientNodeBooleanValue(Object node) {
if (node instanceof Boolean) {
return (Boolean) node;
}
@ -365,6 +371,17 @@ public class XContentMapValues {
return !(value.equals("false") || value.equals("0") || value.equals("off"));
}
public static boolean nodeBooleanValue(Object node) {
switch (node.toString()) {
case "true":
return true;
case "false":
return false;
default:
throw new IllegalArgumentException("Can't parse boolean value [" + node + "], expected [true] or [false]");
}
}
public static TimeValue nodeTimeValue(Object node, TimeValue defaultValue) {
if (node == null) {
return defaultValue;

View File

@ -40,7 +40,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.index.mapper.MapperBuilders.booleanField;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseField;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseMultiField;
@ -106,7 +106,7 @@ public class BooleanFieldMapper extends FieldMapper {
if (propNode == null) {
throw new MapperParsingException("Property [null_value] cannot be null.");
}
builder.nullValue(nodeBooleanValue(propNode));
builder.nullValue(lenientNodeBooleanValue(propNode));
iterator.remove();
} else if (parseMultiField(builder, name, parserContext, propName, propNode)) {
iterator.remove();

View File

@ -28,6 +28,7 @@ import org.elasticsearch.common.joda.Joda;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.loader.SettingsLoader;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.mapper.DocumentMapperParser;
import org.elasticsearch.index.mapper.FieldMapper;
@ -45,7 +46,7 @@ import java.util.Map;
import java.util.Map.Entry;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.isArray;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeFloatValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeIntegerValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeMapValue;
@ -62,6 +63,14 @@ public class TypeParsers {
public static final String INDEX_OPTIONS_POSITIONS = "positions";
public static final String INDEX_OPTIONS_OFFSETS = "offsets";
private static boolean nodeBooleanValue(Object node, Mapper.TypeParser.ParserContext parserContext) {
if (parserContext.indexVersionCreated().onOrAfter(Version.V_3_0_0)) {
return XContentMapValues.nodeBooleanValue(node);
} else {
return XContentMapValues.lenientNodeBooleanValue(node);
}
}
public static void parseNumberField(NumberFieldMapper.Builder builder, String name, Map<String, Object> numberNode, Mapper.TypeParser.ParserContext parserContext) {
parseField(builder, name, numberNode, parserContext);
for (Iterator<Map.Entry<String, Object>> iterator = numberNode.entrySet().iterator(); iterator.hasNext();) {
@ -72,13 +81,13 @@ public class TypeParsers {
builder.precisionStep(nodeIntegerValue(propNode));
iterator.remove();
} else if (propName.equals("ignore_malformed")) {
builder.ignoreMalformed(nodeBooleanValue(propNode));
builder.ignoreMalformed(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("coerce")) {
builder.coerce(nodeBooleanValue(propNode));
builder.coerce(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("omit_norms")) {
builder.omitNorms(nodeBooleanValue(propNode));
builder.omitNorms(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("similarity")) {
SimilarityProvider similarityProvider = resolveSimilarity(parserContext, name, propNode.toString());
@ -102,16 +111,16 @@ public class TypeParsers {
parseTermVector(name, propNode.toString(), builder);
iterator.remove();
} else if (propName.equals("store_term_vectors")) {
builder.storeTermVectors(nodeBooleanValue(propNode));
builder.storeTermVectors(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("store_term_vector_offsets")) {
builder.storeTermVectorOffsets(nodeBooleanValue(propNode));
builder.storeTermVectorOffsets(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("store_term_vector_positions")) {
builder.storeTermVectorPositions(nodeBooleanValue(propNode));
builder.storeTermVectorPositions(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("store_term_vector_payloads")) {
builder.storeTermVectorPayloads(nodeBooleanValue(propNode));
builder.storeTermVectorPayloads(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("analyzer")) {
NamedAnalyzer analyzer = parserContext.analysisService().analyzer(propNode.toString());
@ -160,19 +169,19 @@ public class TypeParsers {
final String propName = Strings.toUnderscoreCase(entry.getKey());
final Object propNode = entry.getValue();
if (propName.equals("store")) {
builder.store(parseStore(name, propNode.toString()));
builder.store(parseStore(name, propNode.toString(), parserContext));
iterator.remove();
} else if (propName.equals("index")) {
parseIndex(name, propNode.toString(), builder);
iterator.remove();
} else if (propName.equals(DOC_VALUES)) {
builder.docValues(nodeBooleanValue(propNode));
builder.docValues(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("boost")) {
builder.boost(nodeFloatValue(propNode));
iterator.remove();
} else if (propName.equals("omit_norms")) {
builder.omitNorms(nodeBooleanValue(propNode));
builder.omitNorms(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("norms")) {
final Map<String, Object> properties = nodeMapValue(propNode, "norms");
@ -181,7 +190,7 @@ public class TypeParsers {
final String propName2 = Strings.toUnderscoreCase(entry2.getKey());
final Object propNode2 = entry2.getValue();
if (propName2.equals("enabled")) {
builder.omitNorms(!nodeBooleanValue(propNode2));
builder.omitNorms(!lenientNodeBooleanValue(propNode2));
propsIterator.remove();
} else if (propName2.equals(Loading.KEY)) {
builder.normsLoading(Loading.parse(nodeStringValue(propNode2, null), null));
@ -194,7 +203,7 @@ public class TypeParsers {
builder.indexOptions(nodeIndexOptionValue(propNode));
iterator.remove();
} else if (propName.equals("include_in_all")) {
builder.includeInAll(nodeBooleanValue(propNode));
builder.includeInAll(nodeBooleanValue(propNode, parserContext));
iterator.remove();
} else if (propName.equals("similarity")) {
SimilarityProvider similarityProvider = resolveSimilarity(parserContext, name, propNode.toString());
@ -334,13 +343,17 @@ public class TypeParsers {
}
}
public static boolean parseStore(String fieldName, String store) throws MapperParsingException {
if ("no".equals(store)) {
return false;
} else if ("yes".equals(store)) {
return true;
public static boolean parseStore(String fieldName, String store, Mapper.TypeParser.ParserContext parserContext) throws MapperParsingException {
if (parserContext.indexVersionCreated().onOrAfter(Version.V_3_0_0)) {
return XContentMapValues.nodeBooleanValue(store);
} else {
return nodeBooleanValue(store);
if ("no".equals(store)) {
return false;
} else if ("yes".equals(store)) {
return true;
} else {
return lenientNodeBooleanValue(store);
}
}
}

View File

@ -199,17 +199,17 @@ public abstract class BaseGeoPointFieldMapper extends FieldMapper implements Arr
String propName = Strings.toUnderscoreCase(entry.getKey());
Object propNode = entry.getValue();
if (propName.equals("lat_lon")) {
builder.enableLatLon(XContentMapValues.nodeBooleanValue(propNode));
builder.enableLatLon(XContentMapValues.lenientNodeBooleanValue(propNode));
iterator.remove();
} else if (propName.equals("precision_step")) {
builder.precisionStep(XContentMapValues.nodeIntegerValue(propNode));
iterator.remove();
} else if (propName.equals("geohash")) {
builder.enableGeoHash(XContentMapValues.nodeBooleanValue(propNode));
builder.enableGeoHash(XContentMapValues.lenientNodeBooleanValue(propNode));
iterator.remove();
} else if (propName.equals("geohash_prefix")) {
builder.geoHashPrefix(XContentMapValues.nodeBooleanValue(propNode));
if (XContentMapValues.nodeBooleanValue(propNode)) {
builder.geoHashPrefix(XContentMapValues.lenientNodeBooleanValue(propNode));
if (XContentMapValues.lenientNodeBooleanValue(propNode)) {
builder.enableGeoHash(true);
}
iterator.remove();
@ -221,7 +221,7 @@ public abstract class BaseGeoPointFieldMapper extends FieldMapper implements Arr
}
iterator.remove();
} else if (propName.equals(Names.IGNORE_MALFORMED)) {
builder.ignoreMalformed(XContentMapValues.nodeBooleanValue(propNode));
builder.ignoreMalformed(XContentMapValues.lenientNodeBooleanValue(propNode));
iterator.remove();
} else if (parseMultiField(builder, name, parserContext, propName, propNode)) {
iterator.remove();

View File

@ -132,7 +132,7 @@ public class GeoPointFieldMapperLegacy extends BaseGeoPointFieldMapper implement
String propName = Strings.toUnderscoreCase(entry.getKey());
Object propNode = entry.getValue();
if (propName.equals(Names.COERCE)) {
builder.coerce = XContentMapValues.nodeBooleanValue(propNode);
builder.coerce = XContentMapValues.lenientNodeBooleanValue(propNode);
iterator.remove();
}
}

View File

@ -52,7 +52,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.index.mapper.MapperBuilders.geoShapeField;
@ -184,11 +184,11 @@ public class GeoShapeFieldMapper extends FieldMapper {
builder.fieldType().setStrategyName(fieldNode.toString());
iterator.remove();
} else if (Names.COERCE.equals(fieldName)) {
builder.coerce(nodeBooleanValue(fieldNode));
builder.coerce(lenientNodeBooleanValue(fieldNode));
iterator.remove();
} else if (Names.STRATEGY_POINTS_ONLY.equals(fieldName)
&& builder.fieldType().strategyName.equals(SpatialStrategy.TERM.getStrategyName()) == false) {
builder.fieldType().setPointsOnly(XContentMapValues.nodeBooleanValue(fieldNode));
builder.fieldType().setPointsOnly(XContentMapValues.lenientNodeBooleanValue(fieldNode));
iterator.remove();
}
}

View File

@ -46,7 +46,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeMapValue;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseTextField;
@ -133,7 +133,7 @@ public class AllFieldMapper extends MetadataFieldMapper {
// the AllFieldMapper ctor in the builder since it is not valid. Here we validate
// the doc values settings (old and new) are rejected
Object docValues = node.get("doc_values");
if (docValues != null && nodeBooleanValue(docValues)) {
if (docValues != null && lenientNodeBooleanValue(docValues)) {
throw new MapperParsingException("Field [" + name + "] is always tokenized and cannot have doc values");
}
// convoluted way of specifying doc values
@ -152,7 +152,7 @@ public class AllFieldMapper extends MetadataFieldMapper {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
builder.enabled(nodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED);
builder.enabled(lenientNodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED);
iterator.remove();
}
}

View File

@ -40,7 +40,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
/**
* A mapper that indexes the field names of a document under <code>_field_names</code>. This mapper is typically useful in order
@ -112,7 +112,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
builder.enabled(nodeBooleanValue(fieldNode));
builder.enabled(lenientNodeBooleanValue(fieldNode));
iterator.remove();
}
}

View File

@ -38,7 +38,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
/**
*
@ -95,7 +95,7 @@ public class RoutingFieldMapper extends MetadataFieldMapper {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("required")) {
builder.required(nodeBooleanValue(fieldNode));
builder.required(lenientNodeBooleanValue(fieldNode));
iterator.remove();
}
}

View File

@ -51,7 +51,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
/**
*
@ -122,7 +122,7 @@ public class SourceFieldMapper extends MetadataFieldMapper {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
builder.enabled(nodeBooleanValue(fieldNode));
builder.enabled(lenientNodeBooleanValue(fieldNode));
iterator.remove();
} else if ("format".equals(fieldName) && parserContext.indexVersionCreated().before(Version.V_3_0_0)) {
// ignore on old indices, reject on and after 3.0

View File

@ -44,7 +44,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeTimeValue;
public class TTLFieldMapper extends MetadataFieldMapper {
@ -108,7 +108,7 @@ public class TTLFieldMapper extends MetadataFieldMapper {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
EnabledAttributeMapper enabledState = nodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED;
EnabledAttributeMapper enabledState = lenientNodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED;
builder.enabled(enabledState);
iterator.remove();
} else if (fieldName.equals("default")) {

View File

@ -43,7 +43,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseDateTimeFormatter;
public class TimestampFieldMapper extends MetadataFieldMapper {
@ -134,7 +134,7 @@ public class TimestampFieldMapper extends MetadataFieldMapper {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
EnabledAttributeMapper enabledState = nodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED;
EnabledAttributeMapper enabledState = lenientNodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED;
builder.enabled(enabledState);
iterator.remove();
} else if (fieldName.equals("format")) {
@ -149,7 +149,7 @@ public class TimestampFieldMapper extends MetadataFieldMapper {
}
iterator.remove();
} else if (fieldName.equals("ignore_missing")) {
ignoreMissing = nodeBooleanValue(fieldNode);
ignoreMissing = lenientNodeBooleanValue(fieldNode);
builder.ignoreMissing(ignoreMissing);
iterator.remove();
}

View File

@ -49,7 +49,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.index.mapper.MapperBuilders.object;
/**
@ -191,11 +191,11 @@ public class ObjectMapper extends Mapper implements AllFieldMapper.IncludeInAll,
if (value.equalsIgnoreCase("strict")) {
builder.dynamic(Dynamic.STRICT);
} else {
builder.dynamic(nodeBooleanValue(fieldNode) ? Dynamic.TRUE : Dynamic.FALSE);
builder.dynamic(lenientNodeBooleanValue(fieldNode) ? Dynamic.TRUE : Dynamic.FALSE);
}
return true;
} else if (fieldName.equals("enabled")) {
builder.enabled(nodeBooleanValue(fieldNode));
builder.enabled(lenientNodeBooleanValue(fieldNode));
return true;
} else if (fieldName.equals("properties")) {
if (fieldNode instanceof Collection && ((Collection) fieldNode).isEmpty()) {
@ -207,7 +207,7 @@ public class ObjectMapper extends Mapper implements AllFieldMapper.IncludeInAll,
}
return true;
} else if (fieldName.equals("include_in_all")) {
builder.includeInAll(nodeBooleanValue(fieldNode));
builder.includeInAll(lenientNodeBooleanValue(fieldNode));
return true;
}
return false;
@ -230,12 +230,12 @@ public class ObjectMapper extends Mapper implements AllFieldMapper.IncludeInAll,
}
fieldNode = node.get("include_in_parent");
if (fieldNode != null) {
nestedIncludeInParent = nodeBooleanValue(fieldNode);
nestedIncludeInParent = lenientNodeBooleanValue(fieldNode);
node.remove("include_in_parent");
}
fieldNode = node.get("include_in_root");
if (fieldNode != null) {
nestedIncludeInRoot = nodeBooleanValue(fieldNode);
nestedIncludeInRoot = lenientNodeBooleanValue(fieldNode);
node.remove("include_in_root");
}
if (nested) {

View File

@ -42,7 +42,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseDateTimeFormatter;
/**
@ -189,10 +189,10 @@ public class RootObjectMapper extends ObjectMapper {
}
return true;
} else if (fieldName.equals("date_detection")) {
((Builder) builder).dateDetection = nodeBooleanValue(fieldNode);
((Builder) builder).dateDetection = lenientNodeBooleanValue(fieldNode);
return true;
} else if (fieldName.equals("numeric_detection")) {
((Builder) builder).numericDetection = nodeBooleanValue(fieldNode);
((Builder) builder).numericDetection = lenientNodeBooleanValue(fieldNode);
return true;
}
return false;

View File

@ -46,7 +46,7 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeStringArrayValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeStringValue;
import static org.elasticsearch.rest.RestRequest.Method.GET;
@ -159,7 +159,7 @@ public class RestMultiSearchAction extends BaseRestHandler {
} else if ("search_type".equals(entry.getKey()) || "searchType".equals(entry.getKey())) {
searchRequest.searchType(nodeStringValue(value, null));
} else if ("request_cache".equals(entry.getKey()) || "requestCache".equals(entry.getKey())) {
searchRequest.requestCache(nodeBooleanValue(value));
searchRequest.requestCache(lenientNodeBooleanValue(value));
} else if ("preference".equals(entry.getKey())) {
searchRequest.preference(nodeStringValue(value, null));
} else if ("routing".equals(entry.getKey())) {

View File

@ -152,7 +152,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
.addMapping("type1",
"field0", "type=integer,", // no tvs
"field1", "type=string,index=no", // no tvs
"field2", "type=string,index=no,store=yes", // no tvs
"field2", "type=string,index=no,store=true", // no tvs
"field3", "type=string,index=no,term_vector=yes", // no tvs
"field4", "type=string,index=not_analyzed", // yes tvs
"field5", "type=string,index=analyzed")); // yes tvs

View File

@ -90,8 +90,8 @@ public class SimpleClusterStateIT extends ESIntegTestCase {
.setTemplate("te*")
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.get();

View File

@ -253,12 +253,12 @@ public class GetActionIT extends ESIntegTestCase {
public void testGetDocWithMultivaluedFields() throws Exception {
String mapping1 = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("properties")
.startObject("field").field("type", "string").field("store", "yes").endObject()
.startObject("field").field("type", "string").field("store", true).endObject()
.endObject()
.endObject().endObject().string();
String mapping2 = XContentFactory.jsonBuilder().startObject().startObject("type2")
.startObject("properties")
.startObject("field").field("type", "string").field("store", "yes").endObject()
.startObject("field").field("type", "string").field("store", true).endObject()
.endObject()
.endObject().endObject().string();
assertAcked(prepareCreate("test")
@ -751,7 +751,7 @@ public class GetActionIT extends ESIntegTestCase {
.startObject("field1").field("type", "object").startObject("properties")
.startObject("field2").field("type", "object").startObject("properties")
.startObject("field3").field("type", "object").startObject("properties")
.startObject("field4").field("type", "string").field("store", "yes")
.startObject("field4").field("type", "string").field("store", true)
.endObject().endObject()
.endObject().endObject()
.endObject().endObject()

View File

@ -374,7 +374,7 @@ public class DynamicMappingTests extends ESSingleNodeTestCase {
public void testReuseExistingMappings() throws IOException, Exception {
IndexService indexService = createIndex("test", Settings.EMPTY, "type",
"my_field1", "type=string,store=yes",
"my_field1", "type=string,store=true",
"my_field2", "type=integer,precision_step=10",
"my_field3", "type=long,doc_values=false",
"my_field4", "type=float,index_options=freqs",

View File

@ -63,7 +63,7 @@ public class BinaryMappingTests extends ESSingleNodeTestCase {
.startObject("properties")
.startObject("field")
.field("type", "binary")
.field("store", "yes")
.field("store", true)
.endObject()
.endObject()
.endObject().endObject().string();

View File

@ -89,12 +89,12 @@ public class ExternalValuesMapperIntegrationIT extends ESIntegTestCase {
.startObject("fields")
.startObject("g")
.field("type", "string")
.field("store", "yes")
.field("store", true)
.startObject("fields")
.startObject("raw")
.field("type", "string")
.field("index", "not_analyzed")
.field("store", "yes")
.field("store", true)
.endObject()
.endObject()
.endObject()

View File

@ -118,12 +118,12 @@ public class SimpleExternalMappingTests extends ESSingleNodeTestCase {
.startObject("fields")
.startObject("field")
.field("type", "string")
.field("store", "yes")
.field("store", true)
.startObject("fields")
.startObject("raw")
.field("type", "string")
.field("index", "not_analyzed")
.field("store", "yes")
.field("store", true)
.endObject()
.endObject()
.endObject()

View File

@ -330,7 +330,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase {
public void testLatLonValuesStored() throws Exception {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true)
.field("store", "yes").endObject().endObject().endObject().endObject().string();
.field("store", true).endObject().endObject().endObject().endObject().string();
Version version = VersionUtils.randomVersionBetween(random(), Version.V_1_0_0, Version.CURRENT);
Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build();
@ -357,7 +357,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase {
public void testArrayLatLonValues() throws Exception {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true)
.field("store", "yes").endObject().endObject().endObject().endObject().string();
.field("store", true).endObject().endObject().endObject().endObject().string();
Version version = VersionUtils.randomVersionBetween(random(), Version.V_1_0_0, Version.CURRENT);
Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build();
@ -416,7 +416,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase {
public void testLatLonInOneValueStored() throws Exception {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true).field("store", "yes").endObject().endObject()
.startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true).field("store", true).endObject().endObject()
.endObject().endObject().string();
Version version = VersionUtils.randomVersionBetween(random(), Version.V_1_0_0, Version.CURRENT);
@ -443,7 +443,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase {
public void testLatLonInOneValueArray() throws Exception {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true)
.field("store", "yes").endObject().endObject().endObject().endObject().string();
.field("store", true).endObject().endObject().endObject().endObject().string();
Version version = VersionUtils.randomVersionBetween(random(), Version.V_1_0_0, Version.CURRENT);
Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build();
@ -528,7 +528,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase {
public void testLonLatArrayStored() throws Exception {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true)
.field("store", "yes").endObject().endObject().endObject().endObject().string();
.field("store", true).endObject().endObject().endObject().endObject().string();
Version version = VersionUtils.randomVersionBetween(random(), Version.V_1_0_0, Version.CURRENT);
Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build();
@ -554,7 +554,7 @@ public class GeoPointFieldMapperTests extends ESSingleNodeTestCase {
public void testLonLatArrayArrayStored() throws Exception {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true)
.field("store", "yes").endObject().endObject().endObject().endObject().string();
.field("store", true).endObject().endObject().endObject().endObject().string();
Version version = VersionUtils.randomVersionBetween(random(), Version.V_1_0_0, Version.CURRENT);
Settings settings = Settings.settingsBuilder().put(IndexMetaData.SETTING_VERSION_CREATED, version).build();

View File

@ -54,9 +54,9 @@ public class StoredNumericValuesTests extends ESSingleNodeTestCase {
.startObject()
.startObject("type")
.startObject("properties")
.startObject("field1").field("type", "integer").field("store", "yes").endObject()
.startObject("field2").field("type", "float").field("store", "yes").endObject()
.startObject("field3").field("type", "long").field("store", "yes").endObject()
.startObject("field1").field("type", "integer").field("store", true).endObject()
.startObject("field2").field("type", "float").field("store", true).endObject()
.startObject("field3").field("type", "long").field("store", true).endObject()
.endObject()
.endObject()
.endObject()

View File

@ -44,7 +44,7 @@ public class ConcurrentDynamicTemplateIT extends ESIntegTestCase {
final String fieldName = "field";
final String mapping = "{ \"" + mappingType + "\": {" +
"\"dynamic_templates\": ["
+ "{ \"" + fieldName + "\": {" + "\"path_match\": \"*\"," + "\"mapping\": {" + "\"type\": \"string\"," + "\"store\": \"yes\","
+ "{ \"" + fieldName + "\": {" + "\"path_match\": \"*\"," + "\"mapping\": {" + "\"type\": \"string\"," + "\"store\": true,"
+ "\"index\": \"analyzed\", \"analyzer\": \"whitespace\" } } } ] } }";
// The 'fieldNames' array is used to help with retrieval of index terms
// after testing

View File

@ -38,8 +38,8 @@ public class IndexTemplateBlocksIT extends ESIntegTestCase {
.setTemplate("te*")
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.execute().actionGet();

View File

@ -78,8 +78,8 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setSettings(indexSettings())
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.get();
@ -88,7 +88,7 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setSettings(indexSettings())
.setOrder(1)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field2").field("type", "string").field("store", "no").endObject()
.startObject("field2").field("type", "string").field("store", false).endObject()
.endObject().endObject().endObject())
.get();
@ -99,7 +99,7 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setCreate(true)
.setOrder(1)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field2").field("type", "string").field("store", "no").endObject()
.startObject("field2").field("type", "string").field("store", false).endObject()
.endObject().endObject().endObject())
, IndexTemplateAlreadyExistsException.class
);
@ -145,8 +145,8 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setTemplate("te*")
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.execute().actionGet();
@ -170,8 +170,8 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setTemplate("te*")
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.execute().actionGet();
@ -190,8 +190,8 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setTemplate("te*")
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.execute().actionGet();
@ -213,8 +213,8 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setTemplate("te*")
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.execute().actionGet();
@ -223,8 +223,8 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setTemplate("te*")
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.execute().actionGet();
@ -233,8 +233,8 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
.setTemplate("te*")
.setOrder(0)
.addMapping("type1", XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "yes").field("index", "not_analyzed").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", true).field("index", "not_analyzed").endObject()
.endObject().endObject().endObject())
.execute().actionGet();

View File

@ -174,13 +174,13 @@ public class HighlighterSearchIT extends ESIntegTestCase {
.field("index_options", "offsets")
.field("term_vector", "with_positions_offsets")
.field("type", "string")
.field("store", "no")
.field("store", false)
.endObject()
.startObject("text")
.field("index_options", "offsets")
.field("term_vector", "with_positions_offsets")
.field("type", "string")
.field("store", "yes")
.field("store", true)
.endObject()
.endObject()
.endObject();
@ -205,7 +205,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
// see #3486
public void testHighTermFrequencyDoc() throws IOException {
assertAcked(prepareCreate("test")
.addMapping("test", "name", "type=string,term_vector=with_positions_offsets,store=" + (randomBoolean() ? "yes" : "no")));
.addMapping("test", "name", "type=string,term_vector=with_positions_offsets,store=" + randomBoolean()));
ensureYellow();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 6000; i++) {
@ -471,8 +471,8 @@ public class HighlighterSearchIT extends ESIntegTestCase {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
// we don't store title and don't use term vector, now lets see if it works...
.startObject("title").field("type", "string").field("store", "no").field("term_vector", "no").endObject()
.startObject("attachments").startObject("properties").startObject("body").field("type", "string").field("store", "no").field("term_vector", "no").endObject().endObject().endObject()
.startObject("title").field("type", "string").field("store", false).field("term_vector", "no").endObject()
.startObject("attachments").startObject("properties").startObject("body").field("type", "string").field("store", false).field("term_vector", "no").endObject().endObject().endObject()
.endObject().endObject().endObject()));
ensureYellow();
@ -510,8 +510,8 @@ public class HighlighterSearchIT extends ESIntegTestCase {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
// we don't store title, now lets see if it works...
.startObject("title").field("type", "string").field("store", "no").field("term_vector", "with_positions_offsets").endObject()
.startObject("attachments").startObject("properties").startObject("body").field("type", "string").field("store", "no").field("term_vector", "with_positions_offsets").endObject().endObject().endObject()
.startObject("title").field("type", "string").field("store", false).field("term_vector", "with_positions_offsets").endObject()
.startObject("attachments").startObject("properties").startObject("body").field("type", "string").field("store", false).field("term_vector", "with_positions_offsets").endObject().endObject().endObject()
.endObject().endObject().endObject()));
ensureYellow();
@ -549,8 +549,8 @@ public class HighlighterSearchIT extends ESIntegTestCase {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
// we don't store title, now lets see if it works...
.startObject("title").field("type", "string").field("store", "no").field("index_options", "offsets").endObject()
.startObject("attachments").startObject("properties").startObject("body").field("type", "string").field("store", "no").field("index_options", "offsets").endObject().endObject().endObject()
.startObject("title").field("type", "string").field("store", false).field("index_options", "offsets").endObject()
.startObject("attachments").startObject("properties").startObject("body").field("type", "string").field("store", false).field("index_options", "offsets").endObject().endObject().endObject()
.endObject().endObject().endObject()));
ensureYellow();
@ -598,7 +598,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testHighlightIssue1994() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", "title", "type=string,store=no", "titleTV", "type=string,store=no,term_vector=with_positions_offsets"));
.addMapping("type1", "title", "type=string,store=false", "titleTV", "type=string,store=false,term_vector=with_positions_offsets"));
ensureYellow();
indexRandom(false, client().prepareIndex("test", "type1", "1")
@ -683,7 +683,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
.addMapping("type1", jsonBuilder().startObject().startObject("type1")
.startObject("_source").field("enabled", false).endObject()
.startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").field("index_options", "offsets")
.startObject("field1").field("type", "string").field("store", true).field("index_options", "offsets")
.field("term_vector", "with_positions_offsets").endObject()
.endObject().endObject().endObject()));
@ -915,7 +915,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
.startObject("foo")
.field("type", "string")
.field("termVector", "with_positions_offsets")
.field("store", "yes")
.field("store", true)
.field("analyzer", "english")
.startObject("fields")
.startObject("plain")
@ -928,7 +928,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
.startObject("bar")
.field("type", "string")
.field("termVector", "with_positions_offsets")
.field("store", "yes")
.field("store", true)
.field("analyzer", "english")
.startObject("fields")
.startObject("plain")
@ -1101,7 +1101,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public XContentBuilder type1TermVectorMapping() throws IOException {
return XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("_all").field("store", "yes").field("termVector", "with_positions_offsets").endObject()
.startObject("_all").field("store", true).field("termVector", "with_positions_offsets").endObject()
.startObject("properties")
.startObject("field1").field("type", "string").field("termVector", "with_positions_offsets").endObject()
.startObject("field2").field("type", "string").field("termVector", "with_positions_offsets").endObject()
@ -1111,7 +1111,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testSameContent() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", "title", "type=string,store=yes,term_vector=with_positions_offsets"));
.addMapping("type1", "title", "type=string,store=true,term_vector=with_positions_offsets"));
ensureYellow();
IndexRequestBuilder[] indexRequestBuilders = new IndexRequestBuilder[5];
@ -1133,7 +1133,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testFastVectorHighlighterOffsetParameter() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", "title", "type=string,store=yes,term_vector=with_positions_offsets").get());
.addMapping("type1", "title", "type=string,store=true,term_vector=with_positions_offsets").get());
ensureYellow();
IndexRequestBuilder[] indexRequestBuilders = new IndexRequestBuilder[5];
@ -1156,7 +1156,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testEscapeHtml() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", "title", "type=string,store=yes"));
.addMapping("type1", "title", "type=string,store=true"));
ensureYellow();
IndexRequestBuilder[] indexRequestBuilders = new IndexRequestBuilder[5];
@ -1178,7 +1178,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testEscapeHtmlVector() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", "title", "type=string,store=yes,term_vector=with_positions_offsets"));
.addMapping("type1", "title", "type=string,store=true,term_vector=with_positions_offsets"));
ensureYellow();
IndexRequestBuilder[] indexRequestBuilders = new IndexRequestBuilder[5];
@ -1201,9 +1201,9 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testMultiMapperVectorWithStore() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("title").field("type", "string").field("store", "yes").field("term_vector", "with_positions_offsets").field("analyzer", "classic")
.startObject("title").field("type", "string").field("store", true).field("term_vector", "with_positions_offsets").field("analyzer", "classic")
.startObject("fields")
.startObject("key").field("type", "string").field("store", "yes").field("term_vector", "with_positions_offsets").field("analyzer", "whitespace").endObject()
.startObject("key").field("type", "string").field("store", true).field("term_vector", "with_positions_offsets").field("analyzer", "whitespace").endObject()
.endObject().endObject()
.endObject().endObject().endObject()));
ensureGreen();
@ -1229,9 +1229,9 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testMultiMapperVectorFromSource() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("title").field("type", "string").field("store", "no").field("term_vector", "with_positions_offsets").field("analyzer", "classic")
.startObject("title").field("type", "string").field("store", false).field("term_vector", "with_positions_offsets").field("analyzer", "classic")
.startObject("fields")
.startObject("key").field("type", "string").field("store", "no").field("term_vector", "with_positions_offsets").field("analyzer", "whitespace").endObject()
.startObject("key").field("type", "string").field("store", false).field("term_vector", "with_positions_offsets").field("analyzer", "whitespace").endObject()
.endObject().endObject()
.endObject().endObject().endObject()));
ensureGreen();
@ -1259,9 +1259,9 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testMultiMapperNoVectorWithStore() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("title").field("type", "string").field("store", "yes").field("term_vector", "no").field("analyzer", "classic")
.startObject("title").field("type", "string").field("store", true).field("term_vector", "no").field("analyzer", "classic")
.startObject("fields")
.startObject("key").field("type", "string").field("store", "yes").field("term_vector", "no").field("analyzer", "whitespace").endObject()
.startObject("key").field("type", "string").field("store", true).field("term_vector", "no").field("analyzer", "whitespace").endObject()
.endObject().endObject()
.endObject().endObject().endObject()));
@ -1289,9 +1289,9 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testMultiMapperNoVectorFromSource() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("title").field("type", "string").field("store", "no").field("term_vector", "no").field("analyzer", "classic")
.startObject("title").field("type", "string").field("store", false).field("term_vector", "no").field("analyzer", "classic")
.startObject("fields")
.startObject("key").field("type", "string").field("store", "no").field("term_vector", "no").field("analyzer", "whitespace").endObject()
.startObject("key").field("type", "string").field("store", false).field("term_vector", "no").field("analyzer", "whitespace").endObject()
.endObject().endObject()
.endObject().endObject().endObject()));
ensureGreen();
@ -1317,7 +1317,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testFastVectorHighlighterShouldFailIfNoTermVectors() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", "title", "type=string,store=yes,term_vector=no"));
.addMapping("type1", "title", "type=string,store=true,term_vector=no"));
ensureGreen();
IndexRequestBuilder[] indexRequestBuilders = new IndexRequestBuilder[5];
@ -1347,7 +1347,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testDisableFastVectorHighlighter() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", "title", "type=string,store=yes,term_vector=with_positions_offsets,analyzer=classic"));
.addMapping("type1", "title", "type=string,store=true,term_vector=with_positions_offsets,analyzer=classic"));
ensureGreen();
IndexRequestBuilder[] indexRequestBuilders = new IndexRequestBuilder[5];
@ -1485,7 +1485,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
.putArray("index.analysis.filter.synonym.synonyms", "quick => fast");
assertAcked(prepareCreate("test").setSettings(builder.build()).addMapping("type1", type1TermVectorMapping())
.addMapping("type2", "_all", "store=yes,termVector=with_positions_offsets",
.addMapping("type2", "_all", "store=true,termVector=with_positions_offsets",
"field4", "type=string,term_vector=with_positions_offsets,analyzer=synonym",
"field3", "type=string,analyzer=synonym"));
ensureGreen();
@ -1622,7 +1622,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testMissingStoredField() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", "highlight_field", "type=string,store=yes"));
.addMapping("type1", "highlight_field", "type=string,store=true"));
ensureGreen();
client().prepareIndex("test", "type1", "1")
.setSource(jsonBuilder().startObject()
@ -1744,7 +1744,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
private static String randomStoreField() {
if (randomBoolean()) {
return "store=yes,";
return "store=true,";
}
return "";
}
@ -2136,7 +2136,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testMultiMatchQueryHighlight() throws IOException {
String[] highlighterTypes = new String[] {"fvh", "plain", "postings"};
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("_all").field("store", "yes").field("index_options", "offsets").endObject()
.startObject("_all").field("store", true).field("index_options", "offsets").endObject()
.startObject("properties")
.startObject("field1").field("type", "string").field("index_options", "offsets").field("term_vector", "with_positions_offsets").endObject()
.startObject("field2").field("type", "string").field("index_options", "offsets").field("term_vector", "with_positions_offsets").endObject()
@ -2226,9 +2226,9 @@ public class HighlighterSearchIT extends ESIntegTestCase {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1")
.startObject("properties")
.startObject("title").field("type", "string").field("store", "yes").field("index_options", "offsets").field("analyzer", "classic")
.startObject("title").field("type", "string").field("store", true).field("index_options", "offsets").field("analyzer", "classic")
.startObject("fields")
.startObject("key").field("type", "string").field("store", "yes").field("index_options", "offsets").field("analyzer", "whitespace").endObject()
.startObject("key").field("type", "string").field("store", true).field("index_options", "offsets").field("analyzer", "whitespace").endObject()
.endObject().endObject()
.endObject().endObject().endObject()));
ensureGreen();
@ -2258,9 +2258,9 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testPostingsHighlighterMultiMapperFromSource() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("title").field("type", "string").field("store", "no").field("index_options", "offsets").field("analyzer", "classic")
.startObject("title").field("type", "string").field("store", false).field("index_options", "offsets").field("analyzer", "classic")
.startObject("fields")
.startObject("key").field("type", "string").field("store", "no").field("index_options", "offsets").field("analyzer", "whitespace").endObject()
.startObject("key").field("type", "string").field("store", false).field("index_options", "offsets").field("analyzer", "whitespace").endObject()
.endObject().endObject()
.endObject().endObject().endObject()));
ensureGreen();
@ -2287,7 +2287,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
public void testPostingsHighlighterShouldFailIfNoOffsets() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type1", jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("title").field("type", "string").field("store", "yes").field("index_options", "docs").endObject()
.startObject("title").field("type", "string").field("store", true).field("index_options", "docs").endObject()
.endObject().endObject().endObject()));
ensureGreen();

View File

@ -760,7 +760,7 @@ public class InnerHitsIT extends ESIntegTestCase {
.startObject("comments")
.field("type", "nested")
.startObject("properties")
.startObject("message").field("type", "string").field("store", "yes").endObject()
.startObject("message").field("type", "string").field("store", true).endObject()
.endObject()
.endObject()
.endObject()
@ -798,7 +798,7 @@ public class InnerHitsIT extends ESIntegTestCase {
.startObject("comments")
.field("type", "nested")
.startObject("properties")
.startObject("message").field("type", "string").field("store", "yes").endObject()
.startObject("message").field("type", "string").field("store", true).endObject()
.endObject()
.endObject()
.endObject()
@ -836,7 +836,7 @@ public class InnerHitsIT extends ESIntegTestCase {
.startObject("comments")
.field("type", "nested")
.startObject("properties")
.startObject("message").field("type", "string").field("store", "yes").endObject()
.startObject("message").field("type", "string").field("store", true).endObject()
.endObject()
.endObject()
.endObject()
@ -875,7 +875,7 @@ public class InnerHitsIT extends ESIntegTestCase {
.startObject("comments")
.field("type", "nested")
.startObject("properties")
.startObject("message").field("type", "string").field("store", "yes").endObject()
.startObject("message").field("type", "string").field("store", true).endObject()
.endObject()
.endObject()
.endObject()

View File

@ -337,7 +337,7 @@ public class SimpleNestedIT extends ESIntegTestCase {
.startObject("properties")
.startObject("field1")
.field("type", "long")
.field("store", "yes")
.field("store", true)
.endObject()
.endObject()
.endObject()

View File

@ -11,7 +11,7 @@
"properties":{
"first":{
"type":"string",
"store":"yes",
"store":true,
"include_in_all":false
},
"last":{
@ -29,7 +29,7 @@
"properties":{
"location":{
"type":"string",
"store":"yes"
"store":true
}
}
},

View File

@ -11,7 +11,7 @@
"properties":{
"first":{
"type":"string",
"store":"yes",
"store":true,
"include_in_all":false
},
"last":{
@ -29,7 +29,7 @@
"properties":{
"location":{
"type":"string",
"store":"yes"
"store":true
}
}
},

View File

@ -11,7 +11,7 @@
"properties":{
"first":{
"type":"string",
"store":"yes",
"store":true,
"include_in_all":false
},
"last":{
@ -29,7 +29,7 @@
"properties":{
"location":{
"type":"string",
"store":"yes"
"store":true
}
}
},

View File

@ -11,7 +11,7 @@
"properties":{
"first":{
"type":"string",
"store":"yes",
"store":true,
"include_in_all":false
},
"last":{
@ -28,7 +28,7 @@
"properties":{
"location":{
"type":"string",
"store":"yes"
"store":true
}
}
},

View File

@ -10,7 +10,7 @@
"properties":{
"first":{
"type":"string",
"store":"yes",
"store":true,
"include_in_all":false
},
"last":{
@ -27,7 +27,7 @@
"properties":{
"location":{
"type":"string",
"store":"yes"
"store":true
}
}
},

View File

@ -2,7 +2,7 @@
"person":{
"_all":{
"enabled":true,
"store":"yes"
"store":true
},
"properties":{
"name":{
@ -11,7 +11,7 @@
"properties":{
"first":{
"type":"string",
"store":"yes",
"store":true,
"include_in_all":false
},
"last":{
@ -29,7 +29,7 @@
"properties":{
"location":{
"type":"string",
"store":"yes"
"store":true
}
}
},

View File

@ -5,7 +5,7 @@
"template_1":{
"match":"*",
"mapping":{
"store":"yes"
"store":true
}
}
}

View File

@ -5,7 +5,7 @@
"template_1":{
"path_match":"obj1.obj2.*",
"mapping":{
"store":"no"
"store":false
}
}
},
@ -13,7 +13,7 @@
"template_2":{
"path_match":"obj1.*",
"mapping":{
"store":"yes"
"store":true
}
}
},

View File

@ -7,12 +7,12 @@
"mapping":{
"type":"{dynamic_type}",
"index":"analyzed",
"store":"yes",
"store":true,
"fields":{
"org":{
"type":"{dynamic_type}",
"index":"not_analyzed",
"store":"yes"
"store":true
}
}
}

View File

@ -4,7 +4,7 @@
"name":{
type:"string",
index:"analyzed",
store:"yes"
store:true
}
}
}

View File

@ -4,12 +4,12 @@
"name":{
"type" :"string",
"index" :"analyzed",
"store" :"yes",
"store" :true,
"fields":{
"name":{
"type" :"string",
"index" :"analyzed",
"store" :"yes"
"store" :true
},
"indexed":{
"type" :"string",
@ -18,7 +18,7 @@
"not_indexed":{
"type" :"string",
"index" :"no",
"store" :"yes"
"store" :true
}
}
}

View File

@ -4,12 +4,12 @@
"name" : {
"type" : "string",
"index" : "analyzed",
"store" : "yes",
"store" : true,
"fields": {
"name" : {
"type" : "string",
"index" : "analyzed",
"store" : "yes"
"store" : true
},
"indexed":{
type:"string",
@ -18,12 +18,12 @@
"not_indexed":{
type:"string",
index:"no",
store:"yes"
store:true
},
"not_indexed2":{
type:"string",
index:"no",
store:"yes"
store:true
}
}
}

View File

@ -4,12 +4,12 @@
"name":{
type:"string",
index:"analyzed",
store:"yes",
store:true,
"fields":{
"not_indexed3":{
type:"string",
index:"no",
store:"yes"
store:true
}
}
}

View File

@ -4,7 +4,7 @@
"name":{
type:"string",
index:"analyzed",
store:"yes",
store:true,
"fields":{
"indexed":{
type:"string",
@ -13,7 +13,7 @@
"not_indexed":{
type:"string",
index:"no",
store:"yes"
store:true
}
}
}

View File

@ -4,7 +4,7 @@
"name":{
type:"string",
index:"analyzed",
store:"yes",
store:true,
"fields":{
"indexed":{
type:"string",
@ -13,12 +13,12 @@
"not_indexed":{
type:"string",
index:"no",
store:"yes"
store:true
},
"not_indexed2":{
type:"string",
index:"no",
store:"yes"
store:true
}
}
}

View File

@ -8,7 +8,7 @@
"not_indexed3":{
type:"string",
index:"no",
store:"yes"
store:true
}
}
}

View File

@ -11,7 +11,7 @@
"not_indexed": {
"type": "string",
"index": "no",
"store": "yes"
"store": true
}
}
},
@ -23,7 +23,7 @@
},
"stored": {
"type": "long",
"store": "yes"
"store": true
}
}
}

View File

@ -4,22 +4,22 @@
"name": {
"type": "string",
"index": "analyzed",
"store": "yes",
"store": true,
"fields": {
"indexed": {
"type": "string",
"index": "analyzed",
"store": "no"
"store": false
},
"not_indexed": {
"type": "string",
"index": "no",
"store": "yes"
"store": true
},
"test1": {
"type": "string",
"index": "analyzed",
"store": "yes",
"store": true,
"fielddata": {
"loading": "eager"
}
@ -27,7 +27,7 @@
"test2": {
"type": "token_count",
"index": "not_analyzed",
"store": "yes",
"store": true,
"analyzer": "simple"
}
}

View File

@ -15,7 +15,7 @@
properties:{
first:{
type:"string",
store:"yes"
store:true
},
last:{
type:"string",
@ -30,7 +30,7 @@
properties:{
location:{
type:"string",
store:"yes"
store:true
}
}
},

View File

@ -87,9 +87,9 @@ public class SearchFieldsTests extends ESIntegTestCase {
// _timestamp is randomly enabled via templates but we don't want it here to test stored fields behaviour
.startObject("_timestamp").field("enabled", false).endObject()
.startObject("properties")
.startObject("field1").field("type", "string").field("store", "yes").endObject()
.startObject("field2").field("type", "string").field("store", "no").endObject()
.startObject("field3").field("type", "string").field("store", "yes").endObject()
.startObject("field1").field("type", "string").field("store", true).endObject()
.startObject("field2").field("type", "string").field("store", false).endObject()
.startObject("field3").field("type", "string").field("store", true).endObject()
.endObject().endObject().endObject().string();
client().admin().indices().preparePutMapping().setType("type1").setSource(mapping).execute().actionGet();
@ -171,7 +171,7 @@ public class SearchFieldsTests extends ESIntegTestCase {
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("properties")
.startObject("num1").field("type", "double").field("store", "yes").endObject()
.startObject("num1").field("type", "double").field("store", true).endObject()
.endObject().endObject().endObject().string();
client().admin().indices().preparePutMapping().setType("type1").setSource(mapping).execute().actionGet();
@ -391,15 +391,15 @@ public class SearchFieldsTests extends ESIntegTestCase {
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet();
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1").startObject("_source").field("enabled", false).endObject().startObject("properties")
.startObject("byte_field").field("type", "byte").field("store", "yes").endObject()
.startObject("short_field").field("type", "short").field("store", "yes").endObject()
.startObject("integer_field").field("type", "integer").field("store", "yes").endObject()
.startObject("long_field").field("type", "long").field("store", "yes").endObject()
.startObject("float_field").field("type", "float").field("store", "yes").endObject()
.startObject("double_field").field("type", "double").field("store", "yes").endObject()
.startObject("date_field").field("type", "date").field("store", "yes").endObject()
.startObject("boolean_field").field("type", "boolean").field("store", "yes").endObject()
.startObject("binary_field").field("type", "binary").field("store", "yes").endObject()
.startObject("byte_field").field("type", "byte").field("store", true).endObject()
.startObject("short_field").field("type", "short").field("store", true).endObject()
.startObject("integer_field").field("type", "integer").field("store", true).endObject()
.startObject("long_field").field("type", "long").field("store", true).endObject()
.startObject("float_field").field("type", "float").field("store", true).endObject()
.startObject("double_field").field("type", "double").field("store", true).endObject()
.startObject("date_field").field("type", "date").field("store", true).endObject()
.startObject("boolean_field").field("type", "boolean").field("store", true).endObject()
.startObject("binary_field").field("type", "binary").field("store", true).endObject()
.endObject().endObject().endObject().string();
client().admin().indices().preparePutMapping().setType("type1").setSource(mapping).execute().actionGet();
@ -487,7 +487,7 @@ public class SearchFieldsTests extends ESIntegTestCase {
.startObject("field1").field("type", "object").startObject("properties")
.startObject("field2").field("type", "object").startObject("properties")
.startObject("field3").field("type", "object").startObject("properties")
.startObject("field4").field("type", "string").field("store", "yes")
.startObject("field4").field("type", "string").field("store", true)
.endObject().endObject()
.endObject().endObject()
.endObject().endObject()

View File

@ -193,7 +193,7 @@ public class SimpleSortTests extends ESIntegTestCase {
public void testIssue6639() throws ExecutionException, InterruptedException {
assertAcked(prepareCreate("$index")
.addMapping("$type","{\"$type\": {\"properties\": {\"grantee\": {\"index\": \"not_analyzed\", \"term_vector\": \"with_positions_offsets\", \"type\": \"string\", \"analyzer\": \"snowball\", \"boost\": 1.0, \"store\": \"yes\"}}}}"));
.addMapping("$type","{\"$type\": {\"properties\": {\"grantee\": {\"index\": \"not_analyzed\", \"term_vector\": \"with_positions_offsets\", \"type\": \"string\", \"analyzer\": \"snowball\", \"boost\": 1.0, \"store\": true}}}}"));
indexRandom(true,
client().prepareIndex("$index", "$type", "data.activity.5").setSource("{\"django_ct\": \"data.activity\", \"grantee\": \"Grantee 1\"}"),
client().prepareIndex("$index", "$type", "data.activity.6").setSource("{\"django_ct\": \"data.activity\", \"grantee\": \"Grantee 2\"}"));

View File

@ -456,7 +456,7 @@ public class SuggestSearchTests extends ESIntegTestCase {
.put("index.analysis.filter.my_shingle.min_shingle_size", 2)
.put("index.analysis.filter.my_shingle.max_shingle_size", 2));
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("_all").field("store", "yes").field("termVector", "with_positions_offsets").endObject()
.startObject("_all").field("store", true).field("termVector", "with_positions_offsets").endObject()
.startObject("properties")
.startObject("body").field("type", "string").field("analyzer", "body").endObject()
.startObject("body_reverse").field("type", "string").field("analyzer", "reverse").endObject()
@ -500,7 +500,7 @@ public class SuggestSearchTests extends ESIntegTestCase {
.put("index.analysis.filter.my_shingle.max_shingle_size", 2));
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("_all")
.field("store", "yes")
.field("store", true)
.field("termVector", "with_positions_offsets")
.endObject()
.startObject("properties")
@ -635,7 +635,7 @@ public class SuggestSearchTests extends ESIntegTestCase {
.startObject()
.startObject("type1")
.startObject("_all")
.field("store", "yes")
.field("store", true)
.field("termVector", "with_positions_offsets")
.endObject()
.startObject("properties")
@ -705,7 +705,7 @@ public class SuggestSearchTests extends ESIntegTestCase {
XContentBuilder mapping = XContentFactory.jsonBuilder()
.startObject().startObject("type1")
.startObject("_all").field("store", "yes").field("termVector", "with_positions_offsets").endObject()
.startObject("_all").field("store", true).field("termVector", "with_positions_offsets").endObject()
.startObject("properties")
.startObject("body").field("type", "string").field("analyzer", "body").endObject()
.startObject("bigram").field("type", "string").field("analyzer", "bigram").endObject()
@ -898,7 +898,7 @@ public class SuggestSearchTests extends ESIntegTestCase {
.startObject()
.startObject("type1")
.startObject("_all")
.field("store", "yes")
.field("store", true)
.field("termVector", "with_positions_offsets")
.endObject()
.startObject("properties")

View File

@ -4,14 +4,14 @@
"file":{
"type":"attachment",
"fields" : {
"content" : {"store" : "yes"},
"title" : {"store" : "yes"},
"date" : {"store" : "yes"},
"content" : {"store" : true},
"title" : {"store" : true},
"date" : {"store" : true},
"author" : {"analyzer" : "standard"},
"keywords" : {"store" : "yes"},
"content_type" : {"store" : "yes"},
"content_length" : {"store" : "yes"},
"language" : {"store" : "yes"}
"keywords" : {"store" : true},
"content_type" : {"store" : true},
"content_length" : {"store" : true},
"language" : {"store" : true}
}
}
}

View File

@ -29,9 +29,9 @@
"type": "attachment"
"fields":
"content_type":
"store": "yes"
"store": true
"name":
"store": "yes"
"store": true
- do:
cluster.health:
wait_for_status: yellow

View File

@ -14,7 +14,7 @@ setup:
"fields":
"content" :
"type": "string"
"store" : "yes"
"store" : true
"term_vector": "with_positions_offsets"
- do:

View File

@ -38,7 +38,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeBooleanValue;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseStore;
public class SizeFieldMapper extends MetadataFieldMapper {
@ -92,10 +92,10 @@ public class SizeFieldMapper extends MetadataFieldMapper {
String fieldName = Strings.toUnderscoreCase(entry.getKey());
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
builder.enabled(nodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED);
builder.enabled(lenientNodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED);
iterator.remove();
} else if (fieldName.equals("store") && parserContext.indexVersionCreated().before(Version.V_2_0_0_beta1)) {
builder.store(parseStore(fieldName, fieldNode.toString()));
builder.store(parseStore(fieldName, fieldNode.toString(), parserContext));
iterator.remove();
}
}