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

The following examples show how to use org.elasticsearch.common.io.stream.StreamInput#readFloat() . 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: SQLBaseResponse.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    cols = in.readStringArray();
    includeTypes = in.readBoolean();
    duration = in.readFloat();
    if (includeTypes) {
        int numColTypes = in.readVInt();
        colTypes = new DataType[numColTypes];
        for (int i = 0; i < numColTypes; i++) {
            colTypes[i] = DataTypes.fromStream(in);
        }
    } else {
        colTypes = EMPTY_TYPES;
    }
}
 
Example 2
Source File: InternalSearchHits.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public void readFrom(StreamInput in, StreamContext context) throws IOException {
    totalHits = in.readVLong();
    maxScore = in.readFloat();
    int size = in.readVInt();
    if (size == 0) {
        hits = EMPTY;
    } else {
        if (context.streamShardTarget() == StreamContext.ShardTargetType.LOOKUP) {
            // read the lookup table first
            int lookupSize = in.readVInt();
            for (int i = 0; i < lookupSize; i++) {
                context.handleShardLookup().put(in.readVInt(), readSearchShardTarget(in));
            }
        }

        hits = new InternalSearchHit[size];
        for (int i = 0; i < hits.length; i++) {
            hits[i] = readSearchHit(in, context);
        }
    }
}
 
Example 3
Source File: ShardExistsRequest.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    minScore = in.readFloat();

    querySource = in.readBytesReference();

    int typesSize = in.readVInt();
    if (typesSize > 0) {
        types = new String[typesSize];
        for (int i = 0; i < typesSize; i++) {
            types[i] = in.readString();
        }
    }
    int aliasesSize = in.readVInt();
    if (aliasesSize > 0) {
        filteringAliases = new String[aliasesSize];
        for (int i = 0; i < aliasesSize; i++) {
            filteringAliases[i] = in.readString();
        }
    }
    nowInMillis = in.readVLong();
}
 
Example 4
Source File: Suggest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    text = in.readText();
    score = in.readFloat();
    highlighted = in.readOptionalText();
    collateMatch = in.readOptionalBoolean();
}
 
Example 5
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 6
Source File: ExistsRequest.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);
    minScore = in.readFloat();
    routing = in.readOptionalString();
    preference = in.readOptionalString();
    source = in.readBytesReference();
    types = in.readStringArray();

}
 
Example 7
Source File: PercolateResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    id = in.readText();
    index = in.readText();
    score = in.readFloat();
    int size = in.readVInt();
    if (size > 0) {
        hl = new HashMap<>(size);
        for (int j = 0; j < size; j++) {
            hl.put(in.readString(), HighlightField.readHighlightField(in));
        }
    }
}
 
Example 8
Source File: PercolateShardResponse.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);
    percolatorTypeId = in.readByte();
    requestedSize = in.readVInt();
    count = in.readVLong();
    matches = new BytesRef[in.readVInt()];
    for (int i = 0; i < matches.length; i++) {
        matches[i] = in.readBytesRef();
    }
    scores = new float[in.readVInt()];
    for (int i = 0; i < scores.length; i++) {
        scores[i] = in.readFloat();
    }
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        int mSize = in.readVInt();
        Map<String, HighlightField> fields = new HashMap<>();
        for (int j = 0; j < mSize; j++) {
            fields.put(in.readString(), HighlightField.readHighlightField(in));
        }
        hls.add(fields);
    }
    aggregations = InternalAggregations.readOptionalAggregations(in);
    if (in.readBoolean()) {
        int pipelineAggregatorsSize = in.readVInt();
        List<SiblingPipelineAggregator> pipelineAggregators = new ArrayList<>(pipelineAggregatorsSize);
        for (int i = 0; i < pipelineAggregatorsSize; i++) {
            BytesReference type = in.readBytesReference();
            PipelineAggregator pipelineAggregator = PipelineAggregatorStreams.stream(type).readResult(in);
            pipelineAggregators.add((SiblingPipelineAggregator) pipelineAggregator);
        }
        this.pipelineAggregators = pipelineAggregators;
    }
}
 
Example 9
Source File: FloatType.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public Float readValueFrom(StreamInput in) throws IOException {
    return in.readBoolean() ? null : in.readFloat();
}
 
Example 10
Source File: Rounding.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    rounding = (TimeZoneRounding) Rounding.Streams.read(in);
    factor = in.readFloat();
}
 
Example 11
Source File: Lucene.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public static ScoreDoc readScoreDoc(StreamInput in) throws IOException {
    return new ScoreDoc(in.readVInt(), in.readFloat());
}
 
Example 12
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.readFloat();
    maxValue = in.readFloat();
}
 
Example 13
Source File: StandardFeatureNormDefinition.java    From elasticsearch-learning-to-rank with Apache License 2.0 4 votes vote down vote up
public StandardFeatureNormDefinition(StreamInput input) throws IOException {
    this.featureName = input.readString();
    this.mean = input.readFloat();
    this.setStdDeviation(input.readFloat());
}
 
Example 14
Source File: MinMaxFeatureNormDefinition.java    From elasticsearch-learning-to-rank with Apache License 2.0 4 votes vote down vote up
public MinMaxFeatureNormDefinition(StreamInput input) throws IOException {
    this.featureName = input.readString();
    this.minimum = input.readFloat();
    this.maximum = input.readFloat();
}
 
Example 15
Source File: FloatType.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public Float readValueFrom(StreamInput in) throws IOException {
    return in.readBoolean() ? null : in.readFloat();
}