Created
July 23, 2019 23:07
-
-
Save QuantVI/e78b51e7f1d07b45ab6cff23724d0d12 to your computer and use it in GitHub Desktop.
ElasticSearch query: range of rates paid per night for a room. Example of an aggregation query returning results in JSON format. These result were passed to "Excel Printer" via "Scribe Report", two other gists you'll find here.
This file contains hidden or 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
| { "size": 0, | |
| "query": { | |
| "term": {"propertyId":"{{property_id}}"} | |
| }, | |
| "aggs" : { | |
| "zero_or_not": { | |
| "range" : { | |
| "field" : "totalRoomRateInPropertyCurrency", | |
| "ranges" : [ | |
| {"from": 0, "to" : 0.1 }, | |
| { "from" : 1} | |
| ] | |
| }, | |
| "aggs": { | |
| "total_room_rate_range": { | |
| "histogram" : { | |
| "field" : "totalRoomRateInPropertyCurrency", | |
| "interval" : 500 | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment