@Override
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    if (out.getVersion().before(Version.V_1_4_0)) {
      // term vector used to read & write the index twice, here and in the parent class
      out.writeString(index);
    }
    out.writeString(type);
    out.writeString(id);

    if (out.getVersion().onOrAfter(Version.V_1_4_0)) {
      out.writeBoolean(doc != null);
      if (doc != null) {
        out.writeBytesReference(doc);
      }
    }
    out.writeOptionalString(routing);
    out.writeOptionalString(preference);
    long longFlags = 0;
    for (Flag flag : flagsEnum) {
      longFlags |= (1 << flag.ordinal());
    }
    out.writeVLong(longFlags);
    if (selectedFields != null) {
      out.writeVInt(selectedFields.size());
      for (String selectedField : selectedFields) {
        out.writeString(selectedField);
      }
    } else {
      out.writeVInt(0);
    }
  }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   if (out.getVersion().before(Version.V_1_4_0)) {
     // older nodes expect the concrete index as part of the request
     request.index(shardId.getIndex());
   }
   request.writeTo(out);
   if (out.getVersion().onOrAfter(Version.V_1_4_0)) {
     shardId.writeTo(out);
   } else {
     out.writeVInt(shardId.id());
   }
 }
Ejemplo n.º 3
0
 public static void writeOriginalIndices(OriginalIndices originalIndices, StreamOutput out)
     throws IOException {
   if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
     out.writeStringArrayNullable(originalIndices.indices);
     originalIndices.indicesOptions.writeIndicesOptions(out);
   }
 }
Ejemplo n.º 4
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   boolean regexBased = isRegexBased();
   out.writeBoolean(regexBased);
   if (regexBased) {
     out.writeOptionalString(include == null ? null : include.getOriginalString());
     out.writeOptionalString(exclude == null ? null : exclude.getOriginalString());
   } else {
     boolean hasIncludes = includeValues != null;
     out.writeBoolean(hasIncludes);
     if (hasIncludes) {
       out.writeVInt(includeValues.size());
       for (BytesRef value : includeValues) {
         out.writeBytesRef(value);
       }
     }
     boolean hasExcludes = excludeValues != null;
     out.writeBoolean(hasExcludes);
     if (hasExcludes) {
       out.writeVInt(excludeValues.size());
       for (BytesRef value : excludeValues) {
         out.writeBytesRef(value);
       }
     }
     if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) {
       out.writeVInt(incNumPartitions);
       out.writeVInt(incZeroBasedPartition);
     }
   }
 }
Ejemplo n.º 5
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   if (out.getVersion().onOrAfter(version1)) {
     out.writeInt(value2);
   }
 }
Ejemplo n.º 6
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeLong(term);
   out.writeVLong(getDocCount());
   if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta1) && showDocCountError) {
     out.writeLong(docCountError);
   }
   aggregations.writeTo(out);
 }
Ejemplo n.º 7
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeVLong(timestamp);
   cpu.writeTo(out);
   mem.writeTo(out);
   swap.writeTo(out);
   if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) {
     out.writeOptionalWriteable(cgroup);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeString(name);
   out.writeString(type);
   writeSettingsToStream(settings, out);
   writeTimeout(out);
   if (out.getVersion().onOrAfter(Version.V_1_4_0)) {
     out.writeBoolean(verify);
   }
 }
Ejemplo n.º 9
0
 public static void writeOptionalOriginalIndices(OriginalIndices originalIndices, StreamOutput out)
     throws IOException {
   if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
     boolean empty = originalIndices == EMPTY;
     out.writeBoolean(empty);
     if (!empty) {
       out.writeStringArrayNullable(originalIndices.indices);
       originalIndices.indicesOptions.writeIndicesOptions(out);
     }
   }
 }
Ejemplo n.º 10
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(index);
   out.writeString(type);
   out.writeString(id);
   out.writeVLong(docVersion);
   final boolean docExists = isExists();
   out.writeBoolean(docExists);
   if (out.getVersion().onOrAfter(Version.V_1_4_4)) {
     out.writeBoolean(artificial);
   }
   if (out.getVersion().onOrAfter(Version.V_1_5_0)) {
     out.writeVLong(tookInMillis);
   }
   out.writeBoolean(hasTermVectors());
   if (hasTermVectors()) {
     out.writeBytesReference(headerRef);
     out.writeBytesReference(termVectors);
   }
 }
Ejemplo n.º 11
0
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
     out.writeLong(docCountError);
   }
   InternalOrder.Streams.writeOrder(order, out);
   ValueFormatterStreams.writeOptional(formatter, out);
   writeSize(requiredSize, out);
   if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
     writeSize(shardSize, out);
     out.writeBoolean(showTermDocCountError);
   }
   out.writeVLong(minDocCount);
   if (out.getVersion().onOrAfter(Version.V_1_4_0)) {
     out.writeVLong(otherDocCount);
   }
   out.writeVInt(buckets.size());
   for (InternalTerms.Bucket bucket : buckets) {
     bucket.writeTo(out);
   }
 }
Ejemplo n.º 12
0
  @Override
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeFloat(minScore);
    out.writeOptionalString(routing);
    out.writeOptionalString(preference);
    out.writeBytesReference(source);
    out.writeStringArray(types);

    if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
      out.writeVInt(terminateAfter);
    }
  }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeLong(recoveryId);
   shardId.writeTo(out);
   if (out.getVersion().onOrAfter(Version.V_1_5_0)) {
     snapshotFiles.writeTo(out);
   } else {
     out.writeVInt(snapshotFiles.size());
     for (StoreFileMetaData snapshotFile : snapshotFiles) {
       out.writeString(snapshotFile.name());
     }
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeLong(recoveryId);
   shardId.writeTo(out);
   out.writeString(metaData.name());
   out.writeVLong(position);
   out.writeVLong(metaData.length());
   out.writeOptionalString(metaData.checksum());
   out.writeBytesReference(content);
   if (out.getVersion().onOrAfter(org.elasticsearch.Version.V_1_3_0)) {
     out.writeOptionalString(metaData.writtenBy() == null ? null : metaData.writtenBy().name());
   }
 }
Ejemplo n.º 15
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(name);
   if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta)) {
     out.writeLong(docCountError);
   }
   InternalOrder.Streams.writeOrder(order, out);
   ValueFormatterStreams.writeOptional(formatter, out);
   writeSize(requiredSize, out);
   if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta)) {
     writeSize(shardSize, out);
     out.writeBoolean(showTermDocCountError);
   }
   out.writeVLong(minDocCount);
   out.writeVInt(buckets.size());
   for (InternalTerms.Bucket bucket : buckets) {
     out.writeLong(((Bucket) bucket).term);
     out.writeVLong(bucket.getDocCount());
     if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta) && showTermDocCountError) {
       out.writeLong(bucket.docCountError);
     }
     ((InternalAggregations) bucket.getAggregations()).writeTo(out);
   }
 }
Ejemplo n.º 16
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeOptionalString(type);
   out.writeOptionalString(id);
   out.writeOptionalString(routing);
   out.writeOptionalString(parent);
   if (out.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) {
     out.writeOptionalString(null);
     out.writeOptionalWriteable(null);
   }
   out.writeBytesReference(source);
   out.writeByte(opType.getId());
   out.writeLong(version);
   out.writeByte(versionType.getValue());
   out.writeOptionalString(pipeline);
   out.writeBoolean(isRetry);
   out.writeLong(autoGeneratedTimestamp);
 }