@Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeVInt(shardId);
   out.writeOptionalString(preference);
   out.writeVInt(items.size());
   for (Item item : items) {
     out.writeVInt(item.slot);
     OriginalIndices.writeOriginalIndices(item.request.originalIndices(), out);
     out.writeString(item.request.documentType());
     out.writeBytesReference(item.request.source());
     out.writeBytesReference(item.request.docSource());
     out.writeBoolean(item.request.onlyCount());
   }
 }
Пример #2
0
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    type = in.readString();
    id = in.readString();
    routing = in.readOptionalString();
    preference = in.readOptionalString();
    source = in.readBytesReference();
    filteringAlias = in.readStringArray();
    if (in.readBoolean()) {
      fields = in.readStringArray();
    }

    fetchSourceContext = FetchSourceContext.optionalReadFromStream(in);
    nowInMillis = in.readVLong();
  }
Пример #3
0
  @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);
    }

    FetchSourceContext.optionalWriteToStream(fetchSourceContext, out);
    out.writeVLong(nowInMillis);
  }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   shardId = in.readVInt();
   preference = in.readOptionalString();
   int size = in.readVInt();
   items = new ArrayList<>(size);
   for (int i = 0; i < size; i++) {
     int slot = in.readVInt();
     OriginalIndices originalIndices = OriginalIndices.readOriginalIndices(in);
     PercolateShardRequest shardRequest =
         new PercolateShardRequest(new ShardId(index, shardId), originalIndices);
     shardRequest.documentType(in.readString());
     shardRequest.source(in.readBytesReference());
     shardRequest.docSource(in.readBytesReference());
     shardRequest.onlyCount(in.readBoolean());
     Item item = new Item(slot, shardRequest);
     items.add(item);
   }
 }