Java Code Examples for org.elasticsearch.common.io.stream.StreamOutput#writeOptionalStreamable()

The following examples show how to use org.elasticsearch.common.io.stream.StreamOutput#writeOptionalStreamable() . 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: TransportBroadcastByNodeAction.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeString(nodeId);
    out.writeVInt(totalShards);
    out.writeVInt(results.size());
    for (ShardOperationResult result : results) {
        out.writeOptionalStreamable(result);
    }
    out.writeBoolean(exceptions != null);
    if (exceptions != null) {
        int failureShards = exceptions.size();
        out.writeVInt(failureShards);
        for (int i = 0; i < failureShards; i++) {
            exceptions.get(i).writeTo(out);
        }
    }
}
 
Example 2
Source File: RecoveryState.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    timer.writeTo(out);
    out.writeByte(type.id());
    out.writeByte(stage.id());
    shardId.writeTo(out);
    out.writeOptionalStreamable(restoreSource);
    targetNode.writeTo(out);
    out.writeBoolean(sourceNode != null);
    if (sourceNode != null) {
        sourceNode.writeTo(out);
    }
    index.writeTo(out);
    translog.writeTo(out);
    verifyIndex.writeTo(out);
    out.writeBoolean(primary);
}
 
Example 3
Source File: BulkItemRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVInt(id);
    if (request instanceof IndexRequest) {
        out.writeByte((byte) 0);
    } else if (request instanceof DeleteRequest) {
        out.writeByte((byte) 1);
    } else if (request instanceof UpdateRequest) {
        out.writeByte((byte) 2);
    }
    request.writeTo(out);
    out.writeOptionalStreamable(primaryResponse);
    out.writeBoolean(ignoreOnReplica);
}
 
Example 4
Source File: BaseTasksRequest.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);
    taskId.writeTo(out);
    parentTaskId.writeTo(out);
    out.writeStringArrayNullable(nodesIds);
    out.writeStringArrayNullable(actions);
    out.writeOptionalStreamable(timeout);
}
 
Example 5
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 6
Source File: AnalyzeResponse.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);
    if (tokens != null) {
        out.writeVInt(tokens.size());
        for (AnalyzeToken token : tokens) {
            token.writeTo(out);
        }
    } else {
        out.writeVInt(0);
    }
    if (out.getVersion().onOrAfter(Version.V_2_2_0)) {
        out.writeOptionalStreamable(detail);
    }
}
 
Example 7
Source File: ShardStats.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    shardRouting.writeTo(out);
    commonStats.writeTo(out);
    out.writeOptionalStreamable(commitStats);
    out.writeString(statePath);
    out.writeString(dataPath);
    out.writeBoolean(isCustomDataPath);
}
 
Example 8
Source File: PercolateResponse.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.writeVLong(tookInMillis);
    out.writeVLong(count);
    if (matches == null) {
        out.writeVInt(-1);
    } else {
        out.writeVInt(matches.length);
        for (Match match : matches) {
            match.writeTo(out);
        }
    }
    out.writeOptionalStreamable(aggregations);
}
 
Example 9
Source File: CreateSnapshotResponse.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalStreamable(snapshotInfo);
}
 
Example 10
Source File: SingleShardRequest.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalStreamable(internalShardId);
    out.writeOptionalString(index);
}
 
Example 11
Source File: NodeStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVLong(timestamp);
    if (indices == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        indices.writeTo(out);
    }
    if (os == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        os.writeTo(out);
    }
    if (process == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        process.writeTo(out);
    }
    if (jvm == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        jvm.writeTo(out);
    }
    if (threadPool == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        threadPool.writeTo(out);
    }
    if (fs == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        fs.writeTo(out);
    }
    if (transport == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        transport.writeTo(out);
    }
    if (http == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        http.writeTo(out);
    }
    out.writeOptionalStreamable(breaker);
    out.writeOptionalStreamable(scriptStats);
}
 
Example 12
Source File: LivenessResponse.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    clusterName.writeTo(out);
    out.writeOptionalStreamable(node);
}
 
Example 13
Source File: RestoreSnapshotResponse.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalStreamable(restoreInfo);
}
 
Example 14
Source File: SnapshotException.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalStreamable(snapshot);
}
 
Example 15
Source File: RoutingValidationException.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalStreamable(validation);
}
 
Example 16
Source File: ConnectTransportException.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalStreamable(node);
}
 
Example 17
Source File: InternalSearchHit.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeOptionalText(field);
    out.writeInt(offset);
    out.writeOptionalStreamable(child);
}
 
Example 18
Source File: SearchException.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalStreamable(shardTarget);
}