Java Code Examples for org.elasticsearch.common.io.stream.StreamOutput

The following examples show how to use org.elasticsearch.common.io.stream.StreamOutput. These examples are extracted from open source projects. 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 Project: Elasticsearch   Source File: GetFieldMappingsResponse.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(mappings.size());
    for (Map.Entry<String, ImmutableMap<String, ImmutableMap<String, FieldMappingMetaData>>> indexEntry : mappings.entrySet()) {
        out.writeString(indexEntry.getKey());
        out.writeVInt(indexEntry.getValue().size());
        for (Map.Entry<String, ImmutableMap<String, FieldMappingMetaData>> typeEntry : indexEntry.getValue().entrySet()) {
            out.writeString(typeEntry.getKey());
            out.writeVInt(typeEntry.getValue().size());
            for (Map.Entry<String, FieldMappingMetaData> fieldEntry : typeEntry.getValue().entrySet()) {
                out.writeString(fieldEntry.getKey());
                FieldMappingMetaData fieldMapping = fieldEntry.getValue();
                out.writeString(fieldMapping.fullName());
                out.writeBytesReference(fieldMapping.source);
            }
        }
    }
}
 
Example 2
Source Project: Elasticsearch   Source File: TransportTasksAction.java    License: 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(results.size());
    for (TaskResponse result : results) {
        if (result != null) {
            out.writeBoolean(true);
            result.writeTo(out);
        } else {
            out.writeBoolean(false);
        }
    }
    out.writeBoolean(exceptions != null);
    if (exceptions != null) {
        int taskFailures = exceptions.size();
        out.writeVInt(taskFailures);
        for (TaskOperationFailure exception : exceptions) {
            exception.writeTo(out);
        }
    }
}
 
Example 3
Source Project: elasticsearch-carrot2   Source File: ClusteringAction.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
   assert searchRequest != null;
   this.searchRequest.writeTo(out);
   out.writeOptionalString(queryHint);
   out.writeOptionalString(algorithm);
   out.writeInt(maxHits);
   out.writeBoolean(createUngroupedDocumentsCluster);
   out.writeString(defaultLanguage);

   out.writeVInt(fieldMapping.size());
   for (FieldMappingSpec spec : fieldMapping) {
      spec.writeTo(out);
   }

   boolean hasAttributes = (attributes != null);
   out.writeBoolean(hasAttributes);
   if (hasAttributes) {
      out.writeMap(attributes);
   }
}
 
Example 4
Source Project: crate   Source File: ClusterStateHealth.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(final StreamOutput out) throws IOException {
    out.writeVInt(activePrimaryShards);
    out.writeVInt(activeShards);
    out.writeVInt(relocatingShards);
    out.writeVInt(initializingShards);
    out.writeVInt(unassignedShards);
    out.writeVInt(numberOfNodes);
    out.writeVInt(numberOfDataNodes);
    out.writeByte(status.value());
    out.writeVInt(indices.size());
    for (ClusterIndexHealth indexHealth : this) {
        indexHealth.writeTo(out);
    }
    out.writeDouble(activeShardsPercent);
}
 
Example 5
Source Project: Elasticsearch   Source File: AllocationExplanation.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVInt(explanations.size());
    for (Map.Entry<ShardId, List<NodeExplanation>> entry : explanations.entrySet()) {
        entry.getKey().writeTo(out);
        out.writeVInt(entry.getValue().size());
        for (NodeExplanation nodeExplanation : entry.getValue()) {
            if (nodeExplanation.node() == null) {
                out.writeBoolean(false);
            } else {
                out.writeBoolean(true);
                nodeExplanation.node().writeTo(out);
            }
            out.writeString(nodeExplanation.description());
        }
    }
}
 
Example 6
Source Project: Elasticsearch   Source File: MultiTermVectorsRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalString(preference);
    out.writeVInt(requests.size());
    for (TermVectorsRequest termVectorsRequest : requests) {
        termVectorsRequest.writeTo(out);
    }
}
 
