From 35709f62b65cde39f8ba420559d091e247a6adce Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Thu, 21 Jan 2016 14:22:20 +0100 Subject: [PATCH] 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. --- .../create/CreateSnapshotRequest.java | 6 +- .../restore/RestoreSnapshotRequest.java | 8 +- .../action/support/IndicesOptions.java | 6 +- .../cluster/metadata/MappingMetaData.java | 8 +- .../xcontent/support/XContentMapValues.java | 23 +++++- .../index/mapper/core/BooleanFieldMapper.java | 4 +- .../index/mapper/core/TypeParsers.java | 51 ++++++++----- .../mapper/geo/BaseGeoPointFieldMapper.java | 10 +-- .../mapper/geo/GeoPointFieldMapperLegacy.java | 2 +- .../index/mapper/geo/GeoShapeFieldMapper.java | 6 +- .../index/mapper/internal/AllFieldMapper.java | 6 +- .../internal/FieldNamesFieldMapper.java | 4 +- .../mapper/internal/RoutingFieldMapper.java | 4 +- .../mapper/internal/SourceFieldMapper.java | 4 +- .../index/mapper/internal/TTLFieldMapper.java | 4 +- .../mapper/internal/TimestampFieldMapper.java | 6 +- .../index/mapper/object/ObjectMapper.java | 12 +-- .../index/mapper/object/RootObjectMapper.java | 6 +- .../action/search/RestMultiSearchAction.java | 4 +- .../action/termvectors/GetTermVectorsIT.java | 2 +- .../cluster/SimpleClusterStateIT.java | 4 +- .../org/elasticsearch/get/GetActionIT.java | 6 +- .../index/mapper/DynamicMappingTests.java | 2 +- .../mapper/binary/BinaryMappingTests.java | 2 +- .../ExternalValuesMapperIntegrationIT.java | 4 +- .../SimpleExternalMappingTests.java | 4 +- .../mapper/geo/GeoPointFieldMapperTests.java | 12 +-- .../lucene/StoredNumericValuesTests.java | 6 +- .../mapping/ConcurrentDynamicTemplateIT.java | 2 +- .../template/IndexTemplateBlocksIT.java | 4 +- .../template/SimpleIndexTemplateIT.java | 32 ++++---- .../search/highlight/HighlighterSearchIT.java | 74 +++++++++---------- .../search/innerhits/InnerHitsIT.java | 8 +- .../search/nested/SimpleNestedIT.java | 2 +- .../index/mapper/all/mapping.json | 4 +- .../mapping_boost_omit_positions_on_all.json | 4 +- .../mapper/all/mapping_offsets_on_all.json | 4 +- .../all/mapping_omit_positions_on_all.json | 4 +- .../index/mapper/all/noboost-mapping.json | 4 +- .../index/mapper/all/store-mapping.json | 6 +- .../genericstore/test-mapping.json | 2 +- .../pathmatch/test-mapping.json | 6 +- .../dynamictemplate/simple/test-mapping.json | 4 +- .../multifield/merge/test-mapping1.json | 2 +- .../multifield/merge/test-mapping2.json | 6 +- .../multifield/merge/test-mapping3.json | 8 +- .../multifield/merge/test-mapping4.json | 4 +- .../mapper/multifield/merge/upgrade1.json | 4 +- .../mapper/multifield/merge/upgrade2.json | 6 +- .../mapper/multifield/merge/upgrade3.json | 2 +- ...est-multi-field-type-no-default-field.json | 4 +- .../mapper/multifield/test-multi-fields.json | 12 +-- .../index/mapper/simple/test-mapping.json | 4 +- .../messy/tests/SearchFieldsTests.java | 28 +++---- .../messy/tests/SimpleSortTests.java | 2 +- .../messy/tests/SuggestSearchTests.java | 10 +-- .../unit/simple/test-mapping-all-fields.json | 14 ++-- .../test/mapper_attachments/30_mapping.yaml | 4 +- .../test/mapper_attachments/40_highlight.yaml | 2 +- .../index/mapper/size/SizeFieldMapper.java | 6 +- 60 files changed, 262 insertions(+), 232 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java index 41d3f9c3593..13c706531b7 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotRequest.java @@ -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) entry.getValue()); } else if (name.equals("include_global_state")) { - includeGlobalState = nodeBooleanValue(entry.getValue()); + includeGlobalState = lenientNodeBooleanValue(entry.getValue()); } } indicesOptions(IndicesOptions.fromMap((Map) source, IndicesOptions.lenientExpandOpen())); diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java index 0f79ceb0f96..59dad56531e 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotRequest.java @@ -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) 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()); diff --git a/core/src/main/java/org/elasticsearch/action/support/IndicesOptions.java b/core/src/main/java/org/elasticsearch/action/support/IndicesOptions.java index 793dbe08401..2bc49f7e9f8 100644 --- a/core/src/main/java/org/elasticsearch/action/support/IndicesOptions.java +++ b/core/src/main/java/org/elasticsearch/action/support/IndicesOptions.java @@ -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(), diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java b/core/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java index a26e95c40e0..a88f1609b9e 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java @@ -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 { 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 { 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); diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java b/core/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java index 73f16b2e789..4612d3f05d0 100644 --- a/core/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java +++ b/core/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java @@ -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; diff --git a/core/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java index 482ff694f7c..29d2ce2176f 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java @@ -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(); diff --git a/core/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java b/core/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java index d7f3570a53c..e3df1f7dbf1 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/core/TypeParsers.java @@ -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 numberNode, Mapper.TypeParser.ParserContext parserContext) { parseField(builder, name, numberNode, parserContext); for (Iterator> 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 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); + } } } diff --git a/core/src/main/java/org/elasticsearch/index/mapper/geo/BaseGeoPointFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/geo/BaseGeoPointFieldMapper.java index 29a2aca7bec..0a992aeb27a 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/geo/BaseGeoPointFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/geo/BaseGeoPointFieldMapper.java @@ -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(); diff --git a/core/src/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperLegacy.java b/core/src/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperLegacy.java index c008be6f673..dcd57a42dc5 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperLegacy.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperLegacy.java @@ -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(); } } diff --git a/core/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java index 0de2cd2b60b..c98744bb759 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java @@ -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(); } } diff --git a/core/src/main/java/org/elasticsearch/index/mapper/internal/AllFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/internal/AllFieldMapper.java index d9a345caf28..97c2fa3933b 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/internal/AllFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/internal/AllFieldMapper.java @@ -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(); } } diff --git a/core/src/main/java/org/elasticsearch/index/mapper/internal/FieldNamesFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/internal/FieldNamesFieldMapper.java index 17d1c2b9f08..03ebcb9fe95 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/internal/FieldNamesFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/internal/FieldNamesFieldMapper.java @@ -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 _field_names. 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(); } } diff --git a/core/src/main/java/org/elasticsearch/index/mapper/internal/RoutingFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/internal/RoutingFieldMapper.java index ee06b51ecfc..b1d24e53ab5 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/internal/RoutingFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/internal/RoutingFieldMapper.java @@ -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(); } } diff --git a/core/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java index b0de09edafb..1925b2b2faa 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java @@ -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 diff --git a/core/src/main/java/org/elasticsearch/index/mapper/internal/TTLFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/internal/TTLFieldMapper.java index 4612b9fb85f..dbf63a7f801 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/internal/TTLFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/internal/TTLFieldMapper.java @@ -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")) { diff --git a/core/src/main/java/org/elasticsearch/index/mapper/internal/TimestampFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/internal/TimestampFieldMapper.java index e750f973add..570155a79c5 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/internal/TimestampFieldMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/internal/TimestampFieldMapper.java @@ -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(); } diff --git a/core/src/main/java/org/elasticsearch/index/mapper/object/ObjectMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/object/ObjectMapper.java index 9f3b503ab49..b5934a40116 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/object/ObjectMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/object/ObjectMapper.java @@ -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) { diff --git a/core/src/main/java/org/elasticsearch/index/mapper/object/RootObjectMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/object/RootObjectMapper.java index 64a60305b10..5e87130865c 100644 --- a/core/src/main/java/org/elasticsearch/index/mapper/object/RootObjectMapper.java +++ b/core/src/main/java/org/elasticsearch/index/mapper/object/RootObjectMapper.java @@ -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; diff --git a/core/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/core/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index ff51263e08b..72ff389fa08 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -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())) { diff --git a/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java b/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java index 0c542698b5f..16fd9f4b718 100644 --- a/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java +++ b/core/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java @@ -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 diff --git a/core/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java b/core/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java index d78356cbf64..e838989e2ac 100644 --- a/core/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java @@ -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(); diff --git a/core/src/test/java/org/elasticsearch/get/GetActionIT.java b/core/src/test/java/org/elasticsearch/get/GetActionIT.java index dee48c5f288..43a4e4f1470 100644 --- a/core/src/test/java/org/elasticsearch/get/GetActionIT.java +++ b/core/src/test/java/org/elasticsearch/get/GetActionIT.java @@ -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() diff --git a/core/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java index 1a4fb0d9c4c..6de49877ce1 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/DynamicMappingTests.java @@ -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", diff --git a/core/src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java index 308478ad49d..7be0cc8031b 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/binary/BinaryMappingTests.java @@ -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(); diff --git a/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalValuesMapperIntegrationIT.java b/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalValuesMapperIntegrationIT.java index 7e519c3b722..f581f1f6a41 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalValuesMapperIntegrationIT.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/ExternalValuesMapperIntegrationIT.java @@ -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() diff --git a/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/SimpleExternalMappingTests.java b/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/SimpleExternalMappingTests.java index c42924132ff..96c099df6d3 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/SimpleExternalMappingTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/externalvalues/SimpleExternalMappingTests.java @@ -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() diff --git a/core/src/test/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java b/core/src/test/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java index 2ea19b02450..db5781a77eb 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapperTests.java @@ -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(); diff --git a/core/src/test/java/org/elasticsearch/index/mapper/lucene/StoredNumericValuesTests.java b/core/src/test/java/org/elasticsearch/index/mapper/lucene/StoredNumericValuesTests.java index 89e6630ffa2..d74b445ebbd 100644 --- a/core/src/test/java/org/elasticsearch/index/mapper/lucene/StoredNumericValuesTests.java +++ b/core/src/test/java/org/elasticsearch/index/mapper/lucene/StoredNumericValuesTests.java @@ -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() diff --git a/core/src/test/java/org/elasticsearch/indices/mapping/ConcurrentDynamicTemplateIT.java b/core/src/test/java/org/elasticsearch/indices/mapping/ConcurrentDynamicTemplateIT.java index 0946d51a45c..feb9863ec1e 100644 --- a/core/src/test/java/org/elasticsearch/indices/mapping/ConcurrentDynamicTemplateIT.java +++ b/core/src/test/java/org/elasticsearch/indices/mapping/ConcurrentDynamicTemplateIT.java @@ -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 diff --git a/core/src/test/java/org/elasticsearch/indices/template/IndexTemplateBlocksIT.java b/core/src/test/java/org/elasticsearch/indices/template/IndexTemplateBlocksIT.java index c46c0385292..11e2d7d2ac4 100644 --- a/core/src/test/java/org/elasticsearch/indices/template/IndexTemplateBlocksIT.java +++ b/core/src/test/java/org/elasticsearch/indices/template/IndexTemplateBlocksIT.java @@ -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(); diff --git a/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java b/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java index 0a51f5d4e2c..63db0450551 100644 --- a/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java +++ b/core/src/test/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java @@ -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(); diff --git a/core/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchIT.java b/core/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchIT.java index 10c7c54b83b..fc7a779b407 100644 --- a/core/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/highlight/HighlighterSearchIT.java @@ -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(); diff --git a/core/src/test/java/org/elasticsearch/search/innerhits/InnerHitsIT.java b/core/src/test/java/org/elasticsearch/search/innerhits/InnerHitsIT.java index 1e71b868236..76b7a0a0e3e 100644 --- a/core/src/test/java/org/elasticsearch/search/innerhits/InnerHitsIT.java +++ b/core/src/test/java/org/elasticsearch/search/innerhits/InnerHitsIT.java @@ -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() diff --git a/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java b/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java index fd9ee9a3f10..23eafdb0b01 100644 --- a/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java +++ b/core/src/test/java/org/elasticsearch/search/nested/SimpleNestedIT.java @@ -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() diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping.json b/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping.json index f956b84f957..eb9b7833c68 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping.json @@ -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 } } }, diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_boost_omit_positions_on_all.json b/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_boost_omit_positions_on_all.json index 452ef9f083b..42bba4354c6 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_boost_omit_positions_on_all.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_boost_omit_positions_on_all.json @@ -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 } } }, diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_offsets_on_all.json b/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_offsets_on_all.json index f6b0699beee..388ac13e9e6 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_offsets_on_all.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_offsets_on_all.json @@ -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 } } }, diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_omit_positions_on_all.json b/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_omit_positions_on_all.json index f8e418ce8ed..57aad9e8fab 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_omit_positions_on_all.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/all/mapping_omit_positions_on_all.json @@ -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 } } }, diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/all/noboost-mapping.json b/core/src/test/resources/org/elasticsearch/index/mapper/all/noboost-mapping.json index 799a3ab460a..9b1119f1a2e 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/all/noboost-mapping.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/all/noboost-mapping.json @@ -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 } } }, diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/all/store-mapping.json b/core/src/test/resources/org/elasticsearch/index/mapper/all/store-mapping.json index 8f653a34845..66fed5928ad 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/all/store-mapping.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/all/store-mapping.json @@ -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 } } }, diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/genericstore/test-mapping.json b/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/genericstore/test-mapping.json index d99067c2b52..70bf6dc7b5d 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/genericstore/test-mapping.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/genericstore/test-mapping.json @@ -5,7 +5,7 @@ "template_1":{ "match":"*", "mapping":{ - "store":"yes" + "store":true } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/pathmatch/test-mapping.json b/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/pathmatch/test-mapping.json index dce33dadfcc..3c273e6ed9e 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/pathmatch/test-mapping.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/pathmatch/test-mapping.json @@ -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 } } }, @@ -27,4 +27,4 @@ } ] } -} \ No newline at end of file +} diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json b/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json index 9c8f8d8e6a3..7a7e96d12a3 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/dynamictemplate/simple/test-mapping.json @@ -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 } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping1.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping1.json index 61f08af57e2..0c2f9ab3f81 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping1.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping1.json @@ -4,7 +4,7 @@ "name":{ type:"string", index:"analyzed", - store:"yes" + store:true } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping2.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping2.json index 02ce8957a51..37064a038b1 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping2.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping2.json @@ -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 } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping3.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping3.json index ea076754467..564d4b5ac05 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping3.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping3.json @@ -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 } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping4.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping4.json index 384c2634cb2..7d2fea2d2f5 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping4.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/test-mapping4.json @@ -4,12 +4,12 @@ "name":{ type:"string", index:"analyzed", - store:"yes", + store:true, "fields":{ "not_indexed3":{ type:"string", index:"no", - store:"yes" + store:true } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade1.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade1.json index 595f62210dd..8224cd69cf8 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade1.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade1.json @@ -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 } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade2.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade2.json index 3cfca9c313e..42315cc8e3e 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade2.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade2.json @@ -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 } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade3.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade3.json index 046b0c234d4..4d429475261 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade3.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/merge/upgrade3.json @@ -8,7 +8,7 @@ "not_indexed3":{ type:"string", index:"no", - store:"yes" + store:true } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/test-multi-field-type-no-default-field.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/test-multi-field-type-no-default-field.json index 99b74c01670..19d7e45ad48 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/test-multi-field-type-no-default-field.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/test-multi-field-type-no-default-field.json @@ -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 } } } diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/test-multi-fields.json b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/test-multi-fields.json index b1166658296..c69f4aed0e8 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/multifield/test-multi-fields.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/multifield/test-multi-fields.json @@ -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" } } @@ -47,4 +47,4 @@ } } } -} \ No newline at end of file +} diff --git a/core/src/test/resources/org/elasticsearch/index/mapper/simple/test-mapping.json b/core/src/test/resources/org/elasticsearch/index/mapper/simple/test-mapping.json index e001673758a..a37946bf2e6 100644 --- a/core/src/test/resources/org/elasticsearch/index/mapper/simple/test-mapping.json +++ b/core/src/test/resources/org/elasticsearch/index/mapper/simple/test-mapping.json @@ -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 } } }, diff --git a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SearchFieldsTests.java b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SearchFieldsTests.java index b78c1c264c3..217aa2f1a8f 100644 --- a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SearchFieldsTests.java +++ b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SearchFieldsTests.java @@ -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() diff --git a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SimpleSortTests.java b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SimpleSortTests.java index ad8b1e68230..309da10d680 100644 --- a/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SimpleSortTests.java +++ b/modules/lang-groovy/src/test/java/org/elasticsearch/messy/tests/SimpleSortTests.java @@ -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\"}")); diff --git a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/SuggestSearchTests.java b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/SuggestSearchTests.java index 92bf7d03484..4fd83f9a850 100644 --- a/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/SuggestSearchTests.java +++ b/modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/SuggestSearchTests.java @@ -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") diff --git a/plugins/mapper-attachments/src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping-all-fields.json b/plugins/mapper-attachments/src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping-all-fields.json index ea83b98ceec..feaa3a54555 100644 --- a/plugins/mapper-attachments/src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping-all-fields.json +++ b/plugins/mapper-attachments/src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping-all-fields.json @@ -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} } } } diff --git a/plugins/mapper-attachments/src/test/resources/rest-api-spec/test/mapper_attachments/30_mapping.yaml b/plugins/mapper-attachments/src/test/resources/rest-api-spec/test/mapper_attachments/30_mapping.yaml index 170a8bf7382..458990cc90c 100644 --- a/plugins/mapper-attachments/src/test/resources/rest-api-spec/test/mapper_attachments/30_mapping.yaml +++ b/plugins/mapper-attachments/src/test/resources/rest-api-spec/test/mapper_attachments/30_mapping.yaml @@ -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 diff --git a/plugins/mapper-attachments/src/test/resources/rest-api-spec/test/mapper_attachments/40_highlight.yaml b/plugins/mapper-attachments/src/test/resources/rest-api-spec/test/mapper_attachments/40_highlight.yaml index 286dae8b976..a4eec42752d 100644 --- a/plugins/mapper-attachments/src/test/resources/rest-api-spec/test/mapper_attachments/40_highlight.yaml +++ b/plugins/mapper-attachments/src/test/resources/rest-api-spec/test/mapper_attachments/40_highlight.yaml @@ -14,7 +14,7 @@ setup: "fields": "content" : "type": "string" - "store" : "yes" + "store" : true "term_vector": "with_positions_offsets" - do: diff --git a/plugins/mapper-size/src/main/java/org/elasticsearch/index/mapper/size/SizeFieldMapper.java b/plugins/mapper-size/src/main/java/org/elasticsearch/index/mapper/size/SizeFieldMapper.java index baeba9f4bbd..6cd54eeaac0 100644 --- a/plugins/mapper-size/src/main/java/org/elasticsearch/index/mapper/size/SizeFieldMapper.java +++ b/plugins/mapper-size/src/main/java/org/elasticsearch/index/mapper/size/SizeFieldMapper.java @@ -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(); } }