Not sure you really want to see the whole query but here it is:
{
"size": 0,
"query": {
"filtered": {
"filter": {
"and": [
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"term": {
"gnip.matching_rules.tag": "conversation-wind"
}
},
{
"term": {
"purpose.campaigns.conversation-wind.match": true
}
}
]
}
}
]
}
},
{
"terms": {
"gnip.profileLocations.address.countryCode": [
"us"
]
}
},
{
"range": {
"postedTime": {
"gte": "2017-02-03",
"lt": "2017-03-03",
"time_zone": "America/New_York"
}
}
}
]
}
}
},
"aggregations": {
"national_trends": {
"date_histogram": {
"field": "postedTime",
"interval": "2w",
"min_doc_count": 0,
"time_zone": "America/New_York"
},
"aggregations": {
"hashtags": {
"terms": {
"field": "twitter_entities.hashtags.text",
"size": 0
}
},
"tweets": {
"terms": {
"field": "object.id",
"size": 10
},
"aggregations": {
"top_link": {
"top_hits": {
"_source": {
"includes": [
"object.id",
"object.link",
"object.body",
"body"
]
},
"size": 1
}
}
}
}
}
},
"states": {
"terms": {
"field": "gnip.profileLocations.address.region",
"size": 52
},
"aggregations": {
"intervals": {
"date_histogram": {
"field": "postedTime",
"min_doc_count": 0,
"interval": "2w",
"time_zone": "America/New_York"
},
"aggregations": {
"hashtags": {
"terms": {
"field": "twitter_entities.hashtags.text",
"size": 0
}
},
"tweets": {
"terms": {
"field": "object.id",
"size": 1
},
"aggregations": {
"top_link": {
"top_hits": {
"_source": {
"includes": [
"object.id",
"object.link",
"object.body",
"body"
]
},
"size": 1
}
}
}
}
}
}
}
}
},
"sort": [
]
}