I have an ES where I have indexed a bunch of files. Each file is tagged
with a category field. I want to write Java code to get a list of all the
categories. I am trying to do this using the terms aggregation:
QueryBuilder qb = QueryBuilders.matchAllQuery();
SearchResponse sr =
Terms terms = sr.getAggregations().get("category_names");
int numCategories = terms.getBuckets().size();
System.out.println("Number of category buckets found: "+ numCategories);
But this code always prints out that it found 10 category buckets. Yet, if
I execute the following query in Sense:
I get 18 category buckets. What am I doing wrong in the Java code?
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b6d0300c-524e-423b-bd5a-6ce9d9e7b168%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.