本文整理匯總了Java中org.elasticsearch.common.xcontent.XContentBuilder.value方法的典型用法代碼示例。如果您正苦於以下問題:Java XContentBuilder.value方法的具體用法?Java XContentBuilder.value怎麽用?Java XContentBuilder.value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.elasticsearch.common.xcontent.XContentBuilder
的用法示例。
在下文中一共展示了XContentBuilder.value方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Integer.toString(id));
builder.field("description", description);
builder.field("retryable", retryable);
if (disableStatePersistence) {
builder.field("disable_state_persistence", disableStatePersistence);
}
builder.startArray("levels");
for (ClusterBlockLevel level : levels) {
builder.value(level.name().toLowerCase(Locale.ROOT));
}
builder.endArray();
builder.endObject();
return builder;
}
示例2: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public final XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(getName());
if (this.metaData != null) {
builder.field("meta", this.metaData);
}
builder.startObject(type);
if (!overrideBucketsPath() && bucketsPaths != null) {
builder.startArray(PipelineAggregator.Parser.BUCKETS_PATH.getPreferredName());
for (String path : bucketsPaths) {
builder.value(path);
}
builder.endArray();
}
internalXContent(builder, params);
builder.endObject();
return builder.endObject();
}
示例3: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
public void toXContent(String preferredName, XContentBuilder builder) throws IOException {
if (fetchFields == false) {
builder.field(preferredName, _NONE_);
}
if (fieldNames != null) {
if (fieldNames.size() == 1) {
builder.field(preferredName, fieldNames.get(0));
} else {
builder.startArray(preferredName);
for (String fieldName : fieldNames) {
builder.value(fieldName);
}
builder.endArray();
}
}
}
示例4: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
public static void toXContent(Entry entry, XContentBuilder builder, ToXContent.Params params) throws IOException {
boolean binary = params.paramAsBoolean("binary", false);
builder.startObject(entry.name(), XContentBuilder.FieldCaseConversion.NONE);
builder.field("types", entry.types());
if (entry.requestCache() != null) {
builder.field("requestCache", entry.requestCache());
}
builder.field("source");
if (binary) {
builder.value(entry.source());
} else {
Map<String, Object> mapping;
try (XContentParser parser = XContentFactory.xContent(entry.source()).createParser(entry.source())) {
mapping = parser.mapOrdered();
}
builder.map(mapping);
}
builder.endObject();
}
示例5: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
writeSharedAttributes(builder);
builder.startArray(Fields.ROWS);
if (rows != null) {
for (Object[] row : rows) {
builder.startArray();
for (int j = 0, len = cols().length; j < len; j++) {
builder.value(row[j]);
}
builder.endArray();
}
}
builder.endArray();
builder.field(Fields.ROWCOUNT, rowCount());
builder.endObject();
return builder;
}
示例6: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public final XContentBuilder toXContent(XContentBuilder builder, Params builderParams) throws IOException {
if (type == null) {
return builder.value(script);
}
builder.startObject();
scriptFieldToXContent(script, type, builder, builderParams);
if (lang != null) {
builder.field(ScriptField.LANG.getPreferredName(), lang);
}
if (params != null) {
builder.field(ScriptField.PARAMS.getPreferredName(), params);
}
builder.endObject();
return builder;
}
示例7: doXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject("memgraph_query_string");
super.doXContent(builder, params);
builder.startArray("authorizations");
for (String authorization : authorizations.getAuthorizations()) {
builder.value(authorization);
}
builder.endArray();
builder.endObject();
}
示例8: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field("snapshot", name);
builder.field(Fields.VERSION_ID, version.id);
builder.field(Fields.VERSION, version.toString());
builder.startArray(Fields.INDICES);
for (String index : indices) {
builder.value(index);
}
builder.endArray();
builder.field(Fields.STATE, state);
if (reason != null) {
builder.field(Fields.REASON, reason);
}
if (startTime != 0) {
builder.field(Fields.START_TIME, DATE_TIME_FORMATTER.printer().print(startTime));
builder.field(Fields.START_TIME_IN_MILLIS, startTime);
}
if (endTime != 0) {
builder.field(Fields.END_TIME, DATE_TIME_FORMATTER.printer().print(endTime));
builder.field(Fields.END_TIME_IN_MILLIS, endTime);
builder.timeValueField(Fields.DURATION_IN_MILLIS, Fields.DURATION, endTime - startTime);
}
builder.startArray(Fields.FAILURES);
for (SnapshotShardFailure shardFailure : shardFailures) {
builder.startObject();
shardFailure.toXContent(builder, params);
builder.endObject();
}
builder.endArray();
builder.startObject(Fields.SHARDS);
builder.field(Fields.TOTAL, totalShards);
builder.field(Fields.FAILED, failedShards());
builder.field(Fields.SUCCESSFUL, successfulShards);
builder.endObject();
builder.endObject();
return builder;
}
示例9: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
/**
* Serializes single restore operation
*
* @param entry restore operation metadata
* @param builder XContent builder
* @param params serialization parameters
*/
public void toXContent(Entry entry, XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject();
builder.field("snapshot", entry.snapshotId().getSnapshot());
builder.field("repository", entry.snapshotId().getRepository());
builder.field("state", entry.state());
builder.startArray("indices");
{
for (String index : entry.indices()) {
builder.value(index);
}
}
builder.endArray();
builder.startArray("shards");
{
for (Map.Entry<ShardId, ShardRestoreStatus> shardEntry : entry.shards.entrySet()) {
ShardId shardId = shardEntry.getKey();
ShardRestoreStatus status = shardEntry.getValue();
builder.startObject();
{
builder.field("index", shardId.getIndex());
builder.field("shard", shardId.getId());
builder.field("state", status.state());
}
builder.endObject();
}
}
builder.endArray();
builder.endObject();
}
示例10: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
if (fetchSource) {
builder.startObject();
builder.array(INCLUDES_FIELD.getPreferredName(), includes);
builder.array(EXCLUDES_FIELD.getPreferredName(), excludes);
builder.endObject();
} else {
builder.value(false);
}
return builder;
}
示例11: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.startObject(NAME);
builder.startArray(fieldName);
for (GeoPoint point : points) {
builder.value(point);
}
builder.endArray();
builder.field(UNIT_FIELD.getPreferredName(), unit);
builder.field(DISTANCE_TYPE_FIELD.getPreferredName(), geoDistance.name().toLowerCase(Locale.ROOT));
builder.field(ORDER_FIELD.getPreferredName(), order);
if (sortMode != null) {
builder.field(SORTMODE_FIELD.getPreferredName(), sortMode);
}
if (nestedPath != null) {
builder.field(NESTED_PATH_FIELD.getPreferredName(), nestedPath);
}
if (nestedFilter != null) {
builder.field(NESTED_FILTER_FIELD.getPreferredName(), nestedFilter, params);
}
builder.field(VALIDATION_METHOD_FIELD.getPreferredName(), validation);
builder.endObject();
builder.endObject();
return builder;
}
示例12: doXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
public void doXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(NAME);
builder.field(QUERY_FIELD.getPreferredName(), value);
builder.startArray(FIELDS_FIELD.getPreferredName());
for (Map.Entry<String, Float> fieldEntry : this.fieldsBoosts.entrySet()) {
builder.value(fieldEntry.getKey() + "^" + fieldEntry.getValue());
}
builder.endArray();
builder.field(TYPE_FIELD.getPreferredName(), type.toString().toLowerCase(Locale.ENGLISH));
builder.field(OPERATOR_FIELD.getPreferredName(), operator.toString());
if (analyzer != null) {
builder.field(ANALYZER_FIELD.getPreferredName(), analyzer);
}
builder.field(SLOP_FIELD.getPreferredName(), slop);
if (fuzziness != null) {
fuzziness.toXContent(builder, params);
}
builder.field(PREFIX_LENGTH_FIELD.getPreferredName(), prefixLength);
builder.field(MAX_EXPANSIONS_FIELD.getPreferredName(), maxExpansions);
if (minimumShouldMatch != null) {
builder.field(MINIMUM_SHOULD_MATCH_FIELD.getPreferredName(), minimumShouldMatch);
}
if (fuzzyRewrite != null) {
builder.field(FUZZY_REWRITE_FIELD.getPreferredName(), fuzzyRewrite);
}
if (useDisMax != null) {
builder.field(USE_DIS_MAX_FIELD.getPreferredName(), useDisMax);
}
if (tieBreaker != null) {
builder.field(TIE_BREAKER_FIELD.getPreferredName(), tieBreaker);
}
builder.field(LENIENT_FIELD.getPreferredName(), lenient);
if (cutoffFrequency != null) {
builder.field(CUTOFF_FREQUENCY_FIELD.getPreferredName(), cutoffFrequency);
}
builder.field(ZERO_TERMS_QUERY_FIELD.getPreferredName(), zeroTermsQuery.toString());
printBoostAndQueryName(builder);
builder.endObject();
}
示例13: doXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
@Override
protected void doXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(NAME);
builder.array(TYPE_FIELD.getPreferredName(), types);
builder.startArray(VALUES_FIELD.getPreferredName());
for (String value : ids) {
builder.value(value);
}
builder.endArray();
printBoostAndQueryName(builder);
builder.endObject();
}
示例14: toXContentNestedDataType
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
private static void toXContentNestedDataType(XContentBuilder builder, DataType dataType) throws IOException {
if (dataType instanceof CollectionType) {
builder.startArray();
builder.value(dataType.id());
toXContentNestedDataType(builder, ((CollectionType) dataType).innerType());
builder.endArray();
} else {
builder.value(dataType.id());
}
}
示例15: toXContent
import org.elasticsearch.common.xcontent.XContentBuilder; //導入方法依賴的package包/類
/**
* Writes index file for the shard in the following format.
* <pre>
* <code>
* {
* "files": [{
* "name": "__3",
* "physical_name": "_0.si",
* "length": 310,
* "checksum": "1tpsg3p",
* "written_by": "5.1.0",
* "meta_hash": "P9dsFxNMdWNlb......"
* }, {
* "name": "__2",
* "physical_name": "segments_2",
* "length": 150,
* "checksum": "11qjpz6",
* "written_by": "5.1.0",
* "meta_hash": "P9dsFwhzZWdtZ......."
* }, {
* "name": "__1",
* "physical_name": "_0.cfe",
* "length": 363,
* "checksum": "er9r9g",
* "written_by": "5.1.0"
* }, {
* "name": "__0",
* "physical_name": "_0.cfs",
* "length": 3354,
* "checksum": "491liz",
* "written_by": "5.1.0"
* }, {
* "name": "__4",
* "physical_name": "segments_3",
* "length": 150,
* "checksum": "134567",
* "written_by": "5.1.0",
* "meta_hash": "P9dsFwhzZWdtZ......."
* }],
* "snapshots": {
* "snapshot_1": {
* "files": ["__0", "__1", "__2", "__3"]
* },
* "snapshot_2": {
* "files": ["__0", "__1", "__2", "__4"]
* }
* }
* }
* }
* </code>
* </pre>
*/
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
// First we list all blobs with their file infos:
builder.startArray(Fields.FILES);
for (Map.Entry<String, FileInfo> entry : files.entrySet()) {
FileInfo.toXContent(entry.getValue(), builder, params);
}
builder.endArray();
// Then we list all snapshots with list of all blobs that are used by the snapshot
builder.startObject(Fields.SNAPSHOTS);
for (SnapshotFiles snapshot : shardSnapshots) {
builder.startObject(snapshot.snapshot(), XContentBuilder.FieldCaseConversion.NONE);
builder.startArray(Fields.FILES);
for (FileInfo fileInfo : snapshot.indexFiles()) {
builder.value(fileInfo.name());
}
builder.endArray();
builder.endObject();
}
builder.endObject();
return builder;
}