@Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   valid = in.readBoolean();
   explanation = in.readOptionalString();
   error = in.readOptionalString();
 }
  @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());
      }
    }
  }
예제 #3
0
 public OsInfo(StreamInput in) throws IOException {
   this.refreshInterval = in.readLong();
   this.availableProcessors = in.readInt();
   this.allocatedProcessors = in.readInt();
   this.name = in.readOptionalString();
   this.arch = in.readOptionalString();
   this.version = in.readOptionalString();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   stage = SnapshotIndexShardStage.fromValue(in.readByte());
   stats = SnapshotStats.readSnapshotStats(in);
   nodeId = in.readOptionalString();
   failure = in.readOptionalString();
 }
예제 #5
0
 @Override
 public TermsLookup readFrom(StreamInput in) throws IOException {
   String type = in.readString();
   String id = in.readString();
   String path = in.readString();
   String index = in.readOptionalString();
   TermsLookup termsLookup = new TermsLookup(index, type, id, path);
   termsLookup.routing = in.readOptionalString();
   return termsLookup;
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   snapshot = in.readString();
   repository = in.readString();
   indices = in.readStringArray();
   indicesOptions = IndicesOptions.readIndicesOptions(in);
   renamePattern = in.readOptionalString();
   renameReplacement = in.readOptionalString();
   waitForCompletion = in.readBoolean();
   includeGlobalState = in.readBoolean();
   settings = readSettingsFromStream(in);
 }
예제 #7
0
    @Override
    public void readFrom(StreamInput in) throws IOException {
      index = in.readString();
      type = in.readOptionalString();
      id = in.readString();
      routing = in.readOptionalString();
      parent = in.readOptionalString();
      storedFields = in.readOptionalStringArray();
      version = in.readLong();
      versionType = VersionType.fromValue(in.readByte());

      fetchSourceContext = in.readOptionalWriteable(FetchSourceContext::new);
    }
 @Override
 protected CommonTermsQueryBuilder doReadFrom(StreamInput in) throws IOException {
   CommonTermsQueryBuilder commonTermsQueryBuilder =
       new CommonTermsQueryBuilder(in.readString(), in.readGenericValue());
   commonTermsQueryBuilder.highFreqOperator = Operator.readOperatorFrom(in);
   commonTermsQueryBuilder.lowFreqOperator = Operator.readOperatorFrom(in);
   commonTermsQueryBuilder.analyzer = in.readOptionalString();
   commonTermsQueryBuilder.lowFreqMinimumShouldMatch = in.readOptionalString();
   commonTermsQueryBuilder.highFreqMinimumShouldMatch = in.readOptionalString();
   commonTermsQueryBuilder.disableCoord = in.readBoolean();
   commonTermsQueryBuilder.cutoffFrequency = in.readFloat();
   return commonTermsQueryBuilder;
 }
예제 #9
0
  @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);
   type = in.readString();
   id = in.readString();
   routing = in.readOptionalString();
   preference = in.readOptionalString();
   source = in.readBytesReference();
   sourceUnsafe = false;
   filteringAlias = in.readStringArray();
   if (in.readBoolean()) {
     fields = in.readStringArray();
   }
 }
예제 #11
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();
  }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   this.index = in.readOptionalString();
   this.shard = in.readOptionalVInt();
   this.primary = in.readOptionalBoolean();
   this.includeYesDecisions = in.readBoolean();
 }
예제 #13
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   term = in.readString();
   startOffset = in.readInt();
   endOffset = in.readInt();
   position = in.readVInt();
   type = in.readOptionalString();
 }
 /** Read from a Stream. */
 public SignificantTermsAggregationBuilder(StreamInput in) throws IOException {
   super(in, TYPE, ValuesSourceType.ANY);
   bucketCountThresholds = new BucketCountThresholds(in);
   executionHint = in.readOptionalString();
   filterBuilder = in.readOptionalNamedWriteable(QueryBuilder.class);
   includeExclude = in.readOptionalWriteable(IncludeExclude::new);
   significanceHeuristic = in.readNamedWriteable(SignificanceHeuristic.class);
 }
 @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);
 }
예제 #16
0
 /** Read from a stream. */
 public ScriptSortBuilder(StreamInput in) throws IOException {
   script = new Script(in);
   type = ScriptSortType.readFromStream(in);
   order = SortOrder.readFromStream(in);
   sortMode = in.readOptionalWriteable(SortMode::readFromStream);
   nestedPath = in.readOptionalString();
   nestedFilter = in.readOptionalNamedWriteable(QueryBuilder.class);
 }
예제 #17
0
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    type = in.readSharedString();
    id = in.readOptionalString();
    routing = in.readOptionalString();
    parent = in.readOptionalString();
    timestamp = in.readOptionalString();
    ttl = in.readLong();
    source = in.readBytesReference();
    sourceUnsafe = false;

    opType = OpType.fromId(in.readByte());
    refresh = in.readBoolean();
    version = in.readLong();
    versionType = VersionType.fromValue(in.readByte());
  }
예제 #18
0
    @Override
    public void readFrom(StreamInput in) throws IOException {
      index = in.readString();
      type = in.readOptionalString();
      id = in.readString();
      routing = in.readOptionalString();
      int size = in.readVInt();
      if (size > 0) {
        fields = new String[size];
        for (int i = 0; i < size; i++) {
          fields[i] = in.readString();
        }
      }
      version = in.readLong();
      versionType = VersionType.fromValue(in.readByte());

      fetchSourceContext = FetchSourceContext.optionalReadFromStream(in);
    }
예제 #19
0
 @Override
 public SignificanceHeuristic readResult(StreamInput in) throws IOException {
   return new ScriptHeuristic(
       null,
       in.readOptionalString(),
       in.readString(),
       ScriptService.ScriptType.readFrom(in),
       in.readMap());
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   name = in.readOptionalString();
   type = in.readOptionalString();
   started = new Date(in.readLong());
   timestamp = new Date(in.readLong());
   enabled = in.readBoolean();
   active = in.readBoolean();
   counter = in.readLong();
   custom = in.readMap();
 }
예제 #21
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   MapBuilder<String, String> builder = MapBuilder.newMapBuilder();
   for (int i = in.readVInt(); i > 0; i--) {
     builder.put(in.readString(), in.readString());
   }
   userData = builder.immutableMap();
   generation = in.readLong();
   id = in.readOptionalString();
   numDocs = in.readInt();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   shardId = in.readVInt();
   totalHits = in.readVInt();
   updated = in.readVInt();
   bulkResponses = new BulkItemResponse[in.readVInt()];
   for (int i = 0; i < bulkResponses.length; i++) {
     bulkResponses[i] = BulkItemResponse.readBulkItem(in);
   }
   failedShardExceptionMessage = in.readOptionalString();
 }
예제 #23
0
 /** 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;
   }
 }
예제 #24
0
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    preference = in.readOptionalString();
    refresh = in.readBoolean();
    realtime = in.readBoolean();

    int size = in.readVInt();
    items = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
      items.add(Item.readItem(in));
    }
  }
 @Override
 protected SimpleQueryStringBuilder doReadFrom(StreamInput in) throws IOException {
   SimpleQueryStringBuilder result = new SimpleQueryStringBuilder(in.readString());
   int size = in.readInt();
   Map<String, Float> fields = new HashMap<>();
   for (int i = 0; i < size; i++) {
     String field = in.readString();
     Float weight = in.readFloat();
     fields.put(field, weight);
   }
   result.fieldsAndWeights.putAll(fields);
   result.flags = in.readInt();
   result.analyzer = in.readOptionalString();
   result.defaultOperator = Operator.readOperatorFrom(in);
   result.settings.lowercaseExpandedTerms(in.readBoolean());
   result.settings.lenient(in.readBoolean());
   result.settings.analyzeWildcard(in.readBoolean());
   String localeStr = in.readString();
   result.settings.locale(Locale.forLanguageTag(localeStr));
   result.minimumShouldMatch = in.readOptionalString();
   return result;
 }
예제 #26
0
 @Override
 protected MatchQueryBuilder doReadFrom(StreamInput in) throws IOException {
   MatchQueryBuilder matchQuery = new MatchQueryBuilder(in.readString(), in.readGenericValue());
   matchQuery.type = MatchQuery.Type.readTypeFrom(in);
   matchQuery.operator = Operator.readOperatorFrom(in);
   matchQuery.slop = in.readVInt();
   matchQuery.prefixLength = in.readVInt();
   matchQuery.maxExpansions = in.readVInt();
   matchQuery.fuzzyTranspositions = in.readBoolean();
   matchQuery.lenient = in.readBoolean();
   matchQuery.zeroTermsQuery = MatchQuery.ZeroTermsQuery.readZeroTermsQueryFrom(in);
   // optional fields
   matchQuery.analyzer = in.readOptionalString();
   matchQuery.minimumShouldMatch = in.readOptionalString();
   matchQuery.fuzzyRewrite = in.readOptionalString();
   if (in.readBoolean()) {
     matchQuery.fuzziness = Fuzziness.readFuzzinessFrom(in);
   }
   if (in.readBoolean()) {
     matchQuery.cutoffFrequency = in.readFloat();
   }
   return matchQuery;
 }
  public ClusterAllocationExplanation(StreamInput in) throws IOException {
    this.shard = ShardId.readShardId(in);
    this.primary = in.readBoolean();
    this.hasPendingAsyncFetch = in.readBoolean();
    this.assignedNodeId = in.readOptionalString();
    this.unassignedInfo = in.readOptionalWriteable(UnassignedInfo::new);
    this.allocationDelayMillis = in.readVLong();
    this.remainingDelayMillis = in.readVLong();

    int mapSize = in.readVInt();
    Map<DiscoveryNode, NodeExplanation> nodeToExplanation = new HashMap<>(mapSize);
    for (int i = 0; i < mapSize; i++) {
      NodeExplanation nodeExplanation = new NodeExplanation(in);
      nodeToExplanation.put(nodeExplanation.getNode(), nodeExplanation);
    }
    this.nodeExplanations = nodeToExplanation;
  }
예제 #28
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   internalResponse = readInternalSearchResponse(in);
   totalShards = in.readVInt();
   successfulShards = in.readVInt();
   int size = in.readVInt();
   if (size == 0) {
     shardFailures = ShardSearchFailure.EMPTY_ARRAY;
   } else {
     shardFailures = new ShardSearchFailure[size];
     for (int i = 0; i < shardFailures.length; i++) {
       shardFailures[i] = readShardSearchFailure(in);
     }
   }
   scrollId = in.readOptionalString();
   tookInMillis = in.readVLong();
 }
예제 #29
0
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    preference = in.readOptionalString();
    refresh = in.readBoolean();
    byte realtime = in.readByte();
    if (realtime == 0) {
      this.realtime = false;
    } else if (realtime == 1) {
      this.realtime = true;
    }
    ignoreErrorsOnGeneratedFields = in.readBoolean();

    int size = in.readVInt();
    items = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
      items.add(Item.readItem(in));
    }
  }
  /**
   * Deserializes stacktrace elements as well as suppressed exceptions from the given output stream
   * and adds it to the given exception.
   */
  public static <T extends Throwable> T readStackTrace(T throwable, StreamInput in)
      throws IOException {
    final int stackTraceElements = in.readVInt();
    StackTraceElement[] stackTrace = new StackTraceElement[stackTraceElements];
    for (int i = 0; i < stackTraceElements; i++) {
      final String declaringClasss = in.readString();
      final String fileName = in.readOptionalString();
      final String methodName = in.readString();
      final int lineNumber = in.readVInt();
      stackTrace[i] = new StackTraceElement(declaringClasss, methodName, fileName, lineNumber);
    }
    throwable.setStackTrace(stackTrace);

    int numSuppressed = in.readVInt();
    for (int i = 0; i < numSuppressed; i++) {
      throwable.addSuppressed(in.readException());
    }
    return throwable;
  }