Example 7
Source Project: crate   Source File: OsStats.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVLong(timestamp);
    cpu.writeTo(out);
    mem.writeTo(out);
    swap.writeTo(out);
    out.writeOptionalWriteable(cgroup);
}
 
Example 8
Source Project: Elasticsearch   Source File: BlobTransferRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeLong(transferId.getMostSignificantBits());
    out.writeLong(transferId.getLeastSignificantBits());
    out.writeBytesReference(content);
    out.writeBoolean(last);
}
 
Example 9
Source Project: Elasticsearch   Source File: FunctionIdent.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(name);
    out.writeVInt(argumentTypes.size());

    for (DataType argumentType : argumentTypes) {
        DataTypes.toStream(argumentType, out);
    }
}
 
Example 10
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
    script.writeTo(out);
    ValueFormatterStreams.writeOptional(formatter, out);
    gapPolicy.writeTo(out);
    out.writeGenericValue(bucketsPathsMap);
}
 
Example 11
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(items.size());
    for (Item item : items) {
        out.writeVInt(item.slot);
        if (item.response != null) {
            out.writeBoolean(true);
            item.response.writeTo(out);
        } else {
            out.writeBoolean(false);
            out.writeThrowable(item.error);
        }
    }
}
 
Example 12
@Override
public void writeTo(StreamOutput out) throws IOException {
    total.writeTo(out);
    features.writeTo(out);
    featuresets.writeTo(out);
    models.writeTo(out);
}
 
Example 13
Source Project: Elasticsearch   Source File: UpgradeSettingsRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(versions.size());
    for(Map.Entry<String, Tuple<Version, String>> entry : versions.entrySet()) {
        out.writeString(entry.getKey());
        Version.writeVersion(entry.getValue().v1(), out);
        out.writeString(entry.getValue().v2());
    }
    writeTimeout(out);
}
 
Example 14
Source Project: Elasticsearch   Source File: SyncedFlushResponse.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    shardCounts.writeTo(out);
    out.writeInt(shardsResultPerIndex.size());
    for (Map.Entry<String, List<ShardsSyncedFlushResult>> entry : shardsResultPerIndex.entrySet()) {
        out.writeString(entry.getKey());
        out.writeInt(entry.getValue().size());
        for (ShardsSyncedFlushResult shardsSyncedFlushResult : entry.getValue()) {
            shardsSyncedFlushResult.writeTo(out);
        }
    }
}
 
Example 15
Source Project: Elasticsearch   Source File: Lucene.java    License: Apache License 2.0 5 votes vote down vote up
private static void writeMissingValue(StreamOutput out, Object missingValue) throws IOException {
    if (missingValue == SortField.STRING_FIRST) {
        out.writeByte((byte) 1);
    } else if (missingValue == SortField.STRING_LAST) {
        out.writeByte((byte) 2);
    } else {
        out.writeByte((byte) 0);
        out.writeGenericValue(missingValue);
    }
}
 
Example 16
Source Project: Elasticsearch   Source File: InternalProfileShardResults.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeInt(shardResults.size());
    for (Map.Entry<String, List<ProfileShardResult>> entry : shardResults.entrySet()) {
        out.writeString(entry.getKey());
        out.writeInt(entry.getValue().size());

        for (ProfileShardResult result : entry.getValue()) {
            result.writeTo(out);
        }
    }
}
 
Example 17
Source Project: crate   Source File: IndexShardRoutingTable.java    License: Apache License 2.0 5 votes vote down vote up
public static void writeToThin(IndexShardRoutingTable indexShard, StreamOutput out) throws IOException {
    out.writeVInt(indexShard.shardId.id());

    out.writeVInt(indexShard.shards.size());
    for (ShardRouting entry : indexShard) {
        entry.writeToThin(out);
    }
}
 
