当前位置: 首页>>代码示例>>Java>>正文


Java XContentParser.getTokenLocation方法代码示例

本文整理汇总了Java中org.elasticsearch.common.xcontent.XContentParser.getTokenLocation方法的典型用法代码示例。如果您正苦于以下问题:Java XContentParser.getTokenLocation方法的具体用法?Java XContentParser.getTokenLocation怎么用?Java XContentParser.getTokenLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.xcontent.XContentParser的用法示例。


在下文中一共展示了XContentParser.getTokenLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromXContent

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static Suggestion<? extends Entry<? extends Option>> fromXContent(XContentParser parser) throws IOException {
    ensureExpectedToken(XContentParser.Token.FIELD_NAME, parser.currentToken(), parser::getTokenLocation);
    String typeAndName = parser.currentName();
    // we need to extract the type prefix from the name and throw error if it is not present
    int delimiterPos = typeAndName.indexOf(InternalAggregation.TYPED_KEYS_DELIMITER);
    String type;
    String name;
    if (delimiterPos > 0) {
        type = typeAndName.substring(0, delimiterPos);
        name = typeAndName.substring(delimiterPos + 1);
    } else {
        throw new ParsingException(parser.getTokenLocation(),
                "Cannot parse suggestion response without type information. Set [" + RestSearchAction.TYPED_KEYS_PARAM
                        + "] parameter on the request to ensure the type information is added to the response output");
    }

    return parser.namedObject(Suggestion.class, type, name);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:Suggest.java

示例2: parseSpecial

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public void parseSpecial(String aggregationName, XContentParser parser, SearchContext context, XContentParser.Token token, String currentFieldName) throws IOException {

    if (token == XContentParser.Token.START_OBJECT) {
        SignificanceHeuristicParser significanceHeuristicParser = significanceHeuristicParserMapper.get(currentFieldName);
        if (significanceHeuristicParser != null) {
            significanceHeuristic = significanceHeuristicParser.parse(parser, context.parseFieldMatcher(), context);
        } else if (context.parseFieldMatcher().match(currentFieldName, BACKGROUND_FILTER)) {
            filter = context.queryParserService().parseInnerFilter(parser).query();
        } else {
            throw new SearchParseException(context, "Unknown key for a " + token + " in [" + aggregationName + "]: ["
                    + currentFieldName + "].", parser.getTokenLocation());
        }
    } else {
        throw new SearchParseException(context, "Unknown key for a " + token + " in [" + aggregationName + "]: [" + currentFieldName
                + "].", parser.getTokenLocation());
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:SignificantTermsParametersParser.java

示例3: fromXContent

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static TestDeprecatedQueryBuilder fromXContent(QueryParseContext parseContext) throws IOException, ParsingException {
    XContentParser parser = parseContext.parser();

    if (parser.nextToken() != XContentParser.Token.END_OBJECT) {
        throw new ParsingException(parser.getTokenLocation(), "[{}] query does not have any fields", NAME);
    }

    return new TestDeprecatedQueryBuilder();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:TestDeprecatedQueryBuilder.java

示例4: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static LessThanAssertion parse(XContentParser parser) throws IOException {
    XContentLocation location = parser.getTokenLocation();
    Tuple<String,Object> stringObjectTuple = ParserUtils.parseTuple(parser);
    if (false == stringObjectTuple.v2() instanceof Comparable) {
        throw new IllegalArgumentException("lt section can only be used with objects that support natural ordering, found "
                + stringObjectTuple.v2().getClass().getSimpleName());
    }
    return new LessThanAssertion(location, stringObjectTuple.v1(), stringObjectTuple.v2());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:LessThanAssertion.java

示例5: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public AggregatorFactory parse(String aggregationName, XContentParser parser, SearchContext context) throws IOException {
    ValuesSourceParser<GeoPoint> vsParser = ValuesSourceParser.geoPoint(aggregationName, InternalGeoBounds.TYPE, context)
            .targetValueType(ValueType.GEOPOINT)
            .formattable(true)
            .build();
    boolean wrapLongitude = true;
    XContentParser.Token token;
    String currentFieldName = null;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (vsParser.token(currentFieldName, token, parser)) {
            continue;
            
        } else if (token == XContentParser.Token.VALUE_BOOLEAN) {
            if ("wrap_longitude".equals(currentFieldName) || "wrapLongitude".equals(currentFieldName)) {
                wrapLongitude = parser.booleanValue();
            } else {
                throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: ["
                        + currentFieldName + "].", parser.getTokenLocation());
            }
        } else {
            throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: ["
                    + currentFieldName + "].", parser.getTokenLocation());
        }
    }
    return new GeoBoundsAggregator.Factory(aggregationName, vsParser.config(), wrapLongitude);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:30,代码来源:GeoBoundsParser.java

示例6: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static LessThanOrEqualToAssertion parse(XContentParser parser) throws IOException {
    XContentLocation location = parser.getTokenLocation();
    Tuple<String,Object> stringObjectTuple = ParserUtils.parseTuple(parser);
    if (false == stringObjectTuple.v2() instanceof Comparable) {
        throw new IllegalArgumentException("lte section can only be used with objects that support natural ordering, found "
                + stringObjectTuple.v2().getClass().getSimpleName());
    }
    return new LessThanOrEqualToAssertion(location, stringObjectTuple.v1(), stringObjectTuple.v2());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:LessThanOrEqualToAssertion.java

示例7: load

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public Map<String, String> load(XContentParser jp) throws IOException {
    StringBuilder sb = new StringBuilder();
    Map<String, String> settings = newHashMap();
    List<String> path = new ArrayList<>();
    XContentParser.Token token = jp.nextToken();
    if (token == null) {
        return settings;
    }
    if (token != XContentParser.Token.START_OBJECT) {
        throw new ElasticsearchParseException("malformed, expected settings to start with 'object', instead was [{}]", token);
    }
    serializeObject(settings, sb, path, jp, null);

    // ensure we reached the end of the stream
    XContentParser.Token lastToken = null;
    try {
        while (!jp.isClosed() && (lastToken = jp.nextToken()) == null);
    } catch (Exception e) {
        throw new ElasticsearchParseException(
                "malformed, expected end of settings but encountered additional content starting at line number: [{}], column number: [{}]",
                e,
                jp.getTokenLocation().lineNumber,
                jp.getTokenLocation().columnNumber
        );
    }
    if (lastToken != null) {
        throw new ElasticsearchParseException(
                "malformed, expected end of settings but encountered additional content starting at line number: [{}], column number: [{}]",
                jp.getTokenLocation().lineNumber,
                jp.getTokenLocation().columnNumber
        );
    }

    return settings;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:36,代码来源:XContentSettingsLoader.java

示例8: parseRange

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
private static Range parseRange(XContentParser parser, QueryParseContext context) throws IOException {
    String key = null;
    String from = null;
    String to = null;
    String mask = null;

    if (parser.currentToken() != Token.START_OBJECT) {
        throw new ParsingException(parser.getTokenLocation(), "[ranges] must contain objects, but hit a " + parser.currentToken());
    }
    while (parser.nextToken() != Token.END_OBJECT) {
        if (parser.currentToken() == Token.FIELD_NAME) {
            continue;
        }
        if (RangeAggregator.Range.KEY_FIELD.match(parser.currentName())) {
            key = parser.text();
        } else if (RangeAggregator.Range.FROM_FIELD.match(parser.currentName())) {
            from = parser.textOrNull();
        } else if (RangeAggregator.Range.TO_FIELD.match(parser.currentName())) {
            to = parser.textOrNull();
        } else if (MASK_FIELD.match(parser.currentName())) {
            mask = parser.text();
        } else {
            throw new ParsingException(parser.getTokenLocation(), "Unexpected ip range parameter: [" + parser.currentName() + "]");
        }
    }
    if (mask != null) {
        if (key == null) {
            key = mask;
        }
        return new Range(key, mask);
    } else {
        return new Range(key, from, to);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:35,代码来源:IpRangeAggregationBuilder.java

示例9: parseTermsLookup

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static TermsLookup parseTermsLookup(XContentParser parser) throws IOException {
    String index = null;
    String type = null;
    String id = null;
    String path = null;
    String routing = null;
    XContentParser.Token token;
    String currentFieldName = "";
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (token.isValue()) {
            switch (currentFieldName) {
            case "index":
                index = parser.textOrNull();
                break;
            case "type":
                type = parser.text();
                break;
            case "id":
                id = parser.text();
                break;
            case "routing":
                routing = parser.textOrNull();
                break;
            case "path":
                path = parser.text();
                break;
            default:
                throw new ParsingException(parser.getTokenLocation(), "[" + TermsQueryBuilder.NAME +
                    "] query does not support [" + currentFieldName + "] within lookup element");
            }
        } else {
            throw new ParsingException(parser.getTokenLocation(), "[" + TermsQueryBuilder.NAME + "] unknown token ["
                + token + "] after [" + currentFieldName + "]");
        }
    }
    return new TermsLookup(index, type, id, path).routing(routing);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:40,代码来源:TermsLookup.java

示例10: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public AggregatorFactory parse(String aggregationName, XContentParser parser, SearchContext context) throws IOException {
    String path = null;

    XContentParser.Token token;
    String currentFieldName = null;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (token == XContentParser.Token.VALUE_STRING) {
            if ("path".equals(currentFieldName)) {
                path = parser.text();
            } else {
                throw new SearchParseException(context, "Unknown key for a " + token + " in [" + aggregationName + "]: ["
                        + currentFieldName + "].", parser.getTokenLocation());
            }
        } else {
            throw new SearchParseException(context, "Unexpected token " + token + " in [" + aggregationName + "].",
                    parser.getTokenLocation());
        }
    }

    if (path == null) {
        // "field" doesn't exist, so we fall back to the context of the ancestors
        throw new SearchParseException(context, "Missing [path] field for nested aggregation [" + aggregationName + "]",
                parser.getTokenLocation());
    }

    return new NestedAggregator.Factory(aggregationName, path);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:31,代码来源:NestedParser.java

示例11: ScriptField

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public ScriptField(QueryParseContext context) throws IOException {
    boolean ignoreFailure = false;
    XContentParser parser = context.parser();
    String scriptFieldName = parser.currentName();
    Script script = null;

    XContentParser.Token token;
    token = parser.nextToken();
    if (token == XContentParser.Token.START_OBJECT) {
        String currentFieldName = null;
        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            if (token == XContentParser.Token.FIELD_NAME) {
                currentFieldName = parser.currentName();
            } else if (token.isValue()) {
                if (SCRIPT_FIELD.match(currentFieldName)) {
                    script = Script.parse(parser);
                } else if (IGNORE_FAILURE_FIELD.match(currentFieldName)) {
                    ignoreFailure = parser.booleanValue();
                } else {
                    throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
                            + "].", parser.getTokenLocation());
                }
            } else if (token == XContentParser.Token.START_OBJECT) {
                if (SCRIPT_FIELD.match(currentFieldName)) {
                    script = Script.parse(parser);
                } else {
                    throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
                            + "].", parser.getTokenLocation());
                }
            } else {
                throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName
                        + "].", parser.getTokenLocation());
            }
        }
        this.ignoreFailure = ignoreFailure;
        this.fieldName = scriptFieldName;
        this.script = script;
    } else {
        throw new ParsingException(parser.getTokenLocation(), "Expected [" + XContentParser.Token.START_OBJECT + "] in ["
                + parser.currentName() + "] but found [" + token + "]", parser.getTokenLocation());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:43,代码来源:SearchSourceBuilder.java

示例12: fromXContent

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static SpanNearQueryBuilder fromXContent(QueryParseContext parseContext) throws IOException {
    XContentParser parser = parseContext.parser();

    float boost = AbstractQueryBuilder.DEFAULT_BOOST;
    Integer slop = null;
    boolean inOrder = SpanNearQueryBuilder.DEFAULT_IN_ORDER;
    String queryName = null;

    List<SpanQueryBuilder> clauses = new ArrayList<>();

    String currentFieldName = null;
    XContentParser.Token token;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (token == XContentParser.Token.START_ARRAY) {
            if (CLAUSES_FIELD.match(currentFieldName)) {
                while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                    QueryBuilder query = parseContext.parseInnerQueryBuilder();
                    if (query instanceof SpanQueryBuilder == false) {
                        throw new ParsingException(parser.getTokenLocation(), "spanNear [clauses] must be of type span query");
                    }
                    clauses.add((SpanQueryBuilder) query);
                }
            } else {
                throw new ParsingException(parser.getTokenLocation(), "[span_near] query does not support [" + currentFieldName + "]");
            }
        } else if (token.isValue()) {
            if (IN_ORDER_FIELD.match(currentFieldName)) {
                inOrder = parser.booleanValue();
            } else if (SLOP_FIELD.match(currentFieldName)) {
                slop = parser.intValue();
            } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) {
                boost = parser.floatValue();
            } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) {
                queryName = parser.text();
            } else {
                throw new ParsingException(parser.getTokenLocation(), "[span_near] query does not support [" + currentFieldName + "]");
            }
        } else {
            throw new ParsingException(parser.getTokenLocation(), "[span_near] query does not support [" + currentFieldName + "]");
        }
    }

    if (clauses.isEmpty()) {
        throw new ParsingException(parser.getTokenLocation(), "span_near must include [clauses]");
    }

    if (slop == null) {
        throw new ParsingException(parser.getTokenLocation(), "span_near must include [slop]");
    }

    SpanNearQueryBuilder queryBuilder = new SpanNearQueryBuilder(clauses.get(0), slop);
    for (int i = 1; i < clauses.size(); i++) {
        queryBuilder.addClause(clauses.get(i));
    }
    queryBuilder.inOrder(inOrder);
    queryBuilder.boost(boost);
    queryBuilder.queryName(queryName);
    return queryBuilder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:62,代码来源:SpanNearQueryBuilder.java

示例13: fromXContent

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static FieldMaskingSpanQueryBuilder fromXContent(QueryParseContext parseContext) throws IOException {
    XContentParser parser = parseContext.parser();

    float boost = AbstractQueryBuilder.DEFAULT_BOOST;

    SpanQueryBuilder inner = null;
    String field = null;
    String queryName = null;

    String currentFieldName = null;
    XContentParser.Token token;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (token == XContentParser.Token.START_OBJECT) {
            if (QUERY_FIELD.match(currentFieldName)) {
                QueryBuilder query = parseContext.parseInnerQueryBuilder();
                if (query instanceof SpanQueryBuilder == false) {
                    throw new ParsingException(parser.getTokenLocation(), "[field_masking_span] query must be of type span query");
                }
                inner = (SpanQueryBuilder) query;
            } else {
                throw new ParsingException(parser.getTokenLocation(), "[field_masking_span] query does not support ["
                        + currentFieldName + "]");
            }
        } else {
            if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) {
                boost = parser.floatValue();
            } else if (FIELD_FIELD.match(currentFieldName)) {
                field = parser.text();
            } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) {
                queryName = parser.text();
            } else {
                throw new ParsingException(parser.getTokenLocation(),
                        "[field_masking_span] query does not support [" + currentFieldName + "]");
            }
        }
    }
    if (inner == null) {
        throw new ParsingException(parser.getTokenLocation(), "field_masking_span must have [query] span query clause");
    }
    if (field == null) {
        throw new ParsingException(parser.getTokenLocation(), "field_masking_span must have [field] set for it");
    }

    FieldMaskingSpanQueryBuilder queryBuilder = new FieldMaskingSpanQueryBuilder(inner, field);
    queryBuilder.boost(boost);
    queryBuilder.queryName(queryName);
    return queryBuilder;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:51,代码来源:FieldMaskingSpanQueryBuilder.java

示例14: fromXContent

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static RegexpQueryBuilder fromXContent(QueryParseContext parseContext) throws IOException {
    XContentParser parser = parseContext.parser();
    String fieldName = null;
    String rewrite = null;
    String value = null;
    float boost = AbstractQueryBuilder.DEFAULT_BOOST;
    int flagsValue = RegexpQueryBuilder.DEFAULT_FLAGS_VALUE;
    int maxDeterminizedStates = RegexpQueryBuilder.DEFAULT_MAX_DETERMINIZED_STATES;
    String queryName = null;
    String currentFieldName = null;
    XContentParser.Token token;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (parseContext.isDeprecatedSetting(currentFieldName)) {
            // skip
        } else if (token == XContentParser.Token.START_OBJECT) {
            throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, currentFieldName);
            fieldName = currentFieldName;
            while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
                if (token == XContentParser.Token.FIELD_NAME) {
                    currentFieldName = parser.currentName();
                } else {
                    if (VALUE_FIELD.match(currentFieldName)) {
                        value = parser.textOrNull();
                    } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) {
                        boost = parser.floatValue();
                    } else if (REWRITE_FIELD.match(currentFieldName)) {
                        rewrite = parser.textOrNull();
                    } else if (FLAGS_FIELD.match(currentFieldName)) {
                        String flags = parser.textOrNull();
                        flagsValue = RegexpFlag.resolveValue(flags);
                    } else if (MAX_DETERMINIZED_STATES_FIELD.match(currentFieldName)) {
                        maxDeterminizedStates = parser.intValue();
                    } else if (FLAGS_VALUE_FIELD.match(currentFieldName)) {
                        flagsValue = parser.intValue();
                    } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) {
                        queryName = parser.text();
                    } else {
                        throw new ParsingException(parser.getTokenLocation(),
                                "[regexp] query does not support [" + currentFieldName + "]");
                    }
                }
            }
        } else {
            if (NAME_FIELD.match(currentFieldName)) {
                queryName = parser.text();
            } else {
                throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, parser.currentName());
                fieldName = currentFieldName;
                value = parser.textOrNull();
            }
        }
    }

    return new RegexpQueryBuilder(fieldName, value)
            .flags(flagsValue)
            .maxDeterminizedStates(maxDeterminizedStates)
            .rewrite(rewrite)
            .boost(boost)
            .queryName(queryName);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:63,代码来源:RegexpQueryBuilder.java

示例15: parse

import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public PipelineAggregatorFactory parse(String pipelineAggregatorName, XContentParser parser, SearchContext context) throws IOException {
    XContentParser.Token token;
    String currentFieldName = null;
    String[] bucketsPaths = null;
    String format = null;

    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (token == XContentParser.Token.VALUE_STRING) {
            if (context.parseFieldMatcher().match(currentFieldName, FORMAT)) {
                format = parser.text();
            } else if (context.parseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) {
                bucketsPaths = new String[] { parser.text() };
            } else {
                throw new SearchParseException(context, "Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: ["
                        + currentFieldName + "].", parser.getTokenLocation());
            }
        } else if (token == XContentParser.Token.START_ARRAY) {
            if (context.parseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) {
                List<String> paths = new ArrayList<>();
                while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                    String path = parser.text();
                    paths.add(path);
                }
                bucketsPaths = paths.toArray(new String[paths.size()]);
            } else {
                throw new SearchParseException(context, "Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: ["
                        + currentFieldName + "].", parser.getTokenLocation());
            }
        } else {
            throw new SearchParseException(context, "Unexpected token " + token + " in [" + pipelineAggregatorName + "].",
                    parser.getTokenLocation());
        }
    }

    if (bucketsPaths == null) {
        throw new SearchParseException(context, "Missing required field [" + BUCKETS_PATH.getPreferredName()
                + "] for derivative aggregation [" + pipelineAggregatorName + "]", parser.getTokenLocation());
    }

    ValueFormatter formatter = null;
    if (format != null) {
        formatter = ValueFormat.Patternable.Number.format(format).formatter();
    } else {
        formatter = ValueFormatter.RAW;
    }

    return new CumulativeSumPipelineAggregator.Factory(pipelineAggregatorName, bucketsPaths, formatter);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:52,代码来源:CumulativeSumParser.java


注:本文中的org.elasticsearch.common.xcontent.XContentParser.getTokenLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。