本文整理汇总了Java中org.elasticsearch.search.aggregations.bucket.filter.InternalFilter类的典型用法代码示例。如果您正苦于以下问题:Java InternalFilter类的具体用法?Java InternalFilter怎么用?Java InternalFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InternalFilter类属于org.elasticsearch.search.aggregations.bucket.filter包,在下文中一共展示了InternalFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: groupByTestWithFilter
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例2: groupByOnNestedFieldWithFilterTest
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例3: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedAndEmptyPath
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例4: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例5: reverseAnotherNestedGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例6: processFilterAgg
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
/**
* Parse an aggregation performed without grouping.
* @param filter
* @param rs
* @throws SQLException
*/
private void processFilterAgg(InternalFilter filter, ESResultSet rs) throws SQLException{
//String name = global.getName(); // we do not care about the global name for now
List<Object> row = rs.getNewRow();
Column count = null;
for(Column c : rs.getHeading().columns())
if(c.getOp() == Operation.COUNT) count = c;
if(count != null){
row.set(count.getIndex(), filter.getDocCount());
}
for(Aggregation agg : filter.getAggregations()){
if(agg instanceof InternalNumericMetricsAggregation.SingleValue){
InternalNumericMetricsAggregation.SingleValue numericAgg =
(InternalNumericMetricsAggregation.SingleValue)agg;
String name =numericAgg.getName();
Column column = rs.getHeading().getColumnByLabel(name);
if(column == null){
throw new SQLException("Unable to identify column for "+name);
}
row.set(column.getIndex(), numericAgg.value());
}else throw new SQLException("Unable to parse aggregation of type "+agg.getClass());
}
rs.add(row);
}
开发者ID:Anchormen,项目名称:sql4es,代码行数:31,代码来源:SearchAggregationParser.java
示例7: collectNumericData
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
private <T extends FieldMetadata> List<FieldMetadata> collectNumericData(Collection<FieldInfo> fields, ExtendedStatsAnalyzer<T> parser) {
if(fields.isEmpty()) {
return Collections.emptyList();
}
List<FieldMetadata> metadata = new ArrayList<>(fields.size());
SearchRequestBuilder builder = createNumericSearchBuilder(fields);
SearchResponse response = client.search(builder.request()).actionGet();
for(FieldInfo info : fields) {
InternalFilter filter = getAggregation(response, info, FILTER_AGG);
ExtendedStats stats = (ExtendedStats) filter.getAggregations().get(EXTENDED_STATS_AGG + info.getFullPath());
LOGGER.debug("Field {} total: {} MAX: {} MIN: {}", info.getFullPath(), stats.getCount(), stats.getMaxAsString(), stats.getMinAsString());
if(stats.getCount() <= ZERO_ITEMS) {
continue;
}
int valuesPerDocument = valuesPerDoc(response, filter, stats);
FieldMetadata meta = parser.parse(info, stats, valuesPerDocument);
LOGGER.debug("Registering metadata: {}", meta);
metadata.add(meta);
}
return metadata;
}
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:22,代码来源:FieldAnalyzer.java
示例8: groupByTestWithFilter
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例9: groupByOnNestedFieldWithFilterTest
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例10: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedAndEmptyPath
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例11: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例12: reverseAnotherNestedGroupByOnNestedFieldWithFilterTestWithReverseNestedNoPath
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的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
示例13: SearchResult
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
public SearchResult(SearchResponse resp, Select select) throws SqlParseException {
Aggregations aggs = resp.getAggregations();
if (aggs.get("filter") != null) {
InternalFilter inf = aggs.get("filter");
aggs = inf.getAggregations();
}
if (aggs.get("group by") != null) {
InternalTerms terms = aggs.get("group by");
Collection<Bucket> buckets = terms.getBuckets();
this.total = buckets.size();
results = new ArrayList<>(buckets.size());
for (Bucket bucket : buckets) {
Map<String, Object> aggsMap = toAggsMap(bucket.getAggregations().getAsMap());
aggsMap.put("docCount", bucket.getDocCount());
results.add(aggsMap);
}
} else {
results = new ArrayList<>(1);
this.total = 1;
Map<String, Object> map = new HashMap<>();
for (Aggregation aggregation : aggs) {
map.put(aggregation.getName(), covenValue(aggregation));
}
results.add(map);
}
}
开发者ID:mazhou,项目名称:es-sql,代码行数:28,代码来源:SearchResult.java
示例14: reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedOnHistogram
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
@Test
public void reverseToRootGroupByOnNestedFieldWithFilterTestWithReverseNestedOnHistogram() throws Exception {
Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY nested(message.info),filter('myFilter',message.info = 'a'),histogram('field'='myNum','reverse_nested'='','interval'='2' , 'alias' = 'someAlias' )", 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]");
InternalHistogram histogram = reverseNested.getAggregations().get("someAlias");
Assert.assertEquals(3, histogram.getBuckets().size());
}
}
开发者ID:mazhou,项目名称:es-sql,代码行数:15,代码来源:AggregationTest.java
示例15: reverseToRootGroupByOnNestedFieldWithFilterAndSumOnReverseNestedField
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
@Test
public void reverseToRootGroupByOnNestedFieldWithFilterAndSumOnReverseNestedField() throws Exception {
Aggregations result = query(String.format("SELECT sum(reverse_nested(myNum)) bla 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()) {
InternalReverseNested reverseNested = bucket.getAggregations().get("[email protected]");
InternalSum sum = reverseNested.getAggregations().get("bla");
Assert.assertEquals(5.0,sum.getValue(),0.000001);
}
}
开发者ID:mazhou,项目名称:es-sql,代码行数:15,代码来源:AggregationTest.java
示例16: reverseAnotherNestedGroupByOnNestedFieldWithFilterTestWithReverseNestedOnHistogram
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
@Test
public void reverseAnotherNestedGroupByOnNestedFieldWithFilterTestWithReverseNestedOnHistogram() throws Exception {
Aggregations result = query(String.format("SELECT COUNT(*) FROM %s/nestedType GROUP BY nested(message.info),filter('myFilter',message.info = 'a'),histogram('field'='comment.likes','reverse_nested'='~comment','interval'='2' , 'alias' = 'someAlias' )", 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("~comm[email protected]_REVERSED");
InternalNested innerNested = reverseNested.getAggregations().get("[email protected]");
InternalHistogram histogram = innerNested.getAggregations().get("someAlias");
Assert.assertEquals(2, histogram.getBuckets().size());
}
}
开发者ID:mazhou,项目名称:es-sql,代码行数:16,代码来源:AggregationTest.java
示例17: reverseAnotherNestedGroupByOnNestedFieldWithFilterAndSumOnReverseNestedField
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
@Test
public void reverseAnotherNestedGroupByOnNestedFieldWithFilterAndSumOnReverseNestedField() throws Exception {
Aggregations result = query(String.format("SELECT sum(reverse_nested(comment.likes,'~comment')) bla 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()) {
InternalReverseNested reverseNested = bucket.getAggregations().get("[email protected]_REVERSED");
InternalNested innerNested = reverseNested.getAggregations().get("[email protected]");
InternalSum sum = innerNested.getAggregations().get("bla");
Assert.assertEquals(4.0,sum.getValue(),0.000001);
}
}
开发者ID:mazhou,项目名称:es-sql,代码行数:16,代码来源:AggregationTest.java
示例18: parseAggregation
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
/**
* Parses an ES aggregation into a set of ResultRows
* @param agg
* @return
* @throws SQLException
*/
public void parseAggregation(Aggregation agg, ESResultSet rs) throws SQLException{
if(agg instanceof Terms){
dfsAggregations((Terms)agg, rs, rs.getNewRow());
}else if (agg instanceof InternalFilter){
processFilterAgg((InternalFilter)agg, rs);
}else if (agg instanceof InternalCardinality){
processCardinalityAgg((InternalCardinality)agg, rs);
}else throw new SQLException ("Unknown aggregation type "+agg.getClass().getName());
}
开发者ID:Anchormen,项目名称:sql4es,代码行数:16,代码来源:SearchAggregationParser.java
示例19: collectStrings
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
private List<StringFieldMetadata> collectStrings(Collection<FieldInfo> fields) {
if(fields.isEmpty()) {
return Collections.emptyList();
}
SearchRequestBuilder builder = createStringSearchBuilder(fields);
List<StringFieldMetadata> metadata = new ArrayList<>(fields.size());
SearchResponse response = client.search(builder.request()).actionGet();
for(FieldInfo info : fields) {
Terms tokenAgg = getAggregation(response, info, TERMS_AGG);
InternalFilter filter = getAggregation(response, info, FILTER_AGG);
ValueCount fieldTotalAgg = (ValueCount) filter.getAggregations().get(VALUE_COUNT_AGG + info.getFullPath());
LOGGER.debug("Field {} total: {}", info.getFullPath(), fieldTotalAgg.getValue());
for(Terms.Bucket bucket : tokenAgg.getBuckets()) {
LOGGER.debug("\t{}:{}", bucket.getKey(), bucket.getDocCount());
}
if(fieldTotalAgg.getValue() <= ZERO_ITEMS) {
continue;
}
long totalHits = filter.getDocCount();
int tokenCount = (int) (fieldTotalAgg.getValue() / totalHits);
List<String> tokens = tokenAgg.getBuckets().stream().map(b -> b.getKeyAsString()).collect(Collectors.toList());
StringFieldMetadata meta = new StringFieldMetadata(info.getFullPath(), FieldConstants.SINGLE_VALUE, tokenCount, tokens);
LOGGER.debug("Registering metadata: {}", meta);
metadata.add(meta);
}
return metadata;
}
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:29,代码来源:FieldAnalyzer.java
示例20: valuesPerDoc
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; //导入依赖的package包/类
private int valuesPerDoc(SearchResponse response, InternalFilter filter, long valuesInDocs) {
long allDocs = response.getHits().getTotalHits();
long docFieldPresented = filter.getDocCount();
int valuesPerDocument = Math.toIntExact(valuesInDocs / docFieldPresented);
valuesPerDocument = Math.max(valuesPerDocument, FieldConstants.SINGLE_VALUE);
LOGGER.debug("Total docs: {}, with field: {}, values: {}", allDocs, docFieldPresented, valuesInDocs);
return valuesPerDocument;
}
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:9,代码来源:FieldAnalyzer.java
注:本文中的org.elasticsearch.search.aggregations.bucket.filter.InternalFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论