Multiple sub aggregation in java api

Hi

I wondering if the java client support multiple sub aggregation on same
level :

for example how to translate this to java api :
by_city and by_language is count aggregation on same level.

{
"aggs": {
"by_gender": {
"terms": {
"field": "gender",
"size": 10
},
"aggs": {
"by_city": {
"terms": {
"field": "city",
"size": 3
}
},
"by_language": {
"terms": {
"field": "gender",
"size": 1
}
}
}
}
}
}

--
This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this on behalf of the
addressee you must not use, copy, disclose or take action based on this
message or any information herein.
If you have received this message in error, please advise the sender
immediately by reply email and delete this message. Thank you.

--
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/d74224cb-5bb9-4fa7-bc79-ada08dbd8cc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[solved]

here is the solution:
AggregationBuilders.terms("by_gender").field("gende").size(10).

subAggregation(AggregationBuilders.terms("by_city").field("city")).

subAggregation(AggregationBuilders.terms("by_language").field("language"));

On Thursday, April 2, 2015 at 11:29:07 AM UTC+3, Grigory Rubstein wrote:

Hi

I wondering if the java client support multiple sub aggregation on same
level :

for example how to translate this to java api :
by_city and by_language is count aggregation on same level.

{
"aggs": {
"by_gender": {
"terms": {
"field": "gender",
"size": 10
},
"aggs": {
"by_city": {
"terms": {
"field": "city",
"size": 3
}
},
"by_language": {
"terms": {
"field": "gender",
"size": 1
}
}
}
}
}
}

This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this on behalf of
the addressee you must not use, copy, disclose or take action based on this
message or any information herein.
If you have received this message in error, please advise the sender
immediately by reply email and delete this message. Thank you.

--
This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this on behalf of the
addressee you must not use, copy, disclose or take action based on this
message or any information herein.
If you have received this message in error, please advise the sender
immediately by reply email and delete this message. Thank you.

--
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/d30428a3-72da-4460-85dc-a1bb205b0d9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.