@Override
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(types.size());
    for (int i = 0; i < types.size(); i++) {
      out.writeVInt(locations.get(i));
      if (types.get(i) == null) {
        out.writeBoolean(false);
      } else {
        out.writeBoolean(true);
        out.writeString(types.get(i));
      }
      out.writeString(ids.get(i));
      if (fields.get(i) == null) {
        out.writeVInt(0);
      } else {
        out.writeVInt(fields.get(i).length);
        for (String field : fields.get(i)) {
          out.writeString(field);
        }
      }
    }

    out.writeOptionalString(preference);
    out.writeBoolean(refresh);
    if (realtime == null) {
      out.writeByte((byte) -1);
    } else if (realtime == false) {
      out.writeByte((byte) 0);
    } else {
      out.writeByte((byte) 1);
    }
  }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(version);
   out.writeString(vmName);
   out.writeString(vmVersion);
   out.writeString(vmVendor);
 }
 public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException {
   out.writeVInt(settings.getAsMap().size());
   for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) {
     out.writeString(entry.getKey());
     out.writeString(entry.getValue());
   }
 }
  @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 {
   out.writeString(index.getName()); // uuid will come as part of settings
   out.writeLong(version);
   out.writeByte(state.id());
   writeSettingsToStream(settings, out);
   out.writeVInt(mappings.size());
   for (ObjectCursor<MappingMetaData> cursor : mappings.values()) {
     cursor.value.writeTo(out);
   }
   out.writeVInt(aliases.size());
   for (ObjectCursor<AliasMetaData> cursor : aliases.values()) {
     cursor.value.writeTo(out);
   }
   out.writeVInt(customs.size());
   for (ObjectObjectCursor<String, Custom> cursor : customs) {
     out.writeString(cursor.key);
     cursor.value.writeTo(out);
   }
   out.writeVInt(activeAllocationIds.size());
   for (IntObjectCursor<Set<String>> cursor : activeAllocationIds) {
     out.writeVInt(cursor.key);
     DiffableUtils.StringSetValueSerializer.getInstance().write(cursor.value, out);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(STREAM.getName());
   out.writeOptionalString(scriptLang);
   out.writeString(scriptString);
   ScriptService.ScriptType.writeTo(scriptType, out);
   out.writeMap(params);
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(type);
   out.writeString(id);
   out.writeString(path);
   out.writeOptionalString(index);
   out.writeOptionalString(routing);
 }
Beispiel #8
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(name);
   out.writeVInt(path.size());
   for (String s : path) {
     out.writeString(s);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(name);
   out.writeVLong(length);
   out.writeString(checksum);
   out.writeString(writtenBy.toString());
   out.writeBytesRef(hash);
 }
 @Override
 public void writeTo(final StreamOutput out) throws IOException {
   out.writeString(cpuAcctControlGroup);
   out.writeLong(cpuAcctUsageNanos);
   out.writeString(cpuControlGroup);
   out.writeLong(cpuCfsPeriodMicros);
   out.writeLong(cpuCfsQuotaMicros);
   cpuStat.writeTo(out);
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeVInt(bucketsPathsMap.size());
   for (Entry<String, String> e : bucketsPathsMap.entrySet()) {
     out.writeString(e.getKey());
     out.writeString(e.getValue());
   }
   script.writeTo(out);
   gapPolicy.writeTo(out);
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeString(fieldName);
   out.writeString(geohash);
   boolean hasLevels = levels != null;
   out.writeBoolean(hasLevels);
   if (hasLevels) {
     out.writeVInt(levels);
   }
   out.writeBoolean(neighbors);
 }
Beispiel #13
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeVInt(userData.size());
   for (Map.Entry<String, String> entry : userData.entrySet()) {
     out.writeString(entry.getKey());
     out.writeString(entry.getValue());
   }
   out.writeLong(generation);
   out.writeOptionalString(id);
   out.writeInt(numDocs);
 }
    @Override
    public void writeTo(StreamOutput out) throws IOException {
      out.writeString(index);
      out.writeOptionalString(type);
      out.writeString(id);
      out.writeOptionalString(routing);
      out.writeOptionalString(parent);
      out.writeOptionalStringArray(storedFields);
      out.writeLong(version);
      out.writeByte(versionType.getValue());

      out.writeOptionalWriteable(fetchSourceContext);
    }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeString(snapshot);
   out.writeString(repository);
   out.writeStringArray(indices);
   indicesOptions.writeIndicesOptions(out);
   out.writeOptionalString(renamePattern);
   out.writeOptionalString(renameReplacement);
   out.writeBoolean(waitForCompletion);
   out.writeBoolean(includeGlobalState);
   writeSettingsToStream(settings, out);
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeVInt(mappings.size());
   for (ObjectObjectCursor<String, ImmutableOpenMap<String, MappingMetaData>> indexEntry :
       mappings) {
     out.writeString(indexEntry.key);
     out.writeVInt(indexEntry.value.size());
     for (ObjectObjectCursor<String, MappingMetaData> typeEntry : indexEntry.value) {
       out.writeString(typeEntry.key);
       typeEntry.value.writeTo(out);
     }
   }
 }
 @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);
   out.writeBoolean(artificial);
   out.writeVLong(tookInMillis);
   out.writeBoolean(hasTermVectors());
   if (hasTermVectors()) {
     out.writeBytesReference(headerRef);
     out.writeBytesReference(termVectors);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeString(index);
   out.writeInt(shardId);
   timeout.writeTo(out);
 }
 /**
  * Writes an {@link IndexRoutingTable} to a {@link StreamOutput}.
  *
  * @param index {@link IndexRoutingTable} to write
  * @param out {@link StreamOutput} to write to
  * @throws IOException if something happens during write
  */
 public static void writeTo(IndexRoutingTable index, StreamOutput out) throws IOException {
   out.writeString(index.index());
   out.writeVInt(index.shards.size());
   for (IndexShardRoutingTable indexShard : index) {
     IndexShardRoutingTable.Builder.writeToThin(indexShard, out);
   }
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeString(fieldName);
   out.writeGenericValue(value);
   type.writeTo(out);
   operator.writeTo(out);
   out.writeVInt(slop);
   out.writeVInt(prefixLength);
   out.writeVInt(maxExpansions);
   out.writeBoolean(fuzzyTranspositions);
   out.writeBoolean(lenient);
   zeroTermsQuery.writeTo(out);
   // optional fields
   out.writeOptionalString(analyzer);
   out.writeOptionalString(minimumShouldMatch);
   out.writeOptionalString(fuzzyRewrite);
   if (fuzziness == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     fuzziness.writeTo(out);
   }
   if (cutoffFrequency == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeFloat(cutoffFrequency);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeString(type);
   out.writeString(id);
   out.writeOptionalString(routing);
   out.writeOptionalString(preference);
   out.writeBytesReference(source);
   out.writeStringArray(filteringAlias);
   if (fields != null) {
     out.writeBoolean(true);
     out.writeStringArray(fields);
   } else {
     out.writeBoolean(false);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeByte(percolatorTypeId);
   out.writeVLong(requestedSize);
   out.writeVLong(count);
   out.writeVInt(matches.length);
   for (BytesRef match : matches) {
     out.writeBytesRef(match);
   }
   out.writeVLong(scores.length);
   for (float score : scores) {
     out.writeFloat(score);
   }
   out.writeVInt(hls.size());
   for (Map<String, HighlightField> hl : hls) {
     out.writeVInt(hl.size());
     for (Map.Entry<String, HighlightField> entry : hl.entrySet()) {
       out.writeString(entry.getKey());
       entry.getValue().writeTo(out);
     }
   }
   out.writeOptionalStreamable(aggregations);
   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);
     }
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(term);
   out.writeInt(startOffset);
   out.writeInt(endOffset);
   out.writeVInt(position);
   out.writeOptionalString(type);
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeByte(replicationType.id());
   out.writeByte(consistencyLevel.id());
   timeout.writeTo(out);
   out.writeString(index);
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeString(queryText);
   out.writeInt(fieldsAndWeights.size());
   for (Map.Entry<String, Float> entry : fieldsAndWeights.entrySet()) {
     out.writeString(entry.getKey());
     out.writeFloat(entry.getValue());
   }
   out.writeInt(flags);
   out.writeOptionalString(analyzer);
   defaultOperator.writeTo(out);
   out.writeBoolean(settings.lowercaseExpandedTerms());
   out.writeBoolean(settings.lenient());
   out.writeBoolean(settings.analyzeWildcard());
   out.writeString(settings.locale().toLanguageTag());
   out.writeOptionalString(minimumShouldMatch);
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeString(type);
   out.writeBoolean(score);
   out.writeNamedWriteable(query);
   out.writeOptionalWriteable(innerHit);
   out.writeBoolean(ignoreUnmapped);
 }
 /**
  * Serializes the given exceptions stacktrace elements as well as it's suppressed exceptions to
  * the given output stream.
  */
 public static <T extends Throwable> T writeStackTraces(T throwable, StreamOutput out)
     throws IOException {
   StackTraceElement[] stackTrace = throwable.getStackTrace();
   out.writeVInt(stackTrace.length);
   for (StackTraceElement element : stackTrace) {
     out.writeString(element.getClassName());
     out.writeOptionalString(element.getFileName());
     out.writeString(element.getMethodName());
     out.writeVInt(element.getLineNumber());
   }
   Throwable[] suppressed = throwable.getSuppressed();
   out.writeVInt(suppressed.length);
   for (Throwable t : suppressed) {
     out.writeException(t);
   }
   return throwable;
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeInt(simple.size());
   for (String t : simple) {
     out.writeString(t);
   }
 }
 @Override
 public final void writeTo(StreamOutput out) throws IOException {
   out.writeString(
       name); // NORELEASE remote writing the name - it is automatically handled with
              // writeNamedWriteable
   out.writeStringArray(bucketsPaths);
   out.writeMap(metaData);
   doWriteTo(out);
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   writeBlockSet(global, out);
   out.writeVInt(indicesBlocks.size());
   for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : indicesBlocks) {
     out.writeString(entry.key);
     writeBlockSet(entry.value, out);
   }
 }