@Override public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { RootObjectMapper.Builder builder = new Builder(name); Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, Object> entry = iterator.next(); String fieldName = entry.getKey(); Object fieldNode = entry.getValue(); if (parseObjectOrDocumentTypeProperties(fieldName, fieldNode, parserContext, builder) || processField(builder, fieldName, fieldNode, parserContext.indexVersionCreated())) { iterator.remove(); } } return builder; }
builder.enabled(TypeParsers.nodeBooleanValue(name, "enabled", fieldNode, parserContext)); iterator.remove(); } else if ("format".equals(fieldName) && parserContext.indexVersionCreated().before(Version.V_5_0_0_alpha1)) {
} else if (propName.equals("locale")) { Locale locale; if (parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_beta2)) { locale = LocaleUtils.parse(propNode.toString()); } else {
private static SimilarityProvider resolveSimilarity(Mapper.TypeParser.ParserContext parserContext, String name, String value) { if (parserContext.indexVersionCreated().before(Version.V_5_0_0_alpha1) && "default".equals(value)) { // "default" similarity has been renamed into "classic" in 3.x. value = "classic"; } SimilarityProvider similarityProvider = parserContext.getSimilarity(value); if (similarityProvider == null) { throw new MapperParsingException("Unknown Similarity type [" + value + "] for field [" + name + "]"); } return similarityProvider; } }
@Override public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { if (parserContext.indexVersionCreated().onOrAfter(Version.V_5_0_0_alpha3)) { throw new MapperParsingException(NAME + " is not configurable"); } return new Builder(parserContext.mapperService().fullName(NAME)); }
builder.boost(nodeFloatValue(propNode)); iterator.remove(); } else if (parserContext.indexVersionCreated().before(Version.V_5_0_0_alpha1) && parseNorms(builder, name, propName, propNode, parserContext)) { iterator.remove(); throw new MapperParsingException("include_in_all in multi fields is not allowed. Found the include_in_all in field [" + name + "] which is within a multi field."); } else if (parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_alpha1)) { throw new MapperParsingException("[include_in_all] is not allowed for indices created on or after version 6.0.0 as " + "[_all] is deprecated. As a replacement, you can use an [copy_to] on mapping fields to create your " + } else if (propName.equals("fielddata") && propNode instanceof Map && parserContext.indexVersionCreated().before(Version.V_5_0_0_alpha1)) {
DocumentMapperParser.checkNoRemainingFields(fieldName, propNode, parserContext.indexVersionCreated()); iterator.remove(); } else if (isEmptyList) { DocumentMapperParser.checkNoRemainingFields(propsNode, parserContext.indexVersionCreated(), "DocType mapping definition has unsupported parameters: ");
ParserContext parserContext) throws MapperParsingException { if (node.isEmpty() == false && parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_alpha1)) { deprecationLogger.deprecated("[_all] is deprecated in 6.0+ and will be removed in 7.0. " + "As a replacement, you can use [copy_to] on " + boolean enabled = TypeParsers.nodeBooleanValueLenient(name, "enabled", fieldNode); if (enabled && node.isEmpty() == false && parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_alpha1)) { throw new IllegalArgumentException("Enabling [_all] is disabled in 6.0. " + "As a replacement, you can use [copy_to] " + if (enabledSet == false && parserContext.indexVersionCreated().before(Version.V_6_0_0_alpha1)) {
if (parsedDeprecatedParams || parserContext.indexVersionCreated().before(Version.V_6_6_0)) {
iterator.remove(); } else if (Fields.CONTEXTS.match(fieldName, LoggingDeprecationHandler.INSTANCE)) { builder.contextMappings(ContextMappings.load(fieldNode, parserContext.indexVersionCreated())); iterator.remove(); } else if (parseMultiField(builder, name, parserContext, fieldName, fieldNode)) {
DocumentMapperParser.checkNoRemainingFields(propName, multiFieldNodes, parserContext.indexVersionCreated());
int minSegmentSize = XContentMapValues.nodeIntegerValue(frequencyFilter.remove("min_segment_size"), 0); builder.fielddataFrequencyFilter(minFrequency, maxFrequency, minSegmentSize); DocumentMapperParser.checkNoRemainingFields(propName, frequencyFilter, parserContext.indexVersionCreated()); iterator.remove(); } else if (propName.equals("index_prefixes")) { Defaults.INDEX_PREFIX_MAX_CHARS); builder.indexPrefixes(minChars, maxChars); DocumentMapperParser.checkNoRemainingFields(propName, indexPrefix, parserContext.indexVersionCreated()); iterator.remove(); } else if (propName.equals("index_phrases")) {
docBuilder.put(typeParser.parse(fieldName, fieldNodeMap, parserContext)); fieldNodeMap.remove("type"); checkNoRemainingFields(fieldName, fieldNodeMap, parserContext.indexVersionCreated()); checkNoRemainingFields(mapping, parserContext.indexVersionCreated(), "Root mapping definition has unsupported parameters: ");
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");
@Override public Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { Builder builder = new Builder(name, type, parserContext.indexVersionCreated()); TypeParsers.parseField(builder, name, node, parserContext); for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) { } else if (propName.equals("locale")) { Locale locale; if (parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_beta2)) { locale = LocaleUtils.parse(propNode.toString()); } else {
@Override public MetadataFieldMapper getDefault(MappedFieldType fieldType, ParserContext context) { final Settings indexSettings = context.mapperService().getIndexSettings().getSettings(); if (fieldType != null) { if (context.indexVersionCreated().before(Version.V_6_0_0_alpha1)) { // The index was created prior to 6.0, and therefore the default for this // particular index should be "true" for enabling _all return new AllFieldMapper(fieldType.clone(), EnabledAttributeMapper.ENABLED, indexSettings); } else { return new AllFieldMapper(indexSettings, fieldType); } } else { return parse(NAME, Collections.emptyMap(), context) .build(new BuilderContext(indexSettings, new ContentPath(1))); } } }
@Override public MetadataFieldMapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { if (parserContext.indexVersionCreated().onOrAfter(Version.V_5_0_0_alpha3)) { throw new MapperParsingException(NAME + " is not configurable"); } return new Builder(parserContext.mapperService().fullName(NAME)); }
private static SimilarityProvider resolveSimilarity(Mapper.TypeParser.ParserContext parserContext, String name, String value) { if (parserContext.indexVersionCreated().before(Version.V_5_0_0_alpha1) && "default".equals(value)) { // "default" similarity has been renamed into "classic" in 3.x. value = "classic"; } SimilarityProvider similarityProvider = parserContext.getSimilarity(value); if (similarityProvider == null) { throw new MapperParsingException("Unknown Similarity type [" + value + "] for field [" + name + "]"); } return similarityProvider; } }
public static boolean nodeBooleanValue(String fieldName, String propertyName, Object node, Mapper.TypeParser.ParserContext parserContext) { if (parserContext.indexVersionCreated().onOrAfter(Version.V_6_0_0_alpha1)) { return XContentMapValues.nodeBooleanValue(node, fieldName + "." + propertyName); } else { return nodeBooleanValueLenient(fieldName, propertyName, node); } }
MultiFieldParserContext(ParserContext in) { super(in.type(), in.indexAnalyzers, in.similarityLookupService(), in.mapperService(), in.typeParsers(), in.indexVersionCreated(), in.queryShardContextSupplier()); } }