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

The following examples show how to use org.elasticsearch.common.io.stream.StreamOutput#writeOptionalBoolean() . 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: TopNProjection.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVInt(offset);
    out.writeVInt(limit);
    Symbol.toStream(outputs, out);
    if (isOrdered()) {
        out.writeVInt(reverseFlags.length);
        for (boolean reverseFlag : reverseFlags) {
            out.writeBoolean(reverseFlag);
        }
        for (Symbol symbol : orderBy) {
            Symbol.toStream(symbol, out);
        }
        for (Boolean nullFirst : nullsFirst) {
            out.writeOptionalBoolean(nullFirst);
        }
    } else {
        out.writeVInt(0);
    }
}
 
Example 2
Source File: AliasMetaData.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(alias());
    if (filter() != null) {
        out.writeBoolean(true);
        filter.writeTo(out);
    } else {
        out.writeBoolean(false);
    }
    if (indexRouting() != null) {
        out.writeBoolean(true);
        out.writeString(indexRouting());
    } else {
        out.writeBoolean(false);
    }
    if (searchRouting() != null) {
        out.writeBoolean(true);
        out.writeString(searchRouting());
    } else {
        out.writeBoolean(false);
    }

    out.writeOptionalBoolean(writeIndex());
}
 
Example 3
Source File: Segment.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(name);
    out.writeBoolean(committed);
    out.writeBoolean(search);
    out.writeInt(docCount);
    out.writeInt(delDocCount);
    out.writeLong(sizeInBytes);
    out.writeOptionalString(version.toString());
    out.writeOptionalBoolean(compound);
    out.writeOptionalString(mergeId);
    out.writeLong(memoryInBytes);
    
    boolean verbose = ramTree != null;
    out.writeBoolean(verbose);
    if (verbose) {
        writeRamTree(out, ramTree);
    }
}
 
Example 4
Source File: Alias.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(name);
    out.writeOptionalString(filter);
    out.writeOptionalString(indexRouting);
    out.writeOptionalString(searchRouting);
    out.writeOptionalBoolean(writeIndex);
}
 
Example 5
Source File: SnapshotInfo.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(final StreamOutput out) throws IOException {
    snapshotId.writeTo(out);
    out.writeVInt(indices.size());
    for (String index : indices) {
        out.writeString(index);
    }
    if (state != null) {
        out.writeBoolean(true);
        out.writeByte(state.value());
    } else {
        out.writeBoolean(false);
    }
    out.writeOptionalString(reason);
    out.writeVLong(startTime);
    out.writeVLong(endTime);
    out.writeVInt(totalShards);
    out.writeVInt(successfulShards);
    out.writeVInt(shardFailures.size());
    for (SnapshotShardFailure failure : shardFailures) {
        failure.writeTo(out);
    }
    if (version != null) {
        out.writeBoolean(true);
        Version.writeVersion(version, out);
    } else {
        out.writeBoolean(false);
    }
    out.writeOptionalBoolean(includeGlobalState);
}
 
Example 6
Source File: ClusterStatsData.java    From elasticsearch-prometheus-exporter with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeOptionalBoolean(thresholdEnabled);
    //
    out.writeOptionalLong(diskLowInBytes);
    out.writeOptionalLong(diskHighInBytes);
    out.writeOptionalLong(floodStageInBytes);
    //
    out.writeOptionalDouble(diskLowInPct);
    out.writeOptionalDouble(diskHighInPct);
    out.writeOptionalDouble(floodStageInPct);
}
 
Example 7
Source File: SearchRequest.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(searchType.id());

    out.writeVInt(indices.length);
    for (String index : indices) {
        out.writeString(index);
    }

    out.writeOptionalString(routing);
    out.writeOptionalString(preference);

    if (scroll == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        scroll.writeTo(out);
    }
    out.writeBytesReference(source);
    out.writeBytesReference(extraSource);
    out.writeStringArray(types);
    indicesOptions.writeIndicesOptions(out);

    out.writeBytesReference(templateSource);
    boolean hasTemplate = template != null;
    out.writeBoolean(hasTemplate);
    if (hasTemplate) {
        template.writeTo(out);
    }

    out.writeOptionalBoolean(requestCache);
}
 
Example 8
Source File: GetWarmersResponse.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(warmers.size());
    for (ObjectObjectCursor<String, List<IndexWarmersMetaData.Entry>> indexEntry : warmers) {
        out.writeString(indexEntry.key);
        out.writeVInt(indexEntry.value.size());
        for (IndexWarmersMetaData.Entry warmerEntry : indexEntry.value) {
            out.writeString(warmerEntry.name());
            out.writeStringArray(warmerEntry.types());
            out.writeBytesReference(warmerEntry.source());
            out.writeOptionalBoolean(warmerEntry.requestCache());
        }
    }
}
 
