當前位置: 首頁>>代碼示例>>Java>>正文


Java ToXContent.Params方法代碼示例

本文整理匯總了Java中org.elasticsearch.common.xcontent.ToXContent.Params方法的典型用法代碼示例。如果您正苦於以下問題:Java ToXContent.Params方法的具體用法?Java ToXContent.Params怎麽用?Java ToXContent.Params使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.common.xcontent.ToXContent的用法示例。


在下文中一共展示了ToXContent.Params方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startObject();
    builder.startArray(Fields.RESPONSES);
    for (Item item : items) {
        if (item.isFailure()) {
            builder.startObject();
            ElasticsearchException.generateFailureXContent(builder, params, item.getFailure(), true);
            builder.endObject();
        } else {
            item.getResponse().toXContent(builder, params);
        }
    }
    builder.endArray();
    builder.endObject();
    return builder;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:18,代碼來源:MultiSearchTemplateResponse.java

示例2: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startObject(Fields.INDEXING);
    totalStats.toXContent(builder, params);
    if (typeStats != null && !typeStats.isEmpty()) {
        builder.startObject(Fields.TYPES);
        for (Map.Entry<String, Stats> entry : typeStats.entrySet()) {
            builder.startObject(entry.getKey(), XContentBuilder.FieldCaseConversion.NONE);
            entry.getValue().toXContent(builder, params);
            builder.endObject();
        }
        builder.endObject();
    }
    builder.endObject();
    return builder;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:17,代碼來源:IndexingStats.java

示例3: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startObject(Fields.SEARCH);
    builder.field(Fields.OPEN_CONTEXTS, openContexts);
    totalStats.toXContent(builder, params);
    if (groupStats != null && !groupStats.isEmpty()) {
        builder.startObject(Fields.GROUPS);
        for (Map.Entry<String, Stats> entry : groupStats.entrySet()) {
            builder.startObject(entry.getKey(), XContentBuilder.FieldCaseConversion.NONE);
            entry.getValue().toXContent(builder, params);
            builder.endObject();
        }
        builder.endObject();
    }
    builder.endObject();
    return builder;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:18,代碼來源:SearchStats.java

示例4: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
public static void toXContent(UserProperty userProperty, XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startObject(userProperty.usernameWithTenant, XContentBuilder.FieldCaseConversion.NONE);
    builder.field("password", userProperty.password);
    {
        builder.startObject("db_privileges");
        for (String dbName : userProperty.dbPrivileges.keySet()) {
            builder.array(dbName, userProperty.dbPrivileges.get(dbName).toArray());
        }
        builder.endObject();

        builder.startObject("table_privileges");
        for (String tableName : userProperty.tablePrivileges.keySet()) {
            builder.array(tableName, userProperty.tablePrivileges.get(tableName).toArray());
        }
        builder.endObject();
    }
    builder.array("ip_whitelist", userProperty.ipWhiteList.toArray());
    builder.array("hostname_whitelist", userProperty.hostnameWhiteList.toArray());
    builder.array("hostip_whitelist", userProperty.hostIpWhiteList.toArray());
    builder.endObject();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:22,代碼來源:UserProperty.java

示例5: doXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的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();
}
 
開發者ID:mware-solutions,項目名稱:memory-graph,代碼行數:14,代碼來源:MemgraphQueryStringQueryBuilder.java

示例6: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startArray("snapshots");
    for (Entry entry : entries) {
        toXContent(entry, builder, params);
    }
    builder.endArray();
    return builder;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:13,代碼來源:RestoreInProgress.java

示例7: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    for (RepositoryMetaData repository : repositories) {
        toXContent(repository, builder, params);
    }
    return builder;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:11,代碼來源:RepositoriesMetaData.java

示例8: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    if (restoreInfo != null) {
        builder.field(Fields.SNAPSHOT);
        restoreInfo.toXContent(builder, params);
    } else {
        builder.field(Fields.ACCEPTED, true);
    }
    return builder;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:11,代碼來源:RestoreSnapshotResponse.java

示例9: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
public void toXContent(Entry entry, XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startObject();
    builder.field(REPOSITORY, entry.snapshot().getRepository());
    builder.field(SNAPSHOT, entry.snapshot().getSnapshotId().getName());
    builder.field(UUID, entry.snapshot().getSnapshotId().getUUID());
    builder.field(INCLUDE_GLOBAL_STATE, entry.includeGlobalState());
    builder.field(PARTIAL, entry.partial());
    builder.field(STATE, entry.state());
    builder.startArray(INDICES);
    {
        for (IndexId index : entry.indices()) {
            index.toXContent(builder, params);
        }
    }
    builder.endArray();
    builder.timeValueField(START_TIME_MILLIS, START_TIME, entry.startTime());
    builder.field(REPOSITORY_STATE_ID, entry.getRepositoryStateId());
    builder.startArray(SHARDS);
    {
        for (ObjectObjectCursor<ShardId, ShardSnapshotStatus> shardEntry : entry.shards) {
            ShardId shardId = shardEntry.key;
            ShardSnapshotStatus status = shardEntry.value;
            builder.startObject();
            {
                builder.field(INDEX, shardId.getIndex());
                builder.field(SHARD, shardId.getId());
                builder.field(STATE, status.state());
                builder.field(NODE, status.nodeId());
            }
            builder.endObject();
        }
    }
    builder.endArray();
    builder.endObject();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:36,代碼來源:SnapshotsInProgress.java

示例10: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
@Override
public void toXContent(AllocateAllocationCommand command, XContentBuilder builder, ToXContent.Params params, String objectName) throws IOException {
    if (objectName == null) {
        builder.startObject();
    } else {
        builder.startObject(objectName);
    }
    builder.field("index", command.shardId().index().name());
    builder.field("shard", command.shardId().id());
    builder.field("node", command.node());
    builder.field("allow_primary", command.allowPrimary());
    builder.endObject();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:14,代碼來源:AllocateAllocationCommand.java

示例11: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startObject();
    if (restoreInfo != null) {
        builder.field("snapshot");
        restoreInfo.toXContent(builder, params);
    } else {
        builder.field("accepted", true);
    }
    builder.endObject();
    return builder;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:13,代碼來源:RestoreSnapshotResponse.java

示例12: doXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
@Override
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
    if (dynamicDateTimeFormatters != Defaults.DYNAMIC_DATE_TIME_FORMATTERS) {
        if (dynamicDateTimeFormatters.length > 0) {
            builder.startArray("dynamic_date_formats");
            for (FormatDateTimeFormatter dateTimeFormatter : dynamicDateTimeFormatters) {
                builder.value(dateTimeFormatter.format());
            }
            builder.endArray();
        }
    }

    if (dynamicTemplates != null && dynamicTemplates.length > 0) {
        builder.startArray("dynamic_templates");
        for (DynamicTemplate dynamicTemplate : dynamicTemplates) {
            builder.startObject();
            builder.field(dynamicTemplate.name());
            builder.map(dynamicTemplate.conf());
            builder.endObject();
        }
        builder.endArray();
    }

    if (dateDetection != Defaults.DATE_DETECTION) {
        builder.field("date_detection", dateDetection);
    }
    if (numericDetection != Defaults.NUMERIC_DETECTION) {
        builder.field("numeric_detection", numericDetection);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:31,代碼來源:RootObjectMapper.java

示例13: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
@Override
public void toXContent(CancelAllocationCommand command, XContentBuilder builder, ToXContent.Params params, String objectName) throws IOException {
    if (objectName == null) {
        builder.startObject();
    } else {
        builder.startObject(objectName);
    }
    builder.field("index", command.shardId().index().name());
    builder.field("shard", command.shardId().id());
    builder.field("node", command.node());
    builder.field("allow_primary", command.allowPrimary());
    builder.endObject();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:14,代碼來源:CancelAllocationCommand.java

示例14: testInvalidLevel

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
public void testInvalidLevel() {
    final NodeIndicesStats stats = new NodeIndicesStats();
    final String level = randomAsciiOfLength(16);
    final ToXContent.Params params = new ToXContent.MapParams(Collections.singletonMap("level", level));
    final IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> stats.toXContent(null, params));
    assertThat(
        e,
        hasToString(containsString("level parameter must be one of [indices] or [node] or [shards] but was [" + level + "]")));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:10,代碼來源:NodeIndicesStatsTests.java

示例15: toXContent

import org.elasticsearch.common.xcontent.ToXContent; //導入方法依賴的package包/類
public static void toXContent(TenantMetadata tenantMetadata, XContentBuilder builder, ToXContent.Params params) throws IOException {
    builder.startObject("tenants");
        builder.field("max_tenant_id", tenantMetadata.maxTenantId);
        builder.startObject("tenant_list");
            for (Long tenantId : tenantMetadata.tenantProperties.keySet()) {
                TenantProperty.Builder.toXContent(tenantMetadata.tenantProperties.get(tenantId), builder, params);
            }
        builder.endObject();
    builder.endObject();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:11,代碼來源:TenantMetadata.java


注:本文中的org.elasticsearch.common.xcontent.ToXContent.Params方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。