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: 
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html

I 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/0aca7958-98a5-48e2-9437-13f01a8a2854%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to