How about this:
AggregationBuilder aggregation = AggregationBuilders
.terms(queryTerm)
.field(queryField)
.size(size)
.order(Terms.Order.term(true))
.include(includeRegex)
.exclude(excludeRegex);
Hope that helps,
Colin
On Wednesday, 4 March 2015 18:20:37 UTC, zhang...@gmail.com wrote:
Hi all,
According to the documentation online and I quote:
"It is possible to filter the values for which buckets will be created.
This can be done using the include and exclude parameters which are based
on regular expressions."{
"aggs" : {
"tags" : {
"terms" : {
"field" : "tags",
"include" : ".sport.",
"exclude" : "water_.*"
}
}
}
}See:
Elasticsearch Platform — Find real-time answers at scale | ElasticI wonder how the include and exclude parameters can be used with the Java
client.Currently, I use the AggregationBuilder class to add a terms aggregation
to my query like this.AggregationBuilder aggregation = AggregationBuilders
.terms(queryTerm)
.field(queryField)
.size(size.or(1))
.order(Terms.Order.term(true));However, I wonder how to use the "include" as described above using the
Java client.
Any help is greatly appreciated! Thanks/JZ
--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/67fa4d7a-e803-45cb-86af-63cb342700ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.