CopyPastor

Detecting plagiarism made easy.

Score: 0.8030624389648438; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2022-06-24
by Subhamay

Original Post

Original - Posted on 2016-01-08
by Val



            
Present in both answers; Present only in the new answer; Present only in the old answer;

This is a multiple group by scenario where data are being sorted by the key descending order.
{ "size": 0, "aggs": { "categories": { "filter": { "exists": { "field": "organization_industries" } }, "aggs": { "names": { "terms": { "field": "organization_revenue_in_thousands_int.keyword", "size": 200, "order": { "_key": "desc" } }, "aggs": { "industry_stats": { "terms": { "field": "organization_industries.keyword" } } } } } } } }
Since the keys seem to be ordered according to ascending values of the `from` value, you can "cheat" a little bit and modify the `from` value of the `all` bucket to -1, then the `all` bucket will appear first, then `to10` and finally `from11`:
POST /docs/_search { "size": 0, "aggs": { "price_ranges": { "range": { "field": "price", "keyed": true, "ranges": [ { "key": "all", "from": -1 }, { "key": "to10", "from": 0, "to": 10 }, { "key": "from11", "from": 11 } ] } } } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;