Translate geodistance aggregation query to Java

I need to translate a geodistance aggregation query to Java. This aggregation is working from Kibana, but I can't do it from Java:
GET accidentes/_search
{
"aggs": {
"location": {
"filter": {
"geo_distance": {
"distance": "100km",
"start_location": {
"lat": 40,
"lon": -96
}
}
},
"aggs": {
"dangerous": {
"terms": {
"field": "slocation.keyword",
"min_doc_count": 1,
"size" : 5
}
}
}
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.