Refine search
private static SecurityStandardCategoryStatistics processSecurityReportIssueSearchResults(InternalFilter categoryBucket, boolean includeCwe) { List<SecurityStandardCategoryStatistics> children = new ArrayList<>(); if (includeCwe) { ((StringTerms) categoryBucket.getAggregations().get("cwe")).getBuckets() .forEach(cweBucket -> children.add(processSecurityReportCategorySearchResults(cweBucket, cweBucket.getKeyAsString(), null))); } return processSecurityReportCategorySearchResults(categoryBucket, categoryBucket.getName(), children); }
private static InternalAggregations reduceAggs(List<InternalAggregations> aggregationsList, List<SiblingPipelineAggregator> pipelineAggregators, ReduceContext reduceContext) { InternalAggregations aggregations = InternalAggregations.reduce(aggregationsList, reduceContext); if (pipelineAggregators != null) { List<InternalAggregation> newAggs = StreamSupport.stream(aggregations.spliterator(), false) .map((p) -> (InternalAggregation) p) .collect(Collectors.toList()); for (SiblingPipelineAggregator pipelineAggregator : pipelineAggregators) { InternalAggregation newAgg = pipelineAggregator.doReduce(new InternalAggregations(newAggs), reduceContext); newAggs.add(newAgg); } return new InternalAggregations(newAggs); } return aggregations; }
private static Bucket createFromStream(StreamInput in, DocValueFormat format, boolean keyed) throws IOException { String key = in.getVersion().onOrAfter(Version.V_6_4_0) ? in.readString() : in.readOptionalString(); BytesRef from = in.readBoolean() ? in.readBytesRef() : null; BytesRef to = in.readBoolean() ? in.readBytesRef() : null; long docCount = in.readLong(); InternalAggregations aggregations = InternalAggregations.readAggregations(in); return new Bucket(format, keyed, key, from, to, docCount, aggregations); }
public static InternalAggregations readAggregations(StreamInput in) throws IOException { InternalAggregations result = new InternalAggregations(); result.readFrom(in); return result; }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { if (keyed) { builder.startObject(key); } else { builder.startObject(); } builder.field(CommonFields.DOC_COUNT.getPreferredName(), docCount); aggregations.toXContentInternal(builder, params); builder.endObject(); return builder; }
@Override public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException { builder.field(CommonFields.DOC_COUNT.getPreferredName(), docCount); aggregations.toXContentInternal(builder, params); return builder; }
@Override public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().onOrAfter(Version.V_6_4_0)) { out.writeString(key); } else { out.writeOptionalString(key); } out.writeBoolean(from != null); if (from != null) { out.writeBytesRef(from); } out.writeBoolean(to != null); if (to != null) { out.writeBytesRef(to); } out.writeLong(docCount); aggregations.writeTo(out); }
@Override public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().onOrAfter(Version.V_6_4_0)) { out.writeString(key); } else { out.writeOptionalString(key); } out.writeDouble(from); out.writeDouble(to); out.writeVLong(docCount); aggregations.writeTo(out); }
public InternalSearchResponse(StreamInput in) throws IOException { super( SearchHits.readSearchHits(in), in.readBoolean() ? InternalAggregations.readAggregations(in) : null, in.readBoolean() ? Suggest.readSuggest(in) : null, in.readBoolean(), in.readOptionalBoolean(), in.readOptionalWriteable(SearchProfileShardResults::new), in.readVInt() ); }
/** * Read from a stream. */ public Bucket(StreamInput in, DocValueFormat format) throws IOException { this.format = format; key = in.readLong(); docCount = in.readVLong(); aggregations = InternalAggregations.readAggregations(in); }
/** * Read from a stream. */ public InternalBucket(StreamInput in) throws IOException { key = in.readOptionalString(); docCount = in.readVLong(); aggregations = InternalAggregations.readAggregations(in); }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeLong(geohashAsLong); out.writeVLong(docCount); aggregations.writeTo(out); }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString(key); out.writeVLong(docCount); aggregations.writeTo(out); }
Bucket(StreamInput in, long subsetSize, long supersetSize, DocValueFormat format) throws IOException { super(in, subsetSize, supersetSize, format); subsetDf = in.readVLong(); supersetDf = in.readVLong(); term = in.readLong(); score = in.readDouble(); aggregations = InternalAggregations.readAggregations(in); }
/** * Read from a stream. */ public Bucket(StreamInput in, long subsetSize, long supersetSize, DocValueFormat format) throws IOException { super(in, subsetSize, supersetSize, format); termBytes = in.readBytesRef(); subsetDf = in.readVLong(); supersetDf = in.readVLong(); score = in.readDouble(); aggregations = InternalAggregations.readAggregations(in); }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeVLong(subsetDf); out.writeVLong(supersetDf); out.writeLong(term); out.writeDouble(getSignificanceScore()); aggregations.writeTo(out); }
BucketInfo(StreamInput in) throws IOException { int size = in.readVInt(); roundingInfos = new RoundingInfo[size]; for (int i = 0; i < size; i++) { roundingInfos[i] = new RoundingInfo(in); } roundingIdx = in.readVInt(); emptySubAggregations = InternalAggregations.readAggregations(in); }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeBytesRef(termBytes); out.writeVLong(subsetDf); out.writeVLong(supersetDf); out.writeDouble(getSignificanceScore()); aggregations.writeTo(out); }
/** * Read from a stream. */ public Bucket(StreamInput in, boolean keyed, DocValueFormat format) throws IOException { this.format = format; this.keyed = keyed; key = in.readDouble(); docCount = in.readVLong(); aggregations = InternalAggregations.readAggregations(in); }