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

The following examples show how to use org.elasticsearch.common.io.stream.StreamOutput. 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: GetFieldMappingsResponse.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.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 File: ClusterStateHealth.java    From crate with 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 #3
Source File: ClusteringAction.java    From elasticsearch-carrot2 with 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 File: AllocationExplanation.java    From Elasticsearch with 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 #5
Source File: TransportTasksAction.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(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 #6
Source File: CachesStatsAction.java    From elasticsearch-learning-to-rank with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    total.writeTo(out);
    features.writeTo(out);
    featuresets.writeTo(out);
    models.writeTo(out);
}
 
Example #7
Source File: SnapshotStats.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVLong(startTime);
    out.writeVLong(time);

    out.writeVInt(numberOfFiles);
    out.writeVInt(processedFiles);

    out.writeVLong(totalSize);
    out.writeVLong(processedSize);
}
 
Example #8
Source File: SyncedFlushResponse.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);
    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 #9
Source File: LoginUserContext.java    From Elasticsearch with 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 #10
Source File: AbstractIndexWriterProjection.java    From crate with 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 #11
Source File: UpdateSettingsRequest.java    From crate with 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 #12
Source File: RecoveryHandoffPrimaryContextRequest.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(final StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeLong(recoveryId);
    shardId.writeTo(out);
    primaryContext.writeTo(out);
}
 
Example #13
Source File: ClusterInfoRequest.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.writeStringArray(indices);
    out.writeStringArray(types);
    indicesOptions.writeIndicesOptions(out);
}
 
Example #14
Source File: ClusterStatsNodes.java    From Elasticsearch with 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 #15
Source File: JobResponse.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.writeVInt(directResponse.size());
    for (Bucket bucket : directResponse) {
        StreamBucket.writeBucket(out, streamers, bucket);
    }
}
 
Example #16
Source File: CreateSnapshotRequest.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.writeString(snapshot);
    out.writeString(repository);
    out.writeStringArray(indices);
    indicesOptions.writeIndicesOptions(out);
    writeSettingsToStream(settings, out);
    out.writeBoolean(includeGlobalState);
    out.writeBoolean(waitForCompletion);
    out.writeBoolean(partial);
}
 
Example #17
Source File: ModifyTenantNodesRequest.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.writeNullableString(nodeIp);
    out.writeInt(nodePort);
    out.writeNullableString(tenantName);
    out.writeInt(operation.getValue());
}
 
Example #18
Source File: SnapshotShardFailure.java    From crate with 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 #19
Source File: SQLBaseResponse.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.writeStringArray(cols);
    out.writeBoolean(includeTypes);
    out.writeFloat(duration);
    if (includeTypes) {
        out.writeVInt(colTypes.length);
        for (DataType colType : colTypes) {
            DataTypes.toStream(colType, out);
        }
    }
}
 
Example #20
Source File: RepairTenantRequest.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);
    int tenantNum = tenantNames == null ? 0 : tenantNames.length;
    out.writeInt(tenantNum);
    for (int i = 0; i < tenantNum; ++i) {
        out.writeString(tenantNames[i]);
    }
}
 
Example #21
Source File: JvmStats.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVInt(collectors.length);
    for (GarbageCollector gc : collectors) {
        gc.writeTo(out);
    }
}
 
Example #22
Source File: InstanceShardOperationRequest.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.writeString(index);
    out.writeInt(shardId);
    timeout.writeTo(out);
    out.writeOptionalString(concreteIndex);
}
 
Example #23
Source File: RepositoriesMetaData.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVInt(repositories.size());
    for (RepositoryMetaData repository : repositories) {
        repository.writeTo(out);
    }
}
 
Example #24
Source File: PutWarmerRequest.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.writeString(name);
    if (searchRequest == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        searchRequest.writeTo(out);
    }
    writeTimeout(out);
}
 
Example #25
Source File: SearchIntoRequest.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalString(routing);
    out.writeOptionalString(preference);
    out.writeBytesReference(source);
    out.writeStringArray(types);
}
 
Example #26
Source File: IntegerType.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeValueTo(StreamOutput out, Object v) throws IOException {
    out.writeBoolean(v == null);
    if (v != null) {
        out.writeInt(((Number) v).intValue());
    }
}
 
Example #27
Source File: CreatePartitionsRequest.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeLong(jobId.getMostSignificantBits());
    out.writeLong(jobId.getLeastSignificantBits());
    out.writeVInt(indices.size());
    for (String index : indices) {
        out.writeString(index);
    }
}
 
Example #28
Source File: TransportBroadcastByNodeAction.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);
    indicesLevelRequest.writeTo(out);
    int size = shards.size();
    out.writeVInt(size);
    for (int i = 0; i < size; i++) {
        shards.get(i).writeTo(out);
    }
    out.writeString(nodeId);
}
 
Example #29
Source File: DerivativePipelineAggregator.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void doWriteTo(StreamOutput out) throws IOException {
    ValueFormatterStreams.writeOptional(formatter, out);
    gapPolicy.writeTo(out);
    boolean hasXAxisUnitsValue = xAxisUnits != null;
    out.writeBoolean(hasXAxisUnitsValue);
    if (hasXAxisUnitsValue) {
        out.writeDouble(xAxisUnits);
    }
}
 
Example #30
Source File: MultiTermVectorsRequest.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.writeOptionalString(preference);
    out.writeVInt(requests.size());
    for (TermVectorsRequest termVectorsRequest : requests) {
        termVectorsRequest.writeTo(out);
    }
}