Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save QuantVI/7b4c0b94e4b045653a705d39abb60eff to your computer and use it in GitHub Desktop.

Select an option

Save QuantVI/7b4c0b94e4b045653a705d39abb60eff to your computer and use it in GitHub Desktop.
ElasticSearch query: external confirmation status, versus internal status code. 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.
{ "size": 0,
"query": {
"term": {"propertyId":"{{property_id}}"}
},
"aggs": {
"pms_status_code": {
"terms" : { "field" : "confirmationStatus"},
"aggs": {
"conf_status": {
"terms" : { "field" : "statusCode"},
"aggs": {
"min_check-in" : { "min" : { "field" : "checkinDate" }},
"max_check-in" : { "max" : { "field" : "checkinDate" }},
"min_check-out": { "min" : { "field" : "checkoutDate" }},
"max_check-out": { "max" : { "field" : "checkoutDate" }}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment