@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); if (in.getVersion().before(Version.V_1_4_0)) { // term vector used to read & write the index twice, here and in the parent class in.readString(); } type = in.readString(); id = in.readString(); if (in.getVersion().onOrAfter(Version.V_1_4_0)) { if (in.readBoolean()) { doc = in.readBytesReference(); } } routing = in.readOptionalString(); preference = in.readOptionalString(); long flags = in.readVLong(); flagsEnum.clear(); for (Flag flag : Flag.values()) { if ((flags & (1 << flag.ordinal())) != 0) { flagsEnum.add(flag); } } int numSelectedFields = in.readVInt(); if (numSelectedFields > 0) { selectedFields = new HashSet<>(); for (int i = 0; i < numSelectedFields; i++) { selectedFields.add(in.readString()); } } }
@Override protected void doReadFrom(StreamInput in) throws IOException { if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) { this.docCountError = in.readLong(); } else { this.docCountError = -1; } this.order = InternalOrder.Streams.readOrder(in); this.formatter = ValueFormatterStreams.readOptional(in); this.requiredSize = readSize(in); if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) { this.shardSize = readSize(in); this.showTermDocCountError = in.readBoolean(); } else { this.shardSize = requiredSize; this.showTermDocCountError = false; } this.minDocCount = in.readVLong(); if (in.getVersion().onOrAfter(Version.V_1_4_0)) { this.otherDocCount = in.readVLong(); } int size = in.readVInt(); List<InternalTerms.Bucket> buckets = new ArrayList<>(size); for (int i = 0; i < size; i++) { Bucket bucket = new Bucket(formatter, showTermDocCountError); bucket.readFrom(in); buckets.add(bucket); } this.buckets = buckets; this.bucketMap = null; }
@Override public void readFrom(StreamInput in) throws IOException { this.name = in.readString(); if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta)) { this.docCountError = in.readLong(); } else { this.docCountError = -1; } this.order = InternalOrder.Streams.readOrder(in); this.formatter = ValueFormatterStreams.readOptional(in); this.requiredSize = readSize(in); if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta)) { this.shardSize = readSize(in); this.showTermDocCountError = in.readBoolean(); } else { this.shardSize = requiredSize; this.showTermDocCountError = false; } this.minDocCount = in.readVLong(); int size = in.readVInt(); List<InternalTerms.Bucket> buckets = new ArrayList<>(size); for (int i = 0; i < size; i++) { long term = in.readLong(); long docCount = in.readVLong(); long bucketDocCountError = -1; if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta) && showTermDocCountError) { bucketDocCountError = in.readLong(); } InternalAggregations aggregations = InternalAggregations.readAggregations(in); buckets.add( new Bucket(term, docCount, aggregations, showTermDocCountError, bucketDocCountError)); } this.buckets = buckets; this.bucketMap = null; }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); if (in.getVersion().onOrAfter(version1)) { value2 = in.readInt(); } }
public static OriginalIndices readOptionalOriginalIndices(StreamInput in) throws IOException { if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) { boolean empty = in.readBoolean(); if (!empty) { return new OriginalIndices(in.readStringArray(), IndicesOptions.readIndicesOptions(in)); } } return OriginalIndices.EMPTY; }
@Override public void readFrom(StreamInput in) throws IOException { index = in.readString(); type = in.readString(); id = in.readString(); docVersion = in.readVLong(); exists = in.readBoolean(); if (in.getVersion().onOrAfter(Version.V_1_4_4)) { artificial = in.readBoolean(); } if (in.getVersion().onOrAfter(Version.V_1_5_0)) { tookInMillis = in.readVLong(); } if (in.readBoolean()) { headerRef = in.readBytesReference(); termVectors = in.readBytesReference(); } }
@Override public void readFrom(StreamInput in) throws IOException { term = in.readLong(); docCount = in.readVLong(); docCountError = -1; if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1) && showDocCountError) { docCountError = in.readLong(); } aggregations = InternalAggregations.readAggregations(in); }
public OsStats(StreamInput in) throws IOException { this.timestamp = in.readVLong(); this.cpu = new Cpu(in); this.mem = new Mem(in); this.swap = new Swap(in); if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { this.cgroup = in.readOptionalWriteable(Cgroup::new); } else { this.cgroup = null; } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); request = newRequest(); request.readFrom(in); if (in.getVersion().onOrAfter(Version.V_1_4_0)) { shardId = ShardId.readShardId(in); } else { // older nodes will send the concrete index as part of the request shardId = new ShardId(request.index(), in.readVInt()); } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); minScore = in.readFloat(); routing = in.readOptionalString(); preference = in.readOptionalString(); sourceUnsafe = false; source = in.readBytesReference(); types = in.readStringArray(); if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) { terminateAfter = in.readVInt(); } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); name = in.readString(); type = in.readString(); settings = readSettingsFromStream(in); readTimeout(in); if (in.getVersion().onOrAfter(Version.V_1_4_0)) { verify = in.readBoolean(); } else { // we received this request from an older client that doesn't expect us to validate the // request verify = false; } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); recoveryId = in.readLong(); shardId = ShardId.readShardId(in); if (in.getVersion().onOrAfter(Version.V_1_5_0)) { snapshotFiles = Store.MetadataSnapshot.read(in); } else { int size = in.readVInt(); legacySnapshotFiles = Sets.newHashSetWithExpectedSize(size); for (int i = 0; i < size; i++) { legacySnapshotFiles.add(in.readString()); } } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); recoveryId = in.readLong(); shardId = ShardId.readShardId(in); String name = in.readString(); position = in.readVLong(); long length = in.readVLong(); String checksum = in.readOptionalString(); content = in.readBytesReference(); Version writtenBy = null; if (in.getVersion().onOrAfter(org.elasticsearch.Version.V_1_3_0)) { String versionString = in.readOptionalString(); writtenBy = versionString == null ? null : Version.parseLeniently(versionString); } metaData = new StoreFileMetaData(name, length, checksum, writtenBy); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); type = in.readOptionalString(); id = in.readOptionalString(); routing = in.readOptionalString(); parent = in.readOptionalString(); if (in.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) { in.readOptionalString(); // timestamp in.readOptionalWriteable(TimeValue::new); // ttl } source = in.readBytesReference(); opType = OpType.fromId(in.readByte()); version = in.readLong(); versionType = VersionType.fromValue(in.readByte()); pipeline = in.readOptionalString(); isRetry = in.readBoolean(); autoGeneratedTimestamp = in.readLong(); }
/** Read from a stream. */ public IncludeExclude(StreamInput in) throws IOException { if (in.readBoolean()) { includeValues = null; excludeValues = null; incZeroBasedPartition = 0; incNumPartitions = 0; String includeString = in.readOptionalString(); include = includeString == null ? null : new RegExp(includeString); String excludeString = in.readOptionalString(); exclude = excludeString == null ? null : new RegExp(excludeString); return; } include = null; exclude = null; if (in.readBoolean()) { int size = in.readVInt(); includeValues = new TreeSet<>(); for (int i = 0; i < size; i++) { includeValues.add(in.readBytesRef()); } } else { includeValues = null; } if (in.readBoolean()) { int size = in.readVInt(); excludeValues = new TreeSet<>(); for (int i = 0; i < size; i++) { excludeValues.add(in.readBytesRef()); } } else { excludeValues = null; } if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { incNumPartitions = in.readVInt(); incZeroBasedPartition = in.readVInt(); } else { incNumPartitions = 0; incZeroBasedPartition = 0; } }