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

The following examples show how to use org.elasticsearch.common.io.stream.StreamInput#readBytesReference() . 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: 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 2
Source File: ShardValidateQueryRequest.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);
    source = 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();
        }
    }

    explain = in.readBoolean();
    rewrite = in.readBoolean();
    nowInMillis = in.readVLong();
}
 
Example 3
Source File: GetResult.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    index = in.readString();
    type = in.readOptionalString();
    id = in.readString();
    version = in.readLong();
    exists = in.readBoolean();
    if (exists) {
        source = in.readBytesReference();
        if (source.length() == 0) {
            source = null;
        }
        int size = in.readVInt();
        if (size == 0) {
            fields = ImmutableMap.of();
        } else {
            fields = newHashMapWithExpectedSize(size);
            for (int i = 0; i < size; i++) {
                GetField field = readGetField(in);
                fields.put(field.getName(), field);
            }
        }
    }
}
 
Example 4
Source File: IndexWarmersMetaData.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public IndexWarmersMetaData readFrom(StreamInput in) throws IOException {
    Entry[] entries = new Entry[in.readVInt()];
    for (int i = 0; i < entries.length; i++) {
        String name = in.readString();
        String[] types = in.readStringArray();
        BytesReference source = null;
        if (in.readBoolean()) {
            source = in.readBytesReference();
        }
        Boolean queryCache;
        queryCache = in.readOptionalBoolean();
        entries[i] = new Entry(name, types, queryCache, source);
    }
    return new IndexWarmersMetaData(entries);
}
 
Example 5
Source File: ShardExportRequest.java    From elasticsearch-inout-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    source = 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();
        }
    }
}
 
Example 6
Source File: InternalAggregation.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public final void readFrom(StreamInput in) throws IOException {
    name = in.readString();
    metaData = in.readMap();
    int size = in.readVInt();
    if (size == 0) {
        pipelineAggregators = Collections.emptyList();
    } else {
        pipelineAggregators = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            BytesReference type = in.readBytesReference();
            PipelineAggregator pipelineAggregator = PipelineAggregatorStreams.stream(type).readResult(in);
            pipelineAggregators.add(pipelineAggregator);
        }
    }
    doReadFrom(in);
}
 
Example 7
Source File: ShardUpsertRequest.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    id = in.readString();
    int assignmentsSize = in.readVInt();
    if (assignmentsSize > 0) {
        updateAssignments = new Symbol[assignmentsSize];
        for (int i = 0; i < assignmentsSize; i++) {
            updateAssignments[i] = Symbol.fromStream(in);
        }
    }
    int missingAssignmentsSize = in.readVInt();
    if (missingAssignmentsSize > 0) {
        this.insertValues = new Object[missingAssignmentsSize];
        for (int i = 0; i < missingAssignmentsSize; i++) {
            insertValues[i] = insertValuesStreamer[i].readValueFrom(in);
        }
    }
    this.version = Version.readVersion(in).id;
    versionType = VersionType.fromValue(in.readByte());
    opType = IndexRequest.OpType.fromId(in.readByte());
    if (in.readBoolean()) {
        source = in.readBytesReference();
    }
}
 
Example 8
Source File: BlobRecoveryChunkRequest.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);
    transferId = in.readVLong();
    content = in.readBytesReference();
    isLast = in.readBoolean();
}
 
Example 9
Source File: StreamBucket.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Create a StreamBucket by reading from an input stream.
 * Before consuming the rows it is necessary to set the {@link #streamers(Streamer[])}
 */
public StreamBucket(StreamInput in) throws IOException {
    size = in.readVInt();
    if (size > 0) {
        bytes = in.readBytesReference();
    }
}
 
Example 10
Source File: TermVectorsRequest.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);
    type = in.readString();
    id = in.readString();

    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());
        }
    }
    if (in.readBoolean()) {
        perFieldAnalyzer = readPerFieldAnalyzer(in.readMap());
    }
    if (in.readBoolean()) {
        filterSettings = new FilterSettings();
        filterSettings.readFrom(in);
    }
    realtime = in.readBoolean();
    versionType = VersionType.fromValue(in.readByte());
    version = in.readLong();
}
 
Example 11
Source File: BlobTransferRequest.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);
    transferId = new UUID(in.readLong(), in.readLong());
    content = in.readBytesReference();
    last = in.readBoolean();
}
 
Example 12
Source File: BlobRecoveryStartTransferRequest.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);
    path = in.readString();
    content = in.readBytesReference();
    size = in.readVLong();
    transferId = in.readVLong();
}
 
Example 13
Source File: BlobRecoveryStartTransferRequest.java    From crate with Apache License 2.0 5 votes vote down vote up
public BlobRecoveryStartTransferRequest(StreamInput in) throws IOException {
    super(in);
    path = in.readString();
    content = in.readBytesReference();
    size = in.readVLong();
    transferId = in.readVLong();
}
 
Example 14
Source File: BlobTransferRequest.java    From crate with Apache License 2.0 4 votes vote down vote up
public BlobTransferRequest(StreamInput in) throws IOException {
    super(in);
    transferId = new UUID(in.readLong(), in.readLong());
    content = in.readBytesReference();
    last = in.readBoolean();
}
 
Example 15
Source File: ShardSuggestRequest.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);
    suggestSource = in.readBytesReference();
}
 
Example 16
Source File: PutBlobHeadChunkRequest.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);
    transferId = new UUID(in.readLong(), in.readLong());
    content = in.readBytesReference();
}
 
Example 17
Source File: CompletionSuggestion.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);
    payload = in.readBytesReference();
}
 
Example 18
Source File: BytesTransportRequest.java    From crate with Apache License 2.0 4 votes vote down vote up
public BytesTransportRequest(StreamInput in) throws IOException {
    super(in);
    bytes = in.readBytesReference();
    version = in.getVersion();
}
 
Example 19
Source File: PutBlobHeadChunkRequest.java    From crate with Apache License 2.0 4 votes vote down vote up
public PutBlobHeadChunkRequest(StreamInput in) throws IOException {
    super(in);
    transferId = new UUID(in.readLong(), in.readLong());
    content = in.readBytesReference();
}
 
Example 20
Source File: BytesTransportResponse.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);
    bytes = in.readBytesReference();
}