• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ValueCount类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: groupByTest

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByTest() throws Exception {
	Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/account GROUP BY gender", TEST_INDEX));
	Terms gender = result.get("gender");
	for(Terms.Bucket bucket : gender.getBuckets()) {
		String key = bucket.getKey().toString();
		long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
		if(key.equalsIgnoreCase("m")) {
			Assert.assertEquals(507, count);
		}
		else if(key.equalsIgnoreCase("f")) {
			Assert.assertEquals(493, count);
		}
		else {
			throw new Exception(String.format("Unexpected key. expected: m OR f. found: %s", key));
		}
	}
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:19,代码来源:AggregationTest.java


示例2: groupByOnNestedFieldTest

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByOnNestedFieldTest() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY nested(message.info)", TEST_INDEX));
    InternalNested nested = result.get("[email protected]");
    Terms infos = nested.getAggregations().get("message.info");
    Assert.assertEquals(3,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        String key = bucket.getKey().toString();
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        if(key.equalsIgnoreCase("a")) {
            Assert.assertEquals(2, count);
        }
        else if(key.equalsIgnoreCase("c")) {
            Assert.assertEquals(2, count);
        }
        else if(key.equalsIgnoreCase("b")) {
            Assert.assertEquals(1, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: a OR b OR c . found: %s", key));
        }
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:24,代码来源:AggregationTest.java


示例3: groupByTestWithFilter

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByTestWithFilter() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/account GROUP BY filter(gender='m'),gender", TEST_INDEX));
    InternalFilter filter = result.get("filter(gender = 'm')@FILTER");
    Terms gender = filter.getAggregations().get("gender");

    for(Terms.Bucket bucket : gender.getBuckets()) {
        String key = bucket.getKey().toString();
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        if(key.equalsIgnoreCase("m")) {
            Assert.assertEquals(507, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: only m. found: %s", key));
        }
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:18,代码来源:AggregationTest.java


示例4: groupByOnNestedFieldWithFilterTest

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByOnNestedFieldWithFilterTest() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY  nested(message.info),filter('myFilter',message.info = 'a')", TEST_INDEX));
    InternalNested nested = result.get("[email protected]");
    InternalFilter filter = nested.getAggregations().get("[email protected]");
    Terms infos = filter.getAggregations().get("message.info");
    Assert.assertEquals(1,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        String key = bucket.getKey().toString();
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        if(key.equalsIgnoreCase("a")) {
            Assert.assertEquals(2, count);
        }

        else {
            throw new Exception(String.format("Unexpected key. expected: only a . found: %s", key));
        }
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:20,代码来源:AggregationTest.java


示例5: histogramOnNestedField

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void histogramOnNestedField() throws Exception {
    Aggregations result = query(String.format("select count(*) from %s/nestedType group by histogram('field'='message.dayOfWeek','nested'='message','interval'='2' , 'alias' = 'someAlias' )", TEST_INDEX));
    InternalNested nested  = result.get("[email protected]");
    Histogram histogram = nested.getAggregations().get("someAlias");
    for(Histogram.Bucket bucket : histogram.getBuckets()){
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        String key = ((Double)bucket.getKey()).intValue()+"";
        if(key.equals("0") || key.equals("4")){
            Assert.assertEquals(2,count);
        }
        else if (key.equals("2")){
            Assert.assertEquals(1,count);
        }
        else{
            Assert.assertTrue("only 0 2 4 keys are allowed got:" + key,false);
        }
    }


}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:22,代码来源:AggregationTest.java


示例6: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedAndEmptyPath

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedAndEmptyPath() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY  nested(message.info),filter('myFilter',message.info = 'a'),reverse_nested(someField,'')", TEST_INDEX));
    InternalNested nested = result.get("[email protected]");
    InternalFilter filter = nested.getAggregations().get("[email protected]");
    Terms infos = filter.getAggregations().get("message.info");
    Assert.assertEquals(1,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        InternalReverseNested reverseNested = bucket.getAggregations().get("[email protected]");
        Terms terms = reverseNested.getAggregations().get("someField");
        Terms.Bucket internalBucket = terms.getBuckets().get(0);

        long count = ((ValueCount) internalBucket.getAggregations().get("COUNT(*)")).getValue();
        String key = internalBucket.getKey().toString();
        if(key.equalsIgnoreCase("b")) {
            Assert.assertEquals(2, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: only a . found: %s", key));
        }
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:23,代码来源:AggregationTest.java


示例7: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY  nested(message.info),filter('myFilter',message.info = 'a'),reverse_nested(someField)", TEST_INDEX));
    InternalNested nested = result.get("[email protected]");
    InternalFilter filter = nested.getAggregations().get("[email protected]");
    Terms infos = filter.getAggregations().get("message.info");
    Assert.assertEquals(1,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        InternalReverseNested reverseNested = bucket.getAggregations().get("[email protected]");
        Terms terms = reverseNested.getAggregations().get("someField");
        Terms.Bucket internalBucket = terms.getBuckets().get(0);

        long count = ((ValueCount) internalBucket.getAggregations().get("COUNT(*)")).getValue();
        String key = internalBucket.getKey().toString();
        if(key.equalsIgnoreCase("b")) {
            Assert.assertEquals(2, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: only a . found: %s", key));
        }
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:23,代码来源:AggregationTest.java


示例8: reverseAnotherNestedGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void reverseAnotherNestedGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY  nested(message.info),filter('myFilter',message.info = 'a'),reverse_nested(comment.data,'~comment')", TEST_INDEX));
    InternalNested nested = result.get("[email protected]");
    InternalFilter filter = nested.getAggregations().get("[email protected]");
    Terms infos = filter.getAggregations().get("message.info");
    Assert.assertEquals(1,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        InternalReverseNested reverseNested = bucket.getAggregations().get("[email protected]_REVERSED");
        InternalNested innerNested = reverseNested.getAggregations().get("[email protected]");
        Terms terms = innerNested.getAggregations().get("comment.data");
        Terms.Bucket internalBucket = terms.getBuckets().get(0);

        long count = ((ValueCount) internalBucket.getAggregations().get("COUNT(*)")).getValue();
        String key = internalBucket.getKey().toString();
        if(key.equalsIgnoreCase("ab")) {
            Assert.assertEquals(2, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: only a . found: %s", key));
        }
    }
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:24,代码来源:AggregationTest.java


示例9: groupByTest

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByTest() throws Exception {
	Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/account GROUP BY gender", TestsConstants.TEST_INDEX));
	Terms gender = result.get("gender");
	for(Terms.Bucket bucket : gender.getBuckets()) {
		String key = bucket.getKey().toString();
		long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
		if(key.equalsIgnoreCase("m")) {
			Assert.assertEquals(507, count);
		}
		else if(key.equalsIgnoreCase("f")) {
			Assert.assertEquals(493, count);
		}
		else {
			throw new Exception(String.format("Unexpected key. expected: m OR f. found: %s", key));
		}
	}
}
 
开发者ID:selvakumarEsra,项目名称:es4sql,代码行数:19,代码来源:AggregationTest.java


示例10: groupByTest

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByTest() throws Exception {
	Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/account GROUP BY gender", TEST_INDEX_ACCOUNT));
	Terms gender = result.get("gender");
	for(Terms.Bucket bucket : gender.getBuckets()) {
		String key = bucket.getKey().toString();
		long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
		if(key.equalsIgnoreCase("m")) {
			Assert.assertEquals(507, count);
		}
		else if(key.equalsIgnoreCase("f")) {
			Assert.assertEquals(493, count);
		}
		else {
			throw new Exception(String.format("Unexpected key. expected: m OR f. found: %s", key));
		}
	}
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:19,代码来源:AggregationTest.java


示例11: postFilterTest

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void postFilterTest() throws Exception {
    SqlElasticSearchRequestBuilder select = getSearchRequestBuilder(String.format("SELECT /*! POST_FILTER({\"term\":{\"gender\":\"m\"}}) */ COUNT(*) FROM %s/account GROUP BY gender", TEST_INDEX_ACCOUNT));
    SearchResponse res = (SearchResponse) select.get();
    Assert.assertEquals(507, res.getHits().totalHits);

    Aggregations result = res.getAggregations();
    Terms gender = result.get("gender");
    for (Terms.Bucket bucket : gender.getBuckets()) {
        String key = bucket.getKey().toString();
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        if (key.equalsIgnoreCase("m")) {
            Assert.assertEquals(507, count);
        } else if (key.equalsIgnoreCase("f")) {
            Assert.assertEquals(493, count);
        } else {
            throw new Exception(String.format("Unexpected key. expected: m OR f. found: %s", key));
        }
    }
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:21,代码来源:AggregationTest.java


示例12: groupByOnNestedFieldTest

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByOnNestedFieldTest() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY nested(message.info)", TEST_INDEX_NESTED_TYPE));
    InternalNested nested = result.get("[email protected]");
    Terms infos = nested.getAggregations().get("message.info");
    Assert.assertEquals(3,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        String key = bucket.getKey().toString();
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        if(key.equalsIgnoreCase("a")) {
            Assert.assertEquals(2, count);
        }
        else if(key.equalsIgnoreCase("c")) {
            Assert.assertEquals(2, count);
        }
        else if(key.equalsIgnoreCase("b")) {
            Assert.assertEquals(1, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: a OR b OR c . found: %s", key));
        }
    }
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:24,代码来源:AggregationTest.java


示例13: groupByTestWithFilter

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByTestWithFilter() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/account GROUP BY filter(gender='m'),gender", TEST_INDEX_ACCOUNT));
    InternalFilter filter = result.get("filter(gender = 'm')@FILTER");
    Terms gender = filter.getAggregations().get("gender");

    for(Terms.Bucket bucket : gender.getBuckets()) {
        String key = bucket.getKey().toString();
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        if(key.equalsIgnoreCase("m")) {
            Assert.assertEquals(507, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: only m. found: %s", key));
        }
    }
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:18,代码来源:AggregationTest.java


示例14: groupByOnNestedFieldWithFilterTest

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void groupByOnNestedFieldWithFilterTest() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY  nested(message.info),filter('myFilter',message.info = 'a')", TEST_INDEX_NESTED_TYPE));
    InternalNested nested = result.get("[email protected]");
    InternalFilter filter = nested.getAggregations().get("[email protected]");
    Terms infos = filter.getAggregations().get("message.info");
    Assert.assertEquals(1,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        String key = bucket.getKey().toString();
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        if(key.equalsIgnoreCase("a")) {
            Assert.assertEquals(2, count);
        }

        else {
            throw new Exception(String.format("Unexpected key. expected: only a . found: %s", key));
        }
    }
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:20,代码来源:AggregationTest.java


示例15: histogramOnNestedField

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void histogramOnNestedField() throws Exception {
    Aggregations result = query(String.format("select count(*) from %s/nestedType group by histogram('field'='message.dayOfWeek','nested'='message','interval'='2' , 'alias' = 'someAlias' )", TEST_INDEX_NESTED_TYPE));
    InternalNested nested  = result.get("[email protected]");
    Histogram histogram = nested.getAggregations().get("someAlias");
    for(Histogram.Bucket bucket : histogram.getBuckets()){
        long count = ((ValueCount) bucket.getAggregations().get("COUNT(*)")).getValue();
        String key = ((Double)bucket.getKey()).intValue()+"";
        if(key.equals("0") || key.equals("4")){
            Assert.assertEquals(2,count);
        }
        else if (key.equals("2")){
            Assert.assertEquals(1,count);
        }
        else{
            Assert.assertTrue("only 0 2 4 keys are allowed got:" + key,false);
        }
    }


}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:22,代码来源:AggregationTest.java


示例16: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedAndEmptyPath

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedAndEmptyPath() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY  nested(message.info),filter('myFilter',message.info = 'a'),reverse_nested(someField,'')", TEST_INDEX_NESTED_TYPE));
    InternalNested nested = result.get("[email protected]");
    InternalFilter filter = nested.getAggregations().get("[email protected]");
    Terms infos = filter.getAggregations().get("message.info");
    Assert.assertEquals(1,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        InternalReverseNested reverseNested = bucket.getAggregations().get("[email protected]");
        Terms terms = reverseNested.getAggregations().get("someField");
        Terms.Bucket internalBucket = terms.getBuckets().get(0);

        long count = ((ValueCount) internalBucket.getAggregations().get("COUNT(*)")).getValue();
        String key = internalBucket.getKey().toString();
        if(key.equalsIgnoreCase("b")) {
            Assert.assertEquals(2, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: only a . found: %s", key));
        }
    }
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:23,代码来源:AggregationTest.java


示例17: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY  nested(message.info),filter('myFilter',message.info = 'a'),reverse_nested(someField)", TEST_INDEX_NESTED_TYPE));
    InternalNested nested = result.get("[email protected]");
    InternalFilter filter = nested.getAggregations().get("[email protected]");
    Terms infos = filter.getAggregations().get("message.info");
    Assert.assertEquals(1,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        InternalReverseNested reverseNested = bucket.getAggregations().get("[email protected]");
        Terms terms = reverseNested.getAggregations().get("someField");
        Terms.Bucket internalBucket = terms.getBuckets().get(0);

        long count = ((ValueCount) internalBucket.getAggregations().get("COUNT(*)")).getValue();
        String key = internalBucket.getKey().toString();
        if(key.equalsIgnoreCase("b")) {
            Assert.assertEquals(2, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: only a . found: %s", key));
        }
    }
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:23,代码来源:AggregationTest.java


示例18: reverseAnotherNestedGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
@Test
public void reverseAnotherNestedGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath() throws Exception {
    Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY  nested(message.info),filter('myFilter',message.info = 'a'),reverse_nested(comment.data,'~comment')", TEST_INDEX_NESTED_TYPE));
    InternalNested nested = result.get("[email protected]");
    InternalFilter filter = nested.getAggregations().get("[email protected]");
    Terms infos = filter.getAggregations().get("message.info");
    Assert.assertEquals(1,infos.getBuckets().size());
    for(Terms.Bucket bucket : infos.getBuckets()) {
        InternalReverseNested reverseNested = bucket.getAggregations().get("[email protected]_REVERSED");
        InternalNested innerNested = reverseNested.getAggregations().get("[email protected]");
        Terms terms = innerNested.getAggregations().get("comment.data");
        Terms.Bucket internalBucket = terms.getBuckets().get(0);

        long count = ((ValueCount) internalBucket.getAggregations().get("COUNT(*)")).getValue();
        String key = internalBucket.getKey().toString();
        if(key.equalsIgnoreCase("ab")) {
            Assert.assertEquals(2, count);
        }
        else {
            throw new Exception(String.format("Unexpected key. expected: only a . found: %s", key));
        }
    }
}
 
开发者ID:NLPchina,项目名称:elasticsearch-sql,代码行数:24,代码来源:AggregationTest.java


示例19: testUnmapped

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
public void testUnmapped() throws Exception {
    SearchResponse searchResponse = client().prepareSearch("idx_unmapped")
            .setQuery(matchAllQuery())
            .addAggregation(count("count").field("value"))
            .execute().actionGet();

    assertThat(searchResponse.getHits().getTotalHits(), equalTo(0L));

    ValueCount valueCount = searchResponse.getAggregations().get("count");
    assertThat(valueCount, notNullValue());
    assertThat(valueCount.getName(), equalTo("count"));
    assertThat(valueCount.getValue(), equalTo(0L));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:ValueCountIT.java


示例20: testSingleValuedField

import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; //导入依赖的package包/类
public void testSingleValuedField() throws Exception {
    SearchResponse searchResponse = client().prepareSearch("idx")
            .setQuery(matchAllQuery())
            .addAggregation(count("count").field("value"))
            .execute().actionGet();

    assertHitCount(searchResponse, 10);

    ValueCount valueCount = searchResponse.getAggregations().get("count");
    assertThat(valueCount, notNullValue());
    assertThat(valueCount.getName(), equalTo("count"));
    assertThat(valueCount.getValue(), equalTo(10L));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:ValueCountIT.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ARegionLoad类代码示例发布时间:2022-05-23
下一篇:
Java ClassType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap