Java Code Examples for org.elasticsearch.common.io.stream.StreamInput#readDouble()

The following examples show how to use org.elasticsearch.common.io.stream.StreamInput#readDouble() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RCFResultRequest.java    From anomaly-detection with Apache License 2.0 5 votes vote down vote up
public RCFResultRequest(StreamInput in) throws IOException {
    super(in);
    adID = in.readString();
    modelID = in.readString();
    int size = in.readVInt();
    features = new double[size];
    for (int i = 0; i < size; i++) {
        features[i] = in.readDouble();
    }
}
 
Example 2
Source File: AnomalyResultResponse.java    From anomaly-detection with Apache License 2.0 5 votes vote down vote up
public AnomalyResultResponse(StreamInput in) throws IOException {
    super(in);
    anomalyGrade = in.readDouble();
    confidence = in.readDouble();
    anomalyScore = in.readDouble();
    int size = in.readVInt();
    features = new ArrayList<FeatureData>();
    for (int i = 0; i < size; i++) {
        String featureId = in.readString();
        String featureName = in.readString();
        double featureValue = in.readDouble();
        features.add(new FeatureData(featureId, featureName, featureValue));
    }
    error = in.readOptionalString();
}
 
Example 3
Source File: SignificantLongTerms.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    subsetDf = in.readVLong();
    supersetDf = in.readVLong();
    term = in.readLong();
    score = in.readDouble();
    aggregations = InternalAggregations.readAggregations(in);

}
 
Example 4
Source File: Lucene.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public static FieldDoc readFieldDoc(StreamInput in) throws IOException {
    Comparable[] cFields = new Comparable[in.readVInt()];
    for (int j = 0; j < cFields.length; j++) {
        byte type = in.readByte();
        if (type == 0) {
            cFields[j] = null;
        } else if (type == 1) {
            cFields[j] = in.readString();
        } else if (type == 2) {
            cFields[j] = in.readInt();
        } else if (type == 3) {
            cFields[j] = in.readLong();
        } else if (type == 4) {
            cFields[j] = in.readFloat();
        } else if (type == 5) {
            cFields[j] = in.readDouble();
        } else if (type == 6) {
            cFields[j] = in.readByte();
        } else if (type == 7) {
            cFields[j] = in.readShort();
        } else if (type == 8) {
            cFields[j] = in.readBoolean();
        } else if (type == 9) {
            cFields[j] = in.readBytesRef();
        } else {
            throw new IOException("Can't match type [" + type + "]");
        }
    }
    return new FieldDoc(in.readVInt(), in.readFloat(), cFields);
}
 
Example 5
Source File: InternalGeoShape.java    From elasticsearch-plugin-geoshape with MIT License 5 votes vote down vote up
/**
 * Read from a stream.
 */
public InternalBucket(StreamInput in) throws IOException {
    wkb = in.readBytesRef();
    wkbHash = in.readString();
    realType = in.readString();
    area = in.readDouble();
    docCount = in.readLong();
    aggregations = new InternalAggregations(in);
}
 
Example 6
Source File: GeoPointType.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Double[] readValueFrom(StreamInput in) throws IOException {
    if (in.readBoolean()) {
        return new Double[] {in.readDouble(), in.readDouble()};
    } else {
        return null;
    }
}
 
Example 7
Source File: GeoReferenceInfo.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    geoTree = in.readString();
    precision = in.readOptionalString();
    treeLevels = in.readBoolean() ? null : in.readVInt();
    distanceErrorPct = in.readBoolean() ? null : in.readDouble();
}
 
Example 8
Source File: CircuitBreakerStats.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    // limit is the maximum from the old circuit breaker stats for backwards compatibility
    limit = in.readLong();
    estimated = in.readLong();
    overhead = in.readDouble();
    this.trippedCount = in.readLong();
    this.name = in.readString();
}
 
Example 9
Source File: InternalSum.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    valueFormatter = ValueFormatterStreams.readOptional(in);
    sum = in.readDouble();
}
 
Example 10
Source File: InternalBucketMetricValue.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    valueFormatter = ValueFormatterStreams.readOptional(in);
    value = in.readDouble();
    keys = in.readStringArray();
}
 
Example 11
Source File: ExtendedStatsBucketPipelineAggregator.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected void innerReadFrom(StreamInput in) throws IOException {
    sigma = in.readDouble();
}
 
Example 12
Source File: InternalAvg.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    valueFormatter = ValueFormatterStreams.readOptional(in);
    sum = in.readDouble();
    count = in.readVLong();
}
 
Example 13
Source File: InternalMax.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    valueFormatter = ValueFormatterStreams.readOptional(in);
    max = in.readDouble();
}
 
Example 14
Source File: FieldStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    minValue = in.readDouble();
    maxValue = in.readDouble();
}
 
Example 15
Source File: PredictionResults.java    From elasticsearch-linear-regression with Apache License 2.0 4 votes vote down vote up
public PredictionResults(final StreamInput in)
    throws IOException {
  super(in);
  this.predictedValue = in.readDouble();
}
 
Example 16
Source File: DoubleType.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public Double readValueFrom(StreamInput in) throws IOException {
    return in.readBoolean() ? null : in.readDouble();
}
 
Example 17
Source File: Variance.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    sumOfSqrs = in.readDouble();
    sum = in.readDouble();
    count = in.readVLong();
}
 
Example 18
Source File: ClusterHealthResponse.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    clusterName = in.readString();
    // read in a wire-compatible format for 2.x
    int activePrimaryShards = in.readVInt();
    int activeShards = in.readVInt();
    int relocatingShards = in.readVInt();
    int initializingShards = in.readVInt();
    int unassignedShards = in.readVInt();
    int numberOfNodes = in.readVInt();
    int numberOfDataNodes = in.readVInt();
    numberOfPendingTasks = in.readInt();
    ClusterHealthStatus status = ClusterHealthStatus.fromValue(in.readByte());
    int size = in.readVInt();
    Map<String, ClusterIndexHealth> indices = new HashMap<>();
    for (int i = 0; i < size; i++) {
        ClusterIndexHealth indexHealth = ClusterIndexHealth.readClusterIndexHealth(in);
        indices.put(indexHealth.getIndex(), indexHealth);
    }
    timedOut = in.readBoolean();
    size = in.readVInt();
    List<String> validationFailures;
    if (size == 0) {
        validationFailures = Collections.emptyList();
    } else {
        validationFailures = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            validationFailures.add(in.readString());
        }
    }

    numberOfInFlightFetch = in.readInt();
    if (in.getVersion().onOrAfter(Version.V_1_7_0)) {
        delayedUnassignedShards= in.readInt();
    }

    double activeShardsPercent = in.readDouble();
    taskMaxWaitingTime = TimeValue.readTimeValue(in);
    clusterStateHealth = new ClusterStateHealth(numberOfNodes, numberOfDataNodes, activeShards, relocatingShards, activePrimaryShards,
            initializingShards, unassignedShards, activeShardsPercent, status, validationFailures, indices);
}
 
Example 19
Source File: ThresholdResultResponse.java    From anomaly-detection with Apache License 2.0 4 votes vote down vote up
public ThresholdResultResponse(StreamInput in) throws IOException {
    super(in);
    anomalyGrade = in.readDouble();
    confidence = in.readDouble();
}
 
Example 20
Source File: InternalDerivative.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    super.doReadFrom(in);
    normalizationFactor = in.readDouble();
}