n
String fieldName = entry.getKey();
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
- builder.enabled(lenientNodeBooleanValue(fieldNode));
+ builder.enabled(TypeParsers.nodeBooleanValue(name, "enabled", fieldNode));
iterator.remove();
}
}
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/GeoShapeFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/GeoShapeFieldMapper.java
index f1a73308692f5..355c515bdd0e2 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/GeoShapeFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/GeoShapeFieldMapper.java
@@ -41,7 +41,6 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.DistanceUnit;
import org.elasticsearch.common.xcontent.XContentBuilder;
-import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.index.query.QueryShardException;
import org.locationtech.spatial4j.shape.Point;
@@ -54,9 +53,6 @@
import java.util.Map;
import java.util.Objects;
-import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
-
-
/**
* FieldMapper for indexing {@link org.locationtech.spatial4j.shape.Shape}s.
*
@@ -185,11 +181,12 @@ public Mapper.Builder parse(String name, Map node, ParserContext
builder.fieldType().setStrategyName(fieldNode.toString());
iterator.remove();
} else if (Names.COERCE.equals(fieldName)) {
- builder.coerce(lenientNodeBooleanValue(fieldNode));
+ builder.coerce(TypeParsers.nodeBooleanValue(fieldName, Names.COERCE, fieldNode));
iterator.remove();
} else if (Names.STRATEGY_POINTS_ONLY.equals(fieldName)
&& builder.fieldType().strategyName.equals(SpatialStrategy.TERM.getStrategyName()) == false) {
- builder.fieldType().setPointsOnly(XContentMapValues.lenientNodeBooleanValue(fieldNode));
+ boolean pointsOnly = TypeParsers.nodeBooleanValue(fieldName, Names.STRATEGY_POINTS_ONLY, fieldNode);
+ builder.fieldType().setPointsOnly(pointsOnly);
iterator.remove();
}
}
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java
index ee2f707fb3a35..ca739d8e03702 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java
@@ -115,7 +115,7 @@ public Mapper.Builder,?> parse(String name, Map node, ParserCo
builder.nullValue(InetAddresses.forString(propNode.toString()));
iterator.remove();
} else if (propName.equals("ignore_malformed")) {
- builder.ignoreMalformed(TypeParsers.nodeBooleanValue("ignore_malformed", propNode, parserContext));
+ builder.ignoreMalformed(TypeParsers.nodeBooleanValue(name, "ignore_malformed", propNode));
iterator.remove();
} else if (TypeParsers.parseMultiField(builder, name, parserContext, propName, propNode)) {
iterator.remove();
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/LegacyGeoPointFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/LegacyGeoPointFieldMapper.java
index fc46a08ce1ae8..619a0a824ef18 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/LegacyGeoPointFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/LegacyGeoPointFieldMapper.java
@@ -123,7 +123,7 @@ public static Builder parse(Builder builder, Map node, Mapper.Ty
String propName = entry.getKey();
Object propNode = entry.getValue();
if (propName.equals(Names.COERCE)) {
- builder.coerce = XContentMapValues.lenientNodeBooleanValue(propNode);
+ builder.coerce = XContentMapValues.lenientNodeBooleanValue(propNode, propName);
iterator.remove();
}
}
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/NumberFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/NumberFieldMapper.java
index 4cb31739232fc..99fd53a4f7000 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/NumberFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/NumberFieldMapper.java
@@ -165,10 +165,10 @@ public Mapper.Builder,?> parse(String name, Map node,
builder.nullValue(type.parse(propNode, false));
iterator.remove();
} else if (propName.equals("ignore_malformed")) {
- builder.ignoreMalformed(TypeParsers.nodeBooleanValue("ignore_malformed", propNode, parserContext));
+ builder.ignoreMalformed(TypeParsers.nodeBooleanValue(name,"ignore_malformed", propNode));
iterator.remove();
} else if (propName.equals("coerce")) {
- builder.coerce(TypeParsers.nodeBooleanValue("coerce", propNode, parserContext));
+ builder.coerce(TypeParsers.nodeBooleanValue(name, "coerce", propNode));
iterator.remove();
}
}
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java
index e843e7170d8a3..b1ae69992c7ee 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java
@@ -42,11 +42,6 @@
import java.util.Locale;
import java.util.Map;
-import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
-
-/**
- *
- */
public class ObjectMapper extends Mapper implements Cloneable {
public static final String CONTENT_TYPE = "object";
@@ -188,11 +183,12 @@ protected static boolean parseObjectOrDocumentTypeProperties(String fieldName, O
if (value.equalsIgnoreCase("strict")) {
builder.dynamic(Dynamic.STRICT);
} else {
- builder.dynamic(lenientNodeBooleanValue(fieldNode) ? Dynamic.TRUE : Dynamic.FALSE);
+ boolean dynamic = TypeParsers.nodeBooleanValue(fieldName, "dynamic", fieldNode);
+ builder.dynamic(dynamic ? Dynamic.TRUE : Dynamic.FALSE);
}
return true;
} else if (fieldName.equals("enabled")) {
- builder.enabled(lenientNodeBooleanValue(fieldNode));
+ builder.enabled(TypeParsers.nodeBooleanValue(fieldName, "enabled", fieldNode));
return true;
} else if (fieldName.equals("properties")) {
if (fieldNode instanceof Collection && ((Collection) fieldNode).isEmpty()) {
@@ -204,7 +200,7 @@ protected static boolean parseObjectOrDocumentTypeProperties(String fieldName, O
}
return true;
} else if (fieldName.equals("include_in_all")) {
- builder.includeInAll(lenientNodeBooleanValue(fieldNode));
+ builder.includeInAll(TypeParsers.nodeBooleanValue(fieldName, "include_in_all", fieldNode));
return true;
}
return false;
@@ -227,12 +223,12 @@ protected static void parseNested(String name, Map node, ObjectM
}
fieldNode = node.get("include_in_parent");
if (fieldNode != null) {
- nestedIncludeInParent = lenientNodeBooleanValue(fieldNode);
+ nestedIncludeInParent = TypeParsers.nodeBooleanValue(name, "include_in_parent", fieldNode);
node.remove("include_in_parent");
}
fieldNode = node.get("include_in_root");
if (fieldNode != null) {
- nestedIncludeInRoot = lenientNodeBooleanValue(fieldNode);
+ nestedIncludeInRoot = TypeParsers.nodeBooleanValue(name, "include_in_root", fieldNode);
node.remove("include_in_root");
}
if (nested) {
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java
index b0a809c12dfce..f7425f377558e 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/RangeFieldMapper.java
@@ -166,7 +166,7 @@ public Mapper.Builder,?> parse(String name, Map node,
throw new MapperParsingException("Property [null_value] is not supported for [" + this.type.name
+ "] field types.");
} else if (propName.equals("coerce")) {
- builder.coerce(TypeParsers.nodeBooleanValue("coerce", propNode, parserContext));
+ builder.coerce(TypeParsers.nodeBooleanValue(name, "coerce", propNode));
iterator.remove();
} else if (propName.equals("locale")) {
builder.locale(LocaleUtils.parse(propNode.toString()));
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/RoutingFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/RoutingFieldMapper.java
index a69f141ecad8b..759781d55754d 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/RoutingFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/RoutingFieldMapper.java
@@ -32,11 +32,6 @@
import java.util.List;
import java.util.Map;
-import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
-
-/**
- *
- */
public class RoutingFieldMapper extends MetadataFieldMapper {
public static final String NAME = "_routing";
@@ -89,7 +84,7 @@ public MetadataFieldMapper.Builder,?> parse(String name, Map n
String fieldName = entry.getKey();
Object fieldNode = entry.getValue();
if (fieldName.equals("required")) {
- builder.required(lenientNodeBooleanValue(fieldNode));
+ builder.required(TypeParsers.nodeBooleanValue(name, "required", fieldNode));
iterator.remove();
}
}
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/ScaledFloatFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/ScaledFloatFieldMapper.java
index 0f7a89058343a..400f16bed1597 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/ScaledFloatFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/ScaledFloatFieldMapper.java
@@ -147,10 +147,10 @@ public Mapper.Builder,?> parse(String name, Map node,
builder.nullValue(NumberFieldMapper.NumberType.DOUBLE.parse(propNode, false));
iterator.remove();
} else if (propName.equals("ignore_malformed")) {
- builder.ignoreMalformed(TypeParsers.nodeBooleanValue("ignore_malformed", propNode, parserContext));
+ builder.ignoreMalformed(TypeParsers.nodeBooleanValue(name, "ignore_malformed", propNode));
iterator.remove();
} else if (propName.equals("coerce")) {
- builder.coerce(TypeParsers.nodeBooleanValue("coerce", propNode, parserContext));
+ builder.coerce(TypeParsers.nodeBooleanValue(name, "coerce", propNode));
iterator.remove();
} else if (propName.equals("scaling_factor")) {
builder.scalingFactor(NumberFieldMapper.NumberType.DOUBLE.parse(propNode, false).doubleValue());
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java
index be6416c89b767..ae839b19d799f 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java
@@ -47,11 +47,6 @@
import java.util.Map;
import java.util.function.Function;
-import static org.elasticsearch.common.xcontent.support.XContentMapValues.lenientNodeBooleanValue;
-
-/**
- *
- */
public class SourceFieldMapper extends MetadataFieldMapper {
public static final String NAME = "_source";
@@ -119,7 +114,7 @@ public MetadataFieldMapper.Builder,?> parse(String name, Map n
String fieldName = entry.getKey();
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
- builder.enabled(lenientNodeBooleanValue(fieldNode));
+ builder.enabled(TypeParsers.nodeBooleanValue(name, "enabled", fieldNode));
iterator.remove();
} else if ("format".equals(fieldName) && parserContext.indexVersionCreated().before(Version.V_5_0_0_alpha1)) {
// ignore on old indices, reject on and after 5.0
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/StringFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/StringFieldMapper.java
index 69dd337fddd7b..acb3a5d9805ed 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/StringFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/StringFieldMapper.java
@@ -229,11 +229,11 @@ public Mapper.Builder parse(String fieldName, Map node, ParserCo
norms = ((Map,?>) norms).get("enabled");
}
if (norms != null) {
- node.put("norms", TypeParsers.nodeBooleanValue("norms", norms, parserContext));
+ node.put("norms", TypeParsers.nodeBooleanValue(fieldName,"norms", norms));
}
Object omitNorms = node.remove("omit_norms");
if (omitNorms != null) {
- node.put("norms", TypeParsers.nodeBooleanValue("omit_norms", omitNorms, parserContext) == false);
+ node.put("norms", TypeParsers.nodeBooleanValue(fieldName, "omit_norms", omitNorms) == false);
}
}
{
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/TTLFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/TTLFieldMapper.java
index 7fb30c9239ac8..8c3ccf3c765d1 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/TTLFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/TTLFieldMapper.java
@@ -102,7 +102,7 @@ public MetadataFieldMapper.Builder parse(String name, Map node,
String fieldName = entry.getKey();
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
- EnabledAttributeMapper enabledState = lenientNodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED;
+ EnabledAttributeMapper enabledState = lenientNodeBooleanValue(fieldNode, fieldName) ? 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/TimestampFieldMapper.java b/core/src/main/java/org/elasticsearch/index/mapper/TimestampFieldMapper.java
index 00040d90d4b56..be315b4af8c87 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/TimestampFieldMapper.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/TimestampFieldMapper.java
@@ -130,7 +130,7 @@ public MetadataFieldMapper.Builder parse(String name, Map node,
String fieldName = entry.getKey();
Object fieldNode = entry.getValue();
if (fieldName.equals("enabled")) {
- EnabledAttributeMapper enabledState = lenientNodeBooleanValue(fieldNode) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED;
+ EnabledAttributeMapper enabledState = lenientNodeBooleanValue(fieldNode, fieldName) ? EnabledAttributeMapper.ENABLED : EnabledAttributeMapper.DISABLED;
builder.enabled(enabledState);
iterator.remove();
} else if (fieldName.equals("format")) {
@@ -145,7 +145,7 @@ public MetadataFieldMapper.Builder parse(String name, Map node,
}
iterator.remove();
} else if (fieldName.equals("ignore_missing")) {
- ignoreMissing = lenientNodeBooleanValue(fieldNode);
+ ignoreMissing = lenientNodeBooleanValue(fieldNode, fieldName);
builder.ignoreMissing(ignoreMissing);
iterator.remove();
}
diff --git a/core/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java b/core/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java
index 22b9730a92a41..3bf9584673816 100644
--- a/core/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java
+++ b/core/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java
@@ -31,17 +31,13 @@
import org.elasticsearch.index.analysis.NamedAnalyzer;
import org.elasticsearch.index.similarity.SimilarityProvider;
-import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.isArray;
-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;
@@ -59,14 +55,9 @@ public class TypeParsers {
public static final String INDEX_OPTIONS_OFFSETS = "offsets";
private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger(Loggers.getLogger(TypeParsers.class));
- private static final Set BOOLEAN_STRINGS = new HashSet<>(Arrays.asList("true", "false"));
- public static boolean nodeBooleanValue(String name, Object node, Mapper.TypeParser.ParserContext parserContext) {
- // TODO: remove this leniency in 6.0
- if (BOOLEAN_STRINGS.contains(node.toString()) == false) {
- DEPRECATION_LOGGER.deprecated("Expected a boolean for property [{}] but got [{}]", name, node);
- }
- return XContentMapValues.lenientNodeBooleanValue(node);
+ public static boolean nodeBooleanValue(String fieldName, String propertyName, Object node) {
+ return XContentMapValues.lenientNodeBooleanValue(node, fieldName + "." + propertyName);
}
@Deprecated // for legacy ints only
@@ -80,10 +71,10 @@ public static void parseNumberField(LegacyNumberFieldMapper.Builder builder, Str
builder.precisionStep(nodeIntegerValue(propNode));
iterator.remove();
} else if (propName.equals("ignore_malformed")) {
- builder.ignoreMalformed(nodeBooleanValue("ignore_malformed", propNode, parserContext));
+ builder.ignoreMalformed(nodeBooleanValue(name, "ignore_malformed", propNode));
iterator.remove();
} else if (propName.equals("coerce")) {
- builder.coerce(nodeBooleanValue("coerce", propNode, parserContext));
+ builder.coerce(nodeBooleanValue(name, "coerce", propNode));
iterator.remove();
} else if (propName.equals("similarity")) {
SimilarityProvider similarityProvider = resolveSimilarity(parserContext, name, propNode.toString());
@@ -95,7 +86,8 @@ public static void parseNumberField(LegacyNumberFieldMapper.Builder builder, Str
}
}
- private static void parseAnalyzersAndTermVectors(FieldMapper.Builder builder, String name, Map fieldNode, Mapper.TypeParser.ParserContext parserContext) {
+ private static void parseAnalyzersAndTermVectors(FieldMapper.Builder builder, String name, Map fieldNode,
+ Mapper.TypeParser.ParserContext parserContext) {
NamedAnalyzer indexAnalyzer = null;
NamedAnalyzer searchAnalyzer = null;
NamedAnalyzer searchQuoteAnalyzer = null;
@@ -108,16 +100,17 @@ private static void parseAnalyzersAndTermVectors(FieldMapper.Builder builder, St
parseTermVector(name, propNode.toString(), builder);
iterator.remove();
} else if (propName.equals("store_term_vectors")) {
- builder.storeTermVectors(nodeBooleanValue("store_term_vectors", propNode, parserContext));
+ builder.storeTermVectors(nodeBooleanValue(name, "store_term_vectors", propNode));
iterator.remove();
} else if (propName.equals("store_term_vector_offsets")) {
- builder.storeTermVectorOffsets(nodeBooleanValue("store_term_vector_offsets", propNode, parserContext));
+ builder.storeTermVectorOffsets(nodeBooleanValue(name, "store_term_vector_offsets", propNode));
iterator.remove();
} else if (propName.equals("store_term_vector_positions")) {
- builder.storeTermVectorPositions(nodeBooleanValue("store_term_vector_positions", propNode, parserContext));
+ builder.storeTermVectorPositions(
+ nodeBooleanValue(name, "store_term_vector_positions", propNode));
iterator.remove();
} else if (propName.equals("store_term_vector_payloads")) {
- builder.storeTermVectorPayloads(nodeBooleanValue("store_term_vector_payloads", propNode, parserContext));
+ builder.storeTermVectorPayloads(nodeBooleanValue(name,"store_term_vector_payloads", propNode));
iterator.remove();
} else if (propName.equals("analyzer")) {
NamedAnalyzer analyzer = parserContext.getIndexAnalyzers().get(propNode.toString());
@@ -148,7 +141,8 @@ private static void parseAnalyzersAndTermVectors(FieldMapper.Builder builder, St
}
if (searchAnalyzer == null && searchQuoteAnalyzer != null) {
- throw new MapperParsingException("analyzer and search_analyzer on field [" + name + "] must be set when search_quote_analyzer is set");
+ throw new MapperParsingException("analyzer and search_analyzer on field [" + name +
+ "] must be set when search_quote_analyzer is set");
}
if (searchAnalyzer == null) {
@@ -170,16 +164,17 @@ private static void parseAnalyzersAndTermVectors(FieldMapper.Builder builder, St
}
}
- public static boolean parseNorms(FieldMapper.Builder builder, String propName, Object propNode, Mapper.TypeParser.ParserContext parserContext) {
+ public static boolean parseNorms(FieldMapper.Builder builder, String fieldName, String propName, Object propNode,
+ Mapper.TypeParser.ParserContext parserContext) {
if (propName.equals("norms")) {
if (propNode instanceof Map) {
final Map properties = nodeMapValue(propNode, "norms");
- for (Iterator> propsIterator = properties.entrySet().iterator(); propsIterator.hasNext();) {
+ for (Iterator> propsIterator = properties.entrySet().iterator(); propsIterator.hasNext(); ) {
Entry entry2 = propsIterator.next();
final String propName2 = entry2.getKey();
final Object propNode2 = entry2.getValue();
if (propName2.equals("enabled")) {
- builder.omitNorms(!lenientNodeBooleanValue(propNode2));
+ builder.omitNorms(nodeBooleanValue(fieldName, "enabled", propNode2) == false);
propsIterator.remove();
} else if (propName2.equals("loading")) {
// ignore for bw compat
@@ -187,13 +182,14 @@ public static boolean parseNorms(FieldMapper.Builder builder, String propName, O
}
}
DocumentMapperParser.checkNoRemainingFields(propName, properties, parserContext.indexVersionCreated());
- DEPRECATION_LOGGER.deprecated("The [norms{enabled:true/false}] way of specifying norms is deprecated, please use [norms:true/false] instead");
+ DEPRECATION_LOGGER.deprecated("The [norms{enabled:true/false}] way of specifying norms is deprecated, please use " +
+ "[norms:true/false] instead");
} else {
- builder.omitNorms(nodeBooleanValue("norms", propNode, parserContext) == false);
+ builder.omitNorms(nodeBooleanValue(fieldName,"norms", propNode) == false);
}
return true;
} else if (propName.equals("omit_norms")) {
- builder.omitNorms(nodeBooleanValue("norms", propNode, parserContext));
+ builder.omitNorms(nodeBooleanValue(fieldName,"norms", propNode));
DEPRECATION_LOGGER.deprecated("[omit_norms] is deprecated, please use [norms] instead with the opposite boolean value");
return true;
} else {
@@ -205,14 +201,15 @@ public static boolean parseNorms(FieldMapper.Builder builder, String propName, O
* Parse text field attributes. In addition to {@link #parseField common attributes}
* this will parse analysis and term-vectors related settings.
*/
- public static void parseTextField(FieldMapper.Builder builder, String name, Map fieldNode, Mapper.TypeParser.ParserContext parserContext) {
+ public static void parseTextField(FieldMapper.Builder builder, String name, Map fieldNode,
+ Mapper.TypeParser.ParserContext parserContext) {
parseField(builder, name, fieldNode, parserContext);
parseAnalyzersAndTermVectors(builder, name, fieldNode, parserContext);
- for (Iterator> iterator = fieldNode.entrySet().iterator(); iterator.hasNext();) {
+ for (Iterator> iterator = fieldNode.entrySet().iterator(); iterator.hasNext(); ) {
Map.Entry entry = iterator.next();
final String propName = entry.getKey();
final Object propNode = entry.getValue();
- if (parseNorms(builder, propName, propNode, parserContext)) {
+ if (parseNorms(builder, name, propName, propNode, parserContext)) {
iterator.remove();
}
}
@@ -235,28 +232,29 @@ public static void parseField(FieldMapper.Builder builder, String name, Map) propNode;
} else {
throw new MapperParsingException("expected map for property [fields] on field [" + propNode + "] or " +
- "[" + propName + "] but got a " + propNode.getClass());
+ "[" + propName + "] but got a " + propNode.getClass());
}
for (Map.Entry multiFieldEntry : multiFieldsPropNodes.entrySet()) {
String multiFieldName = multiFieldEntry.getKey();
if (multiFieldName.contains(".")) {
- throw new MapperParsingException("Field name [" + multiFieldName + "] which is a multi field of [" + name + "] cannot contain '.'");
+ throw new MapperParsingException("Field name [" + multiFieldName + "] which is a multi field of [" + name + "] cannot" +
+ " contain '.'");
}
if (!(multiFieldEntry.getValue() instanceof Map)) {
throw new MapperParsingException("illegal field [" + multiFieldName + "], only fields can be specified inside fields");
@@ -400,24 +400,11 @@ private static boolean parseIndex(String fieldName, String index) throws MapperP
}
}
- private static boolean parseStore(String store) throws MapperParsingException {
- if (BOOLEAN_STRINGS.contains(store) == false) {
- DEPRECATION_LOGGER.deprecated("Expected a boolean for property [store] but got [{}]", store);
- }
- if ("no".equals(store)) {
- return false;
- } else if ("yes".equals(store)) {
- return true;
- } else {
- return lenientNodeBooleanValue(store);
- }
- }
-
@SuppressWarnings("unchecked")
public static void parseCopyFields(Object propNode, FieldMapper.Builder builder) {
FieldMapper.CopyTo.Builder copyToBuilder = new FieldMapper.CopyTo.Builder();
if (isArray(propNode)) {
- for(Object node : (List