Created
July 23, 2019 23:00
-
-
Save QuantVI/b192f3d5202815a9fa8fd49f13d12f87 to your computer and use it in GitHub Desktop.
ElasticSearch query: emails per year. 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 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": { | |
"email_recency": { | |
"date_histogram" : { | |
"field": "checkinDate", | |
"interval": "year", | |
"format" : "yyyy-MM-dd" | |
}, | |
"aggs" : { | |
"non_null_email" : { | |
"value_count" : { | |
"field" : "email" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment