本文整理汇总了Java中org.elasticsearch.common.xcontent.XContentParser.binaryValue方法的典型用法代码示例。如果您正苦于以下问题:Java XContentParser.binaryValue方法的具体用法?Java XContentParser.binaryValue怎么用?Java XContentParser.binaryValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.xcontent.XContentParser
的用法示例。
在下文中一共展示了XContentParser.binaryValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromXContent
import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
public static WrapperQueryBuilder fromXContent(QueryParseContext parseContext) throws IOException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.nextToken();
if (token != XContentParser.Token.FIELD_NAME) {
throw new ParsingException(parser.getTokenLocation(), "[wrapper] query malformed");
}
String fieldName = parser.currentName();
if (! QUERY_FIELD.match(fieldName)) {
throw new ParsingException(parser.getTokenLocation(), "[wrapper] query malformed, expected `query` but was " + fieldName);
}
parser.nextToken();
byte[] source = parser.binaryValue();
parser.nextToken();
if (source == null) {
throw new ParsingException(parser.getTokenLocation(), "wrapper query has no [query] specified");
}
return new WrapperQueryBuilder(source);
}
示例2: readValue
import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
static Object readValue(XContentParser parser, MapFactory mapFactory, XContentParser.Token token) throws IOException {
if (token == XContentParser.Token.VALUE_NULL) {
return null;
} else if (token == XContentParser.Token.VALUE_STRING) {
return parser.text();
} else if (token == XContentParser.Token.VALUE_NUMBER) {
return parser.numberValue();
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
return parser.booleanValue();
} else if (token == XContentParser.Token.START_OBJECT) {
return readMap(parser, mapFactory);
} else if (token == XContentParser.Token.START_ARRAY) {
return readList(parser, mapFactory);
} else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) {
return parser.binaryValue();
}
return null;
}
示例3: parse
import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.nextToken();
if (token != XContentParser.Token.FIELD_NAME) {
throw new QueryParsingException(parseContext, "[wrapper] query malformed");
}
String fieldName = parser.currentName();
if (!fieldName.equals("query")) {
throw new QueryParsingException(parseContext, "[wrapper] query malformed");
}
parser.nextToken();
byte[] querySource = parser.binaryValue();
try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) {
final QueryParseContext context = new QueryParseContext(parseContext.index(), parseContext.indexQueryParserService());
context.reset(qSourceParser);
Query result = context.parseInnerQuery();
parser.nextToken();
parseContext.combineNamedQueries(context);
return result;
}
}
示例4: parse
import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public void parse(XContentParser parser, SearchContext context) throws Exception {
byte[] aggSource = parser.binaryValue();
try (XContentParser aSourceParser = XContentFactory.xContent(aggSource).createParser(aggSource)) {
aSourceParser.nextToken(); // move past the first START_OBJECT
super.parse(aSourceParser, context);
}
}
示例5: parse
import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public void parse(XContentParser parser, SearchContext context) throws Exception {
byte[] filterSource = parser.binaryValue();
try (XContentParser fSourceParser = XContentFactory.xContent(filterSource).createParser(filterSource)) {
ParsedQuery filter = context.queryParserService().parseInnerFilter(fSourceParser);
if (filter != null) {
context.parsedPostFilter(filter);
}
}
}
示例6: parse
import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
@Override
public void parse(XContentParser parser, SearchContext context) throws Exception {
byte[] querySource = parser.binaryValue();
try (XContentParser qSourceParser = XContentFactory.xContent(querySource).createParser(querySource)) {
context.parsedQuery(context.queryParserService().parse(qSourceParser));
}
}
示例7: readValue
import org.elasticsearch.common.xcontent.XContentParser; //导入方法依赖的package包/类
static Object readValue(XContentParser parser, MapFactory mapFactory, XContentParser.Token token) throws IOException {
if (token == XContentParser.Token.VALUE_NULL) {
return null;
} else if (token == XContentParser.Token.VALUE_STRING) {
return parser.text();
} else if (token == XContentParser.Token.VALUE_NUMBER) {
XContentParser.NumberType numberType = parser.numberType();
if (numberType == XContentParser.NumberType.INT) {
return parser.intValue();
} else if (numberType == XContentParser.NumberType.LONG) {
return parser.longValue();
} else if (numberType == XContentParser.NumberType.FLOAT) {
return parser.floatValue();
} else if (numberType == XContentParser.NumberType.DOUBLE) {
return parser.doubleValue();
}
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
return parser.booleanValue();
} else if (token == XContentParser.Token.START_OBJECT) {
return readMap(parser, mapFactory);
} else if (token == XContentParser.Token.START_ARRAY) {
return readList(parser, mapFactory);
} else if (token == XContentParser.Token.VALUE_EMBEDDED_OBJECT) {
return parser.binaryValue();
}
return null;
}