static ParsedBucket fromXContent(XContentParser parser) throws IOException { return parseXContent(parser, false, ParsedBucket::new, (p, bucket) -> bucket.geohashAsString = p.textOrNull()); } }
protected static <T extends CreateIndexResponse> void declareFields(ConstructingObjectParser<T, Void> objectParser) { declareAcknowledgedAndShardsAcknowledgedFields(objectParser); objectParser.declareField(constructorArg(), (parser, context) -> parser.textOrNull(), INDEX, ObjectParser.ValueType.STRING_OR_NULL); }
alias = parser.text(); } else if ("routing".equals(currentFieldName)) { routing = parser.textOrNull(); } else if ("indexRouting".equals(currentFieldName) || "index-routing".equals(currentFieldName) || "index_routing".equals(currentFieldName)) { indexRouting = parser.textOrNull(); } else if ("searchRouting".equals(currentFieldName) || "search-routing".equals(currentFieldName) || "search_routing".equals(currentFieldName)) { searchRouting = parser.textOrNull(); } else if ("is_write_index".equals(currentFieldName)) { writeIndex = parser.booleanValue();
value = parser.floatValue(); } else if (Fields.DESCRIPTION.equals(currentFieldName)) { description = parser.textOrNull(); } else if (Fields.DETAILS.equals(currentFieldName)) { ensureExpectedToken(XContentParser.Token.START_ARRAY, token, parser::getTokenLocation);
@Override protected void parseCreateField(ParseContext context, List<IndexableField> fields) throws IOException { final String value; if (context.externalValueSet()) { value = context.externalValue().toString(); } else { value = context.parser().textOrNull(); } if (value == null) { return; } if (context.includeInAll(includeInAll, this)) { context.allEntries().addText(fieldType().name(), value, fieldType().boost()); } if (fieldType().indexOptions() != IndexOptions.NONE || fieldType().stored()) { Field field = new Field(fieldType().name(), value, fieldType()); fields.add(field); if (fieldType().omitNorms()) { createFieldNamesField(context, fields); } if (prefixFieldMapper != null) { prefixFieldMapper.addField(value, fields); } if (phraseFieldMapper != null) { fields.add(new Field(phraseFieldMapper.fieldType.name(), value, phraseFieldMapper.fieldType)); } } }
value = fieldType().nullValueAsString(); } else { value = parser.textOrNull();
minimumShouldMatch = parser.textOrNull(); } else if (BOOST_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { boost = parser.floatValue();
queryName = parser.text(); } else if (PREFIX_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { value = parser.textOrNull(); } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { boost = parser.floatValue(); } else if (REWRITE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { rewrite = parser.textOrNull(); } else { throw new ParsingException(parser.getTokenLocation(), throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, parser.currentName()); fieldName = currentFieldName; value = parser.textOrNull();
private static void parseValue(final ParseContext context, ObjectMapper parentMapper, String currentFieldName, XContentParser.Token token) throws IOException { if (currentFieldName == null) { throw new MapperParsingException("object mapping [" + parentMapper.name() + "] trying to serialize a value with" + " no field associated with it, current value [" + context.parser().textOrNull() + "]"); } final String[] paths = splitAndValidatePath(currentFieldName); Mapper mapper = getMapper(parentMapper, currentFieldName, paths); if (mapper != null) { parseObjectOrField(context, mapper); } else { currentFieldName = paths[paths.length - 1]; Tuple<Integer, ObjectMapper> parentMapperTuple = getDynamicParentMapper(context, paths, parentMapper); parentMapper = parentMapperTuple.v2(); parseDynamicValue(context, parentMapper, currentFieldName, token); for (int i = 0; i < parentMapperTuple.v1(); i++) { context.path().remove(); } } }
} else { if (VALUE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { value = parser.textOrNull(); } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { boost = parser.floatValue(); } else if (REWRITE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { rewrite = parser.textOrNull(); } else if (FLAGS_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { String flags = parser.textOrNull(); flagsValue = RegexpFlag.resolveValue(flags); } else if (MAX_DETERMINIZED_STATES_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, parser.currentName()); fieldName = currentFieldName; value = parser.textOrNull();
key = parser.text(); } else if (RangeAggregator.Range.FROM_FIELD.match(parser.currentName(), parser.getDeprecationHandler())) { from = parser.textOrNull(); } else if (RangeAggregator.Range.TO_FIELD.match(parser.currentName(), parser.getDeprecationHandler())) { to = parser.textOrNull(); } else if (MASK_FIELD.match(parser.currentName(), parser.getDeprecationHandler())) { mask = parser.text();
break; case "routing": routing = parser.textOrNull(); break; case "path":
dateAsString = context.parser().textOrNull();
addressAsObject = context.externalValue(); } else { addressAsObject = context.parser().textOrNull();
value = parser.textOrNull(); // preserve formatting } else { value = numericValue;
boost = parser.floatValue(); } else if (REWRITE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { rewrite = parser.textOrNull(); } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { queryName = parser.text();
operator = Operator.fromString(parser.text()); } else if (MINIMUM_SHOULD_MATCH_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { minimumShouldMatch = parser.textOrNull(); } else if (FUZZY_REWRITE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { fuzzyRewrite = parser.textOrNull(); } else if (FUZZY_TRANSPOSITIONS_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { fuzzyTranspositions = parser.booleanValue();
queryName = parser.text(); } else if (MINIMUM_SHOULD_MATCH_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { minimumShouldMatch = parser.textOrNull(); } else if (QUOTE_FIELD_SUFFIX_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { quoteFieldSuffix = parser.textOrNull(); } else if (ALL_FIELDS_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
operator = Operator.fromString(parser.text()); } else if (MINIMUM_SHOULD_MATCH_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { minimumShouldMatch = parser.textOrNull(); } else if (FUZZY_REWRITE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { fuzzyRewrite = parser.textOrNull(); } else if (USE_DIS_MAX_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { useDisMax = parser.booleanValue();
transpositions = parser.booleanValue(); } else if (REWRITE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { rewrite = parser.textOrNull(); } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { queryName = parser.text();