Java Code Examples for org.elasticsearch.common.io.stream.StreamOutput#writeGenericValue()

The following examples show how to use org.elasticsearch.common.io.stream.StreamOutput#writeGenericValue() . 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: InternalAggregation.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public final void writeTo(StreamOutput out) throws IOException {
    out.writeString(name);
    out.writeGenericValue(metaData);
    out.writeVInt(pipelineAggregators.size());
    for (PipelineAggregator pipelineAggregator : pipelineAggregators) {
        out.writeBytesReference(pipelineAggregator.type().stream());
        pipelineAggregator.writeTo(out);
    }
    doWriteTo(out);
}
 
Example 2
Source File: Settings.java    From crate with Apache License 2.0 5 votes vote down vote up
public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException {
    Set<Map.Entry<String, Object>> entries = settings.settings.entrySet();
    out.writeVInt(entries.size());
    for (Map.Entry<String, Object> entry : entries) {
        out.writeString(entry.getKey());
        out.writeGenericValue(entry.getValue());
    }
}
 
Example 3
Source File: ExtendedAnalyzeResponse.java    From elasticsearch-extended-analyze with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(term);
    out.writeInt(startOffset);
    out.writeInt(endOffset);
    out.writeVInt(position);
    out.writeOptionalString(type);
    out.writeGenericValue(extendedAttributes);
}
 
Example 4
Source File: MultiValuesSourceAggregationBuilder.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
@Override
protected final void doWriteTo(StreamOutput out) throws IOException {
  if (serializeTargetValueType()) {
    out.writeOptionalWriteable(targetValueType);
  }
  out.writeGenericValue(fields);
  out.writeOptionalWriteable(valueType);
  out.writeOptionalString(format);
  out.writeMap(missingMap);
  innerWriteTo(out);
}
 
Example 5
Source File: TermVectorsRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeString(type);
    out.writeString(id);

    out.writeBoolean(doc != null);
    if (doc != null) {
        out.writeBytesReference(doc);
    }
    out.writeOptionalString(routing);
    out.writeOptionalString(preference);
    long longFlags = 0;
    for (Flag flag : flagsEnum) {
        longFlags |= (1 << flag.ordinal());
    }
    out.writeVLong(longFlags);
    if (selectedFields != null) {
        out.writeVInt(selectedFields.size());
        for (String selectedField : selectedFields) {
            out.writeString(selectedField);
        }
    } else {
        out.writeVInt(0);
    }
    out.writeBoolean(perFieldAnalyzer != null);
    if (perFieldAnalyzer != null) {
        out.writeGenericValue(perFieldAnalyzer);
    }
    out.writeBoolean(filterSettings != null);
    if (filterSettings != null) {
        filterSettings.writeTo(out);
    }
    out.writeBoolean(realtime());
    out.writeByte(versionType.getValue());
    out.writeLong(version);
}
 
Example 6
Source File: AnalyzeResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(term);
    out.writeInt(startOffset);
    out.writeInt(endOffset);
    out.writeVInt(position);
    out.writeOptionalString(type);
    if (out.getVersion().onOrAfter(Version.V_2_2_0)) {
        out.writeGenericValue(attributes);
    }
}
 
Example 7
Source File: Lucene.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private static void writeMissingValue(StreamOutput out, Object missingValue) throws IOException {
    if (missingValue == SortField.STRING_FIRST) {
        out.writeByte((byte) 1);
    } else if (missingValue == SortField.STRING_LAST) {
        out.writeByte((byte) 2);
    } else {
        out.writeByte((byte) 0);
        out.writeGenericValue(missingValue);
    }
}
 
Example 8
Source File: GetField.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(name);
    out.writeVInt(values.size());
    for (Object obj : values) {
        out.writeGenericValue(obj);
    }
}
 
Example 9
Source File: InternalSearchHitField.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(name);
    out.writeVInt(values.size());
    for (Object value : values) {
        out.writeGenericValue(value);
    }
}
 
Example 10
Source File: BucketScriptPipelineAggregator.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
    script.writeTo(out);
    ValueFormatterStreams.writeOptional(formatter, out);
    gapPolicy.writeTo(out);
    out.writeGenericValue(bucketsPathsMap);
}
 
Example 11
Source File: UncheckedObjectType.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeValueTo(StreamOutput out, Map<Object, Object> v) throws IOException {
    if (v == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        out.writeInt(v.size());
        for (Map.Entry<Object, Object> entry : v.entrySet()) {
            out.writeGenericValue(entry.getKey());
            out.writeGenericValue(entry.getValue());
        }
    }
}
 
Example 12
Source File: InternalScriptedMetric.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
    boolean hasScript = reduceScript != null;
    out.writeBoolean(hasScript);
    if (hasScript) {
        reduceScript.writeTo(out);
    }
    out.writeGenericValue(aggregation);
}
 
Example 13
Source File: SQLRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);

    out.writeVInt(args.length);
    for (int i = 0; i < args.length; i++) {
        out.writeGenericValue(args[i]);
    }
}
 
Example 14
Source File: SQLBulkRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);

    out.writeVInt(bulkArgs.length);
    for (int i = 0, bulkArgsLength = bulkArgs.length; i < bulkArgsLength; i++) {
        Object[] bulkArg = bulkArgs[i];
        out.writeVInt(bulkArg.length);
        for (int i1 = 0, bulkArgLength = bulkArg.length; i1 < bulkArgLength; i1++) {
            out.writeGenericValue(bulkArg[i1]);
        }
    }
}
 
Example 15
Source File: SQLResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);

    out.writeBoolean(rowCount < 0);
    out.writeVLong(Math.abs(rowCount));
    out.writeInt(rows.length);
    for (Object[] row : rows) {
        for (int j = 0, len = cols().length; j < len; j++) {
            out.writeGenericValue(row[j]);
        }
    }
}
 
Example 16
Source File: UndefinedType.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValueTo(StreamOutput out, Object v) throws IOException {
    out.writeGenericValue(v);
}
 
Example 17
Source File: ObjectType.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValueTo(StreamOutput out, Object v) throws IOException {
    out.writeGenericValue(v);
}
 
Example 18
Source File: BucketSelectorPipelineAggregator.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
    script.writeTo(out);
    gapPolicy.writeTo(out);
    out.writeGenericValue(bucketsPathsMap);
}
 
Example 19
Source File: UndefinedType.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeValueTo(StreamOutput out, Object v) throws IOException {
    out.writeGenericValue(v);
}