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

The following examples show how to use org.elasticsearch.common.io.stream.StreamOutput#writeOptionalString() . 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: JvmInfo.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeLong(pid);
    out.writeString(version);
    out.writeString(vmName);
    out.writeString(vmVersion);
    out.writeString(vmVendor);
    out.writeLong(startTime);
    out.writeInt(inputArguments.length);
    for (String inputArgument : inputArguments) {
        out.writeString(inputArgument);
    }
    out.writeString(bootClassPath);
    out.writeString(classPath);
    out.writeInt(systemProperties.size());
    for (Map.Entry<String, String> entry : systemProperties.entrySet()) {
        out.writeString(entry.getKey());
        out.writeString(entry.getValue());
    }
    mem.writeTo(out);
    out.writeStringArray(gcCollectors);
    out.writeStringArray(memoryPools);
    if (out.getVersion().onOrAfter(Version.V_2_2_0)) {
        out.writeOptionalString(useCompressedOops);
    }
}
 
Example 2
Source File: MultiGetRequest.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalString(preference);
    out.writeBoolean(refresh);
    if (realtime == null) {
        out.writeByte((byte) -1);
    } else if (realtime == false) {
        out.writeByte((byte) 0);
    } else {
        out.writeByte((byte) 1);
    }
    out.writeBoolean(ignoreErrorsOnGeneratedFields);

    out.writeVInt(items.size());
    for (Item item : items) {
        item.writeTo(out);
    }
}
 
Example 3
Source File: ExtendedAnalyzeRequest.java    From elasticsearch-extended-analyze with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeStringArray(text);
    out.writeOptionalString(analyzer);
    out.writeOptionalString(tokenizer);
    if (tokenFilters == null) {
        out.writeVInt(0);
    } else {
        out.writeVInt(tokenFilters.length);
        for (String tokenFilter : tokenFilters) {
            out.writeString(tokenFilter);
        }
    }
    out.writeOptionalString(field);
    out.writeBoolean(shortAttributeName);
    if (attributes == null) {
        out.writeVInt(0);
    } else {
        out.writeVInt(attributes.length);
        for (String attribute : attributes) {
            out.writeString(attribute);
        }
    }
}
 
Example 4
Source File: ShardExportResponse.java    From elasticsearch-inout-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalString(cmd);
    if (cmdArray == null) {
        out.writeStringArrayNullable(null);
    } else {
        out.writeStringArray(cmdArray.toArray(new String[cmdArray.size()]));
    }

    out.writeOptionalString(file);
    out.writeOptionalString(stderr);
    out.writeOptionalString(stdout);
    out.writeVInt(exitCode);
    out.writeVLong(numExported);
    out.writeOptionalText(node);
    out.writeBoolean(dryRun);
}
 
Example 5
Source File: SearchRequest.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.writeByte(searchType.id());

    out.writeVInt(indices.length);
    for (String index : indices) {
        out.writeString(index);
    }

    out.writeOptionalString(routing);
    out.writeOptionalString(preference);

    if (scroll == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        scroll.writeTo(out);
    }
    out.writeBytesReference(source);
    out.writeBytesReference(extraSource);
    out.writeStringArray(types);
    indicesOptions.writeIndicesOptions(out);

    out.writeBytesReference(templateSource);
    boolean hasTemplate = template != null;
    out.writeBoolean(hasTemplate);
    if (hasTemplate) {
        template.writeTo(out);
    }

    out.writeOptionalBoolean(requestCache);
}
 
Example 6
Source File: IndexReference.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalString(analyzer);
    out.writeVInt(columns.size());
    for (Reference reference : columns) {
        Reference.toStream(reference, out);
    }
}
 
Example 7
Source File: StoreFileMetaData.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.writeVLong(length);
    out.writeOptionalString(checksum);
    out.writeOptionalString(writtenBy == null ? null : writtenBy.toString());
    out.writeBytesRef(hash);
}
 
Example 8
Source File: AliasAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeByte(actionType.value());
    out.writeOptionalString(index);
    out.writeOptionalString(alias);
    out.writeOptionalString(filter);
    out.writeOptionalString(indexRouting);
    out.writeOptionalString(searchRouting);
}
 
Example 9
Source File: SearchPhaseExecutionException.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.writeOptionalString(phaseName);
    out.writeVInt(shardFailures == null ? 0 : shardFailures.length);
    if (shardFailures != null) {
        for (ShardSearchFailure failure : shardFailures) {
            failure.writeTo(out);
        }
    }
}
 
Example 10
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 11
Source File: MappingMetaData.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(type());
    source().writeTo(out);
    // id
    if (id().hasPath()) {
        out.writeBoolean(true);
        out.writeString(id().path());
    } else {
        out.writeBoolean(false);
    }
    // routing
    out.writeBoolean(routing().required());
    if (routing().hasPath()) {
        out.writeBoolean(true);
        out.writeString(routing().path());
    } else {
        out.writeBoolean(false);
    }
    // timestamp
    out.writeBoolean(timestamp().enabled());
    out.writeOptionalString(timestamp().path());
    out.writeString(timestamp().format());
    out.writeOptionalString(timestamp().defaultTimestamp());
    out.writeOptionalBoolean(timestamp().ignoreMissing());
    out.writeBoolean(hasParentField());
    // mappingVersion
    out.writeLong(mappingVersion());

    if (version().hasPath()) {
        out.writeBoolean(true);
        out.writeString(version().path());
        out.writeByte(version().versionType().getValue());
    } else {
        out.writeBoolean(false);
    }
}
 
Example 12
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 13
Source File: ElasticsearchException.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeOptionalString(this.getMessage());
    out.writeException(this.getCause());
    writeStackTraces(this, out);
    out.writeMapOfLists(headers, StreamOutput::writeString, StreamOutput::writeString);
    out.writeMapOfLists(metadata, StreamOutput::writeString, StreamOutput::writeString);
}
 
Example 14
Source File: ImportRequest.java    From elasticsearch-inout-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalString(index);
    out.writeOptionalString(type);
    out.writeBytesReference(source);
}
 
Example 15
Source File: StoredLtrQueryBuilder.java    From elasticsearch-learning-to-rank with Apache License 2.0 5 votes vote down vote up
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
    out.writeOptionalString(modelName);
    out.writeOptionalString(featureSetName);
    out.writeMap(params);
    if (out.getVersion().onOrAfter(Version.V_6_2_4)) {
        out.writeOptionalStringArray(activeFeatures != null ? activeFeatures.toArray(new String[0]) : null);
    }
    out.writeOptionalString(storeName);
}
 
Example 16
Source File: SnapshotIndexShardStatus.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.writeByte(stage.value());
    stats.writeTo(out);
    out.writeOptionalString(nodeId);
    out.writeOptionalString(failure);
}
 
Example 17
Source File: AllocationId.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(this.id);
    out.writeOptionalString(this.relocationId);
}
 
Example 18
Source File: LangdetectRequest.java    From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeString(text);
    out.writeOptionalString(profile);
}
 
Example 19
Source File: TimestampParsingException.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeOptionalString(timestamp);
}
 
Example 20
Source File: UpdateRequest.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeByte(consistencyLevel.id());
    out.writeString(type);
    out.writeString(id);
    out.writeOptionalString(routing);
    out.writeOptionalString(parent);
    boolean hasScript = script != null;
    out.writeBoolean(hasScript);
    if (hasScript) {
        script.writeTo(out);
    }
    out.writeVInt(retryOnConflict);
    out.writeBoolean(refresh);
    if (doc == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        // make sure the basics are set
        doc.index(index);
        doc.type(type);
        doc.id(id);
        doc.writeTo(out);
    }
    if (fields == null) {
        out.writeInt(-1);
    } else {
        out.writeInt(fields.length);
        for (String field : fields) {
            out.writeString(field);
        }
    }
    if (upsertRequest == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        // make sure the basics are set
        upsertRequest.index(index);
        upsertRequest.type(type);
        upsertRequest.id(id);
        upsertRequest.writeTo(out);
    }
    out.writeBoolean(docAsUpsert);
    out.writeLong(version);
    out.writeByte(versionType.getValue());
    out.writeBoolean(detectNoop);
    out.writeBoolean(scriptedUpsert);
}