use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.ParseField in project crate by crate.
the class AbstractAllocateAllocationCommand method createAllocateParser.
protected static <T extends Builder<?>> ObjectParser<T, Void> createAllocateParser(String command) {
ObjectParser<T, Void> parser = new ObjectParser<>(command);
parser.declareString(Builder::setIndex, new ParseField(INDEX_FIELD));
parser.declareInt(Builder::setShard, new ParseField(SHARD_FIELD));
parser.declareString(Builder::setNode, new ParseField(NODE_FIELD));
return parser;
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.common.ParseField in project graylog2-server by Graylog2.
the class TestMultisearchResponse method getDefaultNamedXContents.
private static List<NamedXContentRegistry.Entry> getDefaultNamedXContents() {
Map<String, ContextParser<Object, ? extends Aggregation>> map = new HashMap<>();
map.put("cardinality", (p, c) -> ParsedCardinality.fromXContent(p, (String) c));
map.put("percentiles_bucket", (p, c) -> ParsedPercentilesBucket.fromXContent(p, (String) c));
map.put("median_absolute_deviation", (p, c) -> ParsedMedianAbsoluteDeviation.fromXContent(p, (String) c));
map.put("min", (p, c) -> ParsedMin.fromXContent(p, (String) c));
map.put("max", (p, c) -> ParsedMax.fromXContent(p, (String) c));
map.put("sum", (p, c) -> ParsedSum.fromXContent(p, (String) c));
map.put("avg", (p, c) -> ParsedAvg.fromXContent(p, (String) c));
map.put("weighted_avg", (p, c) -> ParsedWeightedAvg.fromXContent(p, (String) c));
map.put("value_count", (p, c) -> ParsedValueCount.fromXContent(p, (String) c));
map.put("simple_value", (p, c) -> ParsedSimpleValue.fromXContent(p, (String) c));
map.put("derivative", (p, c) -> ParsedDerivative.fromXContent(p, (String) c));
map.put("bucket_metric_value", (p, c) -> ParsedBucketMetricValue.fromXContent(p, (String) c));
map.put("stats", (p, c) -> ParsedStats.fromXContent(p, (String) c));
map.put("stats_bucket", (p, c) -> ParsedStatsBucket.fromXContent(p, (String) c));
map.put("extended_stats", (p, c) -> ParsedExtendedStats.fromXContent(p, (String) c));
map.put("extended_stats_bucket", (p, c) -> ParsedExtendedStatsBucket.fromXContent(p, (String) c));
map.put("histogram", (p, c) -> ParsedHistogram.fromXContent(p, (String) c));
map.put("date_histogram", (p, c) -> ParsedDateHistogram.fromXContent(p, (String) c));
map.put("auto_date_histogram", (p, c) -> ParsedAutoDateHistogram.fromXContent(p, (String) c));
map.put("sterms", (p, c) -> ParsedStringTerms.fromXContent(p, (String) c));
map.put("lterms", (p, c) -> ParsedLongTerms.fromXContent(p, (String) c));
map.put("dterms", (p, c) -> ParsedDoubleTerms.fromXContent(p, (String) c));
map.put("missing", (p, c) -> ParsedMissing.fromXContent(p, (String) c));
map.put("nested", (p, c) -> ParsedNested.fromXContent(p, (String) c));
map.put("reverse_nested", (p, c) -> ParsedReverseNested.fromXContent(p, (String) c));
map.put("global", (p, c) -> ParsedGlobal.fromXContent(p, (String) c));
map.put("filter", (p, c) -> ParsedFilter.fromXContent(p, (String) c));
map.put("sampler", (p, c) -> ParsedSampler.fromXContent(p, (String) c));
map.put("range", (p, c) -> ParsedRange.fromXContent(p, (String) c));
map.put("date_range", (p, c) -> ParsedDateRange.fromXContent(p, (String) c));
map.put("filters", (p, c) -> ParsedFilters.fromXContent(p, (String) c));
map.put("top_hits", (p, c) -> ParsedTopHits.fromXContent(p, (String) c));
map.put("composite", (p, c) -> ParsedComposite.fromXContent(p, (String) c));
List<NamedXContentRegistry.Entry> entries = map.entrySet().stream().map((entry) -> new NamedXContentRegistry.Entry(Aggregation.class, new ParseField(entry.getKey()), entry.getValue())).collect(Collectors.toList());
entries.add(new NamedXContentRegistry.Entry(Suggest.Suggestion.class, new ParseField("term"), (parser, context) -> TermSuggestion.fromXContent(parser, (String) context)));
entries.add(new NamedXContentRegistry.Entry(Suggest.Suggestion.class, new ParseField("phrase"), (parser, context) -> PhraseSuggestion.fromXContent(parser, (String) context)));
entries.add(new NamedXContentRegistry.Entry(Suggest.Suggestion.class, new ParseField("completion"), (parser, context) -> CompletionSuggestion.fromXContent(parser, (String) context)));
return entries;
}
Aggregations