-
-
Save qvin/a40bd96d6df25d1b31c3 to your computer and use it in GitHub Desktop.
Elasticsearch Query with output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XGET 'http://localhost:9200/testdb/testtable/_search' -d '{ | |
"size": 0, | |
"aggs": { | |
"report_aggs": { | |
"filter": { | |
"and": [ | |
{ | |
"term": { | |
"prop1": "1" | |
} | |
}, | |
{ | |
"term": { | |
"prop2": "2" | |
} | |
}, | |
{ | |
"term": { | |
"checkflag": "true" | |
} | |
} | |
] | |
}, | |
"aggs": { | |
"aggs_sum": { | |
"terms": { | |
"field": "nesteddocs.dockey" | |
}, | |
"aggs": { | |
"docvalsum": { | |
"sum": { | |
"field": "nesteddocs.docvalue" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}' | |
---------------------- RESULT -------------------------------------------- | |
{ | |
"took": 2, | |
"timed_out": false, | |
"_shards": { | |
"total": 5, | |
"successful": 5, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 5, | |
"max_score": 0, | |
"hits": [] | |
}, | |
"aggregations": { | |
"report_aggs": { | |
"doc_count": 2, | |
"aggs_sum": { | |
"buckets": [ | |
{ | |
"key": 100, | |
"doc_count": 2, | |
"docvalsum": { | |
"value": 1026 ---------- (EXPECTED 111+211 = 322) | |
} | |
}, | |
{ | |
"key": 200, | |
"doc_count": 2, | |
"docvalsum": { | |
"value": 1026 ---------- (EXPECTED 121+221 = 342) | |
} | |
}, | |
{ | |
"key": 300, | |
"doc_count": 2, | |
"docvalsum": { | |
"value": 1026 ---------- (EXPECTED 131+231 = 362) | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
---------------------- END RESULT -------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Did you figure out how to solve this? I ran into similar situations as you did.