Java Code Examples for org.elasticsearch.search.aggregations.pipeline.PipelineAggregator#writeTo()

The following examples show how to use org.elasticsearch.search.aggregations.pipeline.PipelineAggregator#writeTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InternalAggregation.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public final void writeTo(StreamOutput out) throws IOException {
    out.writeString(name);
    out.writeGenericValue(metaData);
    out.writeVInt(pipelineAggregators.size());
    for (PipelineAggregator pipelineAggregator : pipelineAggregators) {
        out.writeBytesReference(pipelineAggregator.type().stream());
        pipelineAggregator.writeTo(out);
    }
    doWriteTo(out);
}
 
Example 2
Source File: PercolateShardResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeByte(percolatorTypeId);
    out.writeVLong(requestedSize);
    out.writeVLong(count);
    out.writeVInt(matches.length);
    for (BytesRef match : matches) {
        out.writeBytesRef(match);
    }
    out.writeVLong(scores.length);
    for (float score : scores) {
        out.writeFloat(score);
    }
    out.writeVInt(hls.size());
    for (Map<String, HighlightField> hl : hls) {
        out.writeVInt(hl.size());
        for (Map.Entry<String, HighlightField> entry : hl.entrySet()) {
            out.writeString(entry.getKey());
            entry.getValue().writeTo(out);
        }
    }
    out.writeOptionalStreamable(aggregations);
    if (pipelineAggregators == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        out.writeVInt(pipelineAggregators.size());
        for (PipelineAggregator pipelineAggregator : pipelineAggregators) {
            out.writeBytesReference(pipelineAggregator.type().stream());
            pipelineAggregator.writeTo(out);
        }
    }
}
 
Example 3
Source File: QuerySearchResult.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public void writeToNoId(StreamOutput out) throws IOException {
//        shardTarget.writeTo(out);
        out.writeVInt(from);
        out.writeVInt(size);
        writeTopDocs(out, topDocs);
        if (aggregations == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            aggregations.writeTo(out);
        }
        if (pipelineAggregators == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            out.writeVInt(pipelineAggregators.size());
            for (PipelineAggregator pipelineAggregator : pipelineAggregators) {
                out.writeBytesReference(pipelineAggregator.type().stream());
                pipelineAggregator.writeTo(out);
            }
        }
        if (suggest == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            suggest.writeTo(out);
        }
        out.writeBoolean(searchTimedOut);
        out.writeOptionalBoolean(terminatedEarly);

        if (out.getVersion().onOrAfter(Version.V_2_2_0)) {
            if (profileShardResults == null) {
                out.writeBoolean(false);
            } else {
                out.writeBoolean(true);
                out.writeVInt(profileShardResults.size());
                for (ProfileShardResult shardResult : profileShardResults) {
                    shardResult.writeTo(out);
                }
            }
        }
    }