Nested aggregation

Hi all,

I'm new to ElasticSearch and I'm trying to build a query based on the following structure:

Well 1 {
Sections {
bottom_depth 1
other field 1
}
{
bottom_depth 2
}

Well 2 {
Sections {
bottom_depth 1
other field 1
}
{
bottom_depth 2
}

What I want to do is for each well, get the maximum ie. largest bottom_depth for that well.

I've sort of got this code, I think its close, but its not quite there:

curl -XGET http://localhost:9200/indexname/well/_search?pretty -d'
{
"query": { "bool": { "must": [{"match_all": {}}] } },
"aggs" : { "well_groups": { "terms": { "field": "Guid", "size": 0 },
"aggs": { "total_depth" : { "max" : { "field" : "Section:bottom_depth" } } }
}
}
}'

Any ideas welcomed

Hi KeninHouston
You can refer to the concerning information website.
:smile:
https://stackoverflow.com/questions/31052204/elasticsearch-group-and-aggregate-nested-valueshttps://stackoverflow.com/questions/31052204/elasticsearch-group-and-aggregate-nested-values

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