Example 18
Source Project: crate   Source File: SnapshotShardsService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    snapshot.writeTo(out);
    shardId.writeTo(out);
    status.writeTo(out);
}
 
Example 19
Source Project: Elasticsearch   Source File: BlobTransportRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeString(senderNodeId);
    out.writeLong(transferId.getMostSignificantBits());
    out.writeLong(transferId.getLeastSignificantBits());
}
 
Example 20
Source Project: Elasticsearch   Source File: LoginUserContext.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeNullableString(loginUsername);
    out.writeLong(tenantId);
    out.writeNullableString(password);
    out.writeNullableString(sourceAddrs);
    out.writeNullableString(proxyAddrs);
    out.writeBoolean(authenticated);
    out.writeBoolean(authorized);
}
 
Example 21
Source Project: crate   Source File: AbstractIndexWriterProjection.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    relationName.writeTo(out);
    out.writeOptionalString(partitionIdent);

    Symbols.toStream(idSymbols, out);
    out.writeVInt(primaryKeys.size());
    for (ColumnIdent primaryKey : primaryKeys) {
        primaryKey.writeTo(out);
    }
    Symbols.toStream(partitionedBySymbols, out);
    if (clusteredBySymbol == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        Symbols.toStream(clusteredBySymbol, out);
    }

    if (clusteredByColumn == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        clusteredByColumn.writeTo(out);
    }
    out.writeVInt(bulkActions);
    out.writeBoolean(autoCreateIndices);
}
 
Example 22
Source Project: crate   Source File: UpdateSettingsRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeStringArrayNullable(indices);
    indicesOptions.writeIndicesOptions(out);
    writeSettingsToStream(settings, out);
    out.writeBoolean(preserveExisting);
}
 
Example 23
@Override
public void writeTo(final StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeLong(recoveryId);
    shardId.writeTo(out);
    primaryContext.writeTo(out);
}
 
Example 24
Source Project: Elasticsearch   Source File: ClusterInfoRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeStringArray(indices);
    out.writeStringArray(types);
    indicesOptions.writeIndicesOptions(out);
}
 
Example 25
Source Project: Elasticsearch   Source File: ClusterStatsNodes.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVInt(versions.size());
    for (ObjectIntCursor<JvmVersion> v : versions) {
        v.key.writeTo(out);
        out.writeVInt(v.value);
    }

    out.writeVLong(threads);
    out.writeVLong(maxUptime);
    out.writeVLong(heapUsed);
    out.writeVLong(heapMax);
}
 
Example 26
Source Project: Elasticsearch   Source File: JobResponse.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(directResponse.size());
    for (Bucket bucket : directResponse) {
        StreamBucket.writeBucket(out, streamers, bucket);
    }
}
 
Example 27
Source Project: Elasticsearch   Source File: CreateSnapshotRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeString(snapshot);
    out.writeString(repository);
    out.writeStringArray(indices);
    indicesOptions.writeIndicesOptions(out);
    writeSettingsToStream(settings, out);
    out.writeBoolean(includeGlobalState);
    out.writeBoolean(waitForCompletion);
    out.writeBoolean(partial);
}
 
Example 28
Source Project: Elasticsearch   Source File: ModifyTenantNodesRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeNullableString(nodeIp);
    out.writeInt(nodePort);
    out.writeNullableString(tenantName);
    out.writeInt(operation.getValue());
}
 
Example 29
Source Project: crate   Source File: SnapshotShardFailure.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeOptionalString(nodeId);
    shardId.writeTo(out);
    out.writeString(reason);
    RestStatus.writeTo(out, status);
}
 
Example 30
Source Project: Elasticsearch   Source File: SQLBaseResponse.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeStringArray(cols);
    out.writeBoolean(includeTypes);
    out.writeFloat(duration);
    if (includeTypes) {
        out.writeVInt(colTypes.length);
        for (DataType colType : colTypes) {
            DataTypes.toStream(colType, out);
        }
    }
}