Example 9
Source File: FsInfo.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeOptionalString(path); // total aggregates do not have a path
    out.writeOptionalString(mount);
    out.writeOptionalString(type);
    out.writeLong(total);
    out.writeLong(free);
    out.writeLong(available);
    out.writeOptionalBoolean(spins);
    out.writeLong(limit);
    out.writeLong(limitFree);
    out.writeLong(esUsed);
}
 
Example 10
Source File: MappingMetaData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(type());
    source().writeTo(out);
    // id
    if (id().hasPath()) {
        out.writeBoolean(true);
        out.writeString(id().path());
    } else {
        out.writeBoolean(false);
    }
    // routing
    out.writeBoolean(routing().required());
    if (routing().hasPath()) {
        out.writeBoolean(true);
        out.writeString(routing().path());
    } else {
        out.writeBoolean(false);
    }
    // timestamp
    out.writeBoolean(timestamp().enabled());
    out.writeOptionalString(timestamp().path());
    out.writeString(timestamp().format());
    out.writeOptionalString(timestamp().defaultTimestamp());
    out.writeOptionalBoolean(timestamp().ignoreMissing());
    out.writeBoolean(hasParentField());
    // mappingVersion
    out.writeLong(mappingVersion());

    if (version().hasPath()) {
        out.writeBoolean(true);
        out.writeString(version().path());
        out.writeByte(version().versionType().getValue());
    } else {
        out.writeBoolean(false);
    }
}
 
Example 11
Source File: ResizeRequest.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);
    targetIndexRequest.writeTo(out);
    out.writeString(sourceIndex);
    out.writeEnum(type);
    out.writeOptionalBoolean(copySettings);
}
 
Example 12
Source File: InternalSearchResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    hits.writeTo(out);
    if (aggregations == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        aggregations.writeTo(out);
    }
    if (suggest == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        suggest.writeTo(out);
    }
    out.writeBoolean(timedOut);

    out.writeOptionalBoolean(terminatedEarly);

    if (out.getVersion().onOrAfter(Version.V_2_2_0)) {
        if (profileResults == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            profileResults.writeTo(out);
        }
    }
}
 
Example 13
Source File: Suggest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeText(text);
    out.writeFloat(score);
    out.writeOptionalText(highlighted);
    out.writeOptionalBoolean(collateMatch);
}
 
Example 14
Source File: IndexWarmersMetaData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVInt(entries().size());
    for (Entry entry : entries()) {
        out.writeString(entry.name());
        out.writeStringArray(entry.types());
        if (entry.source() == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            out.writeBytesReference(entry.source());
        }
        out.writeOptionalBoolean(entry.requestCache());
    }
}
 
Example 15
Source File: OrderBy.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeVInt(reverseFlags.length);
    for (boolean reverseFlag : reverseFlags) {
        out.writeBoolean(reverseFlag);
    }
    for (Symbol symbol : orderBySymbols) {
        Symbol.toStream(symbol, out);
    }
    for (Boolean nullFirst : nullsFirst) {
        out.writeOptionalBoolean(nullFirst);
    }
}
 
Example 16
Source File: FileUriCollectPhase.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(compression);
    out.writeOptionalBoolean(sharedStorage);
    Symbol.toStream(targetUri, out);
    out.writeVInt(executionNodes.size());
    for (String node : executionNodes) {
        out.writeString(node);
    }
    Symbol.toStream(toCollect, out);
}
 
Example 17
Source File: MergePhase.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);
    distributionInfo.writeTo(out);
    out.writeVInt(numUpstreams);

    int numCols = inputTypes.size();
    out.writeVInt(numCols);
    for (DataType inputType : inputTypes) {
        DataTypes.toStream(inputType, out);
    }

    if (executionNodes == null) {
        out.writeVInt(0);
    } else {
        out.writeVInt(executionNodes.size());
        for (String node : executionNodes) {
            out.writeString(node);
        }
    }

    out.writeBoolean(sortedInputOutput);
    if (sortedInputOutput) {
        out.writeVInt(orderByIndices.length);
        for (int i = 0; i < orderByIndices.length; i++) {
            out.writeVInt(orderByIndices[i]);
            out.writeBoolean(reverseFlags[i]);
            out.writeOptionalBoolean(nullsFirst[i]);
        }
    }
}
 
Example 18
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);
                }
            }
        }
    }
 
Example 19
Source File: BooleanType.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValueTo(StreamOutput out, Boolean v) throws IOException {
    out.writeOptionalBoolean(v);
}
 
Example 20
Source File: BooleanType.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValueTo(StreamOutput out, Object v) throws IOException {
    out.writeOptionalBoolean((Boolean)v);
}