use of org.opensearch.common.ParseField in project OpenSearch by opensearch-project.
the class ParsedSignificantTerms method declareParsedSignificantTermsFields.
static void declareParsedSignificantTermsFields(final ObjectParser<? extends ParsedSignificantTerms, Void> objectParser, final CheckedFunction<XContentParser, ParsedSignificantTerms.ParsedBucket, IOException> bucketParser) {
declareMultiBucketAggregationFields(objectParser, bucketParser::apply, bucketParser::apply);
objectParser.declareLong((parsedTerms, value) -> parsedTerms.subsetSize = value, CommonFields.DOC_COUNT);
objectParser.declareLong((parsedTerms, value) -> parsedTerms.supersetSize = value, new ParseField(InternalMappedSignificantTerms.BG_COUNT));
}
use of org.opensearch.common.ParseField in project OpenSearch by opensearch-project.
the class NodesResponse method declareCommonNodesResponseParsing.
public static <T extends NodesResponse> void declareCommonNodesResponseParsing(ConstructingObjectParser<T, Void> parser) {
parser.declareObject(ConstructingObjectParser.constructorArg(), NodesResponseHeader::fromXContent, new ParseField("_nodes"));
parser.declareString(ConstructingObjectParser.constructorArg(), new ParseField("cluster_name"));
}
use of org.opensearch.common.ParseField in project OpenSearch by opensearch-project.
the class InternalParentTests method getNamedXContents.
@Override
protected List<Entry> getNamedXContents() {
List<Entry> extendedNamedXContents = new ArrayList<>(super.getNamedXContents());
extendedNamedXContents.add(new Entry(Aggregation.class, new ParseField(ParentAggregationBuilder.NAME), (p, c) -> ParsedParent.fromXContent(p, (String) c)));
return extendedNamedXContents;
}
use of org.opensearch.common.ParseField in project OpenSearch by opensearch-project.
the class ParentJoinNamedXContentProvider method getNamedXContentParsers.
@Override
public List<NamedXContentRegistry.Entry> getNamedXContentParsers() {
ParseField parseFieldChildren = new ParseField(ChildrenAggregationBuilder.NAME);
ParseField parseFieldParent = new ParseField(ParentAggregationBuilder.NAME);
ContextParser<Object, Aggregation> contextParserChildren = (p, name) -> ParsedChildren.fromXContent(p, (String) name);
ContextParser<Object, Aggregation> contextParserParent = (p, name) -> ParsedParent.fromXContent(p, (String) name);
return Arrays.asList(new NamedXContentRegistry.Entry(Aggregation.class, parseFieldChildren, contextParserChildren), new NamedXContentRegistry.Entry(Aggregation.class, parseFieldParent, contextParserParent));
}
use of org.opensearch.common.ParseField in project OpenSearch by opensearch-project.
the class JsonLogLine method createParser.
private static ObjectParser<JsonLogLine, Void> createParser(boolean ignoreUnknownFields) {
ObjectParser<JsonLogLine, Void> parser = new ObjectParser<>("search_template", ignoreUnknownFields, JsonLogLine::new);
parser.declareString(JsonLogLine::setType, new ParseField("type"));
parser.declareString(JsonLogLine::setTimestamp, new ParseField("timestamp"));
parser.declareString(JsonLogLine::setLevel, new ParseField("level"));
parser.declareString(JsonLogLine::setComponent, new ParseField("component"));
parser.declareString(JsonLogLine::setClusterName, new ParseField("cluster.name"));
parser.declareString(JsonLogLine::setNodeName, new ParseField("node.name"));
parser.declareString(JsonLogLine::setClusterUuid, new ParseField("cluster.uuid"));
parser.declareString(JsonLogLine::setNodeId, new ParseField("node.id"));
parser.declareString(JsonLogLine::setMessage, new ParseField("message"));
parser.declareStringArray(JsonLogLine::setStacktrace, new ParseField("stacktrace"));
return parser;
}
Aggregations