当前位置: 首页>>代码示例>>Java>>正文


Java XContentBuilder.contentType方法代码示例

本文整理汇总了Java中org.elasticsearch.common.xcontent.XContentBuilder.contentType方法的典型用法代码示例。如果您正苦于以下问题:Java XContentBuilder.contentType方法的具体用法?Java XContentBuilder.contentType怎么用?Java XContentBuilder.contentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.xcontent.XContentBuilder的用法示例。


在下文中一共展示了XContentBuilder.contentType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Item

import org.elasticsearch.common.xcontent.XContentBuilder; //导入方法依赖的package包/类
/**
 * Constructor for an artificial document request, that is not present in the index.
 *
 * @param index the index to be used for parsing the doc
 * @param type the type to be used for parsing the doc
 * @param doc the document specification
 */
public Item(@Nullable String index, @Nullable String type, XContentBuilder doc) {
    if (doc == null) {
        throw new IllegalArgumentException("Item requires doc to be non-null");
    }
    this.index = index;
    this.type = type;
    this.doc = doc.bytes();
    this.xContentType = doc.contentType();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:MoreLikeThisQueryBuilder.java

示例2: scriptFieldToXContent

import org.elasticsearch.common.xcontent.XContentBuilder; //导入方法依赖的package包/类
@Override
protected XContentBuilder scriptFieldToXContent(String template, ScriptType type, XContentBuilder builder, Params builderParams)
        throws IOException {
    if (type == ScriptType.INLINE && contentType != null && builder.contentType() == contentType) {
        builder.rawField(type.getParseField().getPreferredName(), new BytesArray(template));
    } else {
        builder.field(type.getParseField().getPreferredName(), template);
    }
    return builder;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:Template.java

示例3: 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.field(type);
    internalXContent(builder, params);

    if (aggregations != null || aggregationsBinary != null) {

        if (aggregations != null) {
            builder.startObject("aggregations");
            for (AbstractAggregationBuilder subAgg : aggregations) {
                subAgg.toXContent(builder, params);
            }
            builder.endObject();
        }

        if (aggregationsBinary != null) {
            if (XContentFactory.xContentType(aggregationsBinary) == builder.contentType()) {
                builder.rawField("aggregations", aggregationsBinary);
            } else {
                builder.field("aggregations_binary", aggregationsBinary);
            }
        }

    }

    return builder.endObject();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:33,代码来源:AggregationBuilder.java

示例4: innerToXContent

import org.elasticsearch.common.xcontent.XContentBuilder; //导入方法依赖的package包/类
public void innerToXContent(XContentBuilder builder, Params params) throws IOException {
    if (queryBuilder != null) {
        builder.field("query");
        queryBuilder.toXContent(builder, params);
    }

    if (queryBinary != null) {
        if (XContentFactory.xContentType(queryBinary) == builder.contentType()) {
            builder.rawField("query", queryBinary);
        } else {
            builder.field("query_binary", queryBinary);
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:QuerySourceBuilder.java


注:本文中的org.elasticsearch.common.xcontent.XContentBuilder.contentType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。