• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java InternalSingleBucketAggregation类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation的典型用法代码示例。如果您正苦于以下问题:Java InternalSingleBucketAggregation类的具体用法?Java InternalSingleBucketAggregation怎么用?Java InternalSingleBucketAggregation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

InternalSingleBucketAggregation类属于org.elasticsearch.search.aggregations.bucket包,在下文中一共展示了InternalSingleBucketAggregation类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildAggResponseMessage

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
private InterpreterResult buildAggResponseMessage(Aggregations aggregations) {

    // Only the result of the first aggregation is returned
    //
    final Aggregation agg = aggregations.asList().get(0);
    InterpreterResult.Type resType = InterpreterResult.Type.TEXT;
    String resMsg = "";

    if (agg instanceof InternalMetricsAggregation) {
      resMsg = XContentHelper.toString((InternalMetricsAggregation) agg).toString();
    }
    else if (agg instanceof InternalSingleBucketAggregation) {
      resMsg = XContentHelper.toString((InternalSingleBucketAggregation) agg).toString();
    }
    else if (agg instanceof InternalMultiBucketAggregation) {
      final StringBuffer buffer = new StringBuffer("key\tdoc_count");

      final InternalMultiBucketAggregation multiBucketAgg = (InternalMultiBucketAggregation) agg;
      for (MultiBucketsAggregation.Bucket bucket : multiBucketAgg.getBuckets()) {
        buffer.append("\n")
          .append(bucket.getKeyAsString())
          .append("\t")
          .append(bucket.getDocCount());
      }

      resType = InterpreterResult.Type.TABLE;
      resMsg = buffer.toString();
    }

    return new InterpreterResult(InterpreterResult.Code.SUCCESS, resType, resMsg);
  }
 

开发者ID:lorthos,
项目名称:incubator-zeppelin-druid,
代码行数:32,
代码来源:ElasticsearchInterpreter.java

示例2: setAggregations

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
private void setAggregations(Aggregations aggregations, ActionResponse actionResp) {
  // Only the result of the first aggregation is returned
  //
  final Aggregation agg = aggregations.asList().get(0);

  if (agg instanceof InternalMetricsAggregation) {
    actionResp.addAggregation(new AggWrapper(AggWrapper.AggregationType.SIMPLE,
        XContentHelper.toString((InternalMetricsAggregation) agg).toString()));
  }
  else if (agg instanceof InternalSingleBucketAggregation) {
    actionResp.addAggregation(new AggWrapper(AggWrapper.AggregationType.SIMPLE,
        XContentHelper.toString((InternalSingleBucketAggregation) agg).toString()));
  }
  else if (agg instanceof InternalMultiBucketAggregation) {
    final Set<String> headerKeys = new HashSet<>();
    final List<Map<String, Object>> buckets = new LinkedList<>();
    final InternalMultiBucketAggregation multiBucketAgg = (InternalMultiBucketAggregation) agg;

    for (final MultiBucketsAggregation.Bucket bucket : multiBucketAgg.getBuckets()) {
      try {
        final XContentBuilder builder = XContentFactory.jsonBuilder();
        bucket.toXContent(builder, null);
        actionResp.addAggregation(
            new AggWrapper(AggWrapper.AggregationType.MULTI_BUCKETS, builder.string()));
      }
      catch (final IOException e) {
        // Ignored
      }
    }
  }
}
 

开发者ID:apache,
项目名称:zeppelin,
代码行数:32,
代码来源:TransportBasedClient.java

示例3: newAggregation

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
@Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
    return new InternalChildren(name, docCount, subAggregations, pipelineAggregators(), getMetaData());
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:InternalChildren.java

示例4: newAggregation

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
@Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
    return new InternalGlobal(name, docCount, subAggregations, pipelineAggregators(), getMetaData());
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:InternalGlobal.java

示例5: newAggregation

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
@Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount,
        InternalAggregations subAggregations) {
    return new InternalSampler(name, docCount, subAggregations, pipelineAggregators(), metaData);
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:6,
代码来源:InternalSampler.java

示例6: newAggregation

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
@Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
    return new InternalMissing(name, docCount, subAggregations, pipelineAggregators(), getMetaData());
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:InternalMissing.java

示例7: newAggregation

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
@Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
    return new InternalNested(name, docCount, subAggregations, pipelineAggregators(), getMetaData());
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:InternalNested.java

示例8: newAggregation

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
@Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
    return new InternalReverseNested(name, docCount, subAggregations, pipelineAggregators(), getMetaData());
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:InternalReverseNested.java

示例9: newAggregation

点赞 2

import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; //导入依赖的package包/类
@Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
    return new InternalFilter(name, docCount, subAggregations, pipelineAggregators(), getMetaData());
}
 

开发者ID:justor,
项目名称:elasticsearch_my,
代码行数:5,
代码来源:InternalFilter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)