当前位置: 首页>>代码示例>>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;未经允许,请勿转载。