Instantly share code, notes, and snippets.
Created
December 18, 2017 15:58
-
Star
(0)
0
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save Wattenberger/e5e4ef5bee88e5b9ba3e74f458cf0109 to your computer and use it in GitHub Desktop.
ref annotation - 6 month query for an author
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
GET casterisk-1day-2017.06,casterisk-1day-2017.07,casterisk-1day-2017.08,casterisk-1day-2017.09,casterisk-1day-2017.10,casterisk-1day-2017.11,casterisk-1day-2017.12,casterisk-raws,casterisk-5min-2017.12.14,casterisk-5min-2017.12.16,casterisk-5min-2017.12.15,casterisk-5min-2017.12.17,casterisk-5min-2017.12.18,casterisk-5min-2017.12.13/url/_search?ignore_unavailable&timeout=240000&search_type=count&routing=arstechnica.com | |
{ | |
"query": { | |
"filtered": { | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"term": { | |
"apikey": "arstechnica.com" | |
} | |
}, | |
{ | |
"range": { | |
"_cache": true, | |
"ts": { | |
"to": "2017-12-19T04:59:00Z", | |
"from": "2017-06-18T04:00:00Z" | |
} | |
} | |
}, | |
{ | |
"range": { | |
"_cache": true, | |
"ts_apikey": { | |
"to": "2017-12-18T23:59:00Z", | |
"from": "2017-06-18T00:00:00Z" | |
} | |
} | |
}, | |
{ | |
"bool": { | |
"must": [ | |
{ | |
"terms": { | |
"metas.authors": [ | |
"Megan Geuss", | |
"Megan_Geuss" | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"term": { | |
"metas.page_type": "post" | |
} | |
}, | |
{ | |
"nested": { | |
"path": "referrers", | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"terms": { | |
"referrers.from.category": [ | |
"social", | |
"search", | |
"internal", | |
"other", | |
"direct" | |
] | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"terms": { | |
"_cache": false, | |
"metas.canonical_url": [ | |
"https://arstechnica.com/cars/2017/11/not-just-a-semi-announcement-tesla-promises-a-new-roadster/", | |
"https://arstechnica.com/information-technology/2017/10/tesla-says-worlds-largest-battery-installation-is-halfway-done/", | |
"https://arstechnica.com/cars/2017/11/a-first-look-at-teslas-promised-electric-semi/", | |
"https://arstechnica.com/information-technology/2017/10/a-world-tour-of-some-of-the-biggest-energy-storage-schemes/", | |
"https://arstechnica.com/science/2017/09/solar-now-costs-6%C2%A2-per-kilowatt-hour-beating-government-goal-by-3-years/", | |
"https://arstechnica.com/cars/2017/07/hyperloop-one-says-its-completed-a-first-full-systems-test-in-a-vacuum/", | |
"https://arstechnica.com/cars/2017/12/so-far-it-appears-pepsico-had-placed-the-most-tesla-semi-reservations/", | |
"https://arstechnica.com/tech-policy/2017/12/judge-sentences-volkswagen-executive-to-7-years-in-prison-plus-a-fine/", | |
"https://arstechnica.com/cars/2017/11/one-way-to-curb-freight-emissions-put-trucks-on-an-electric-catenary-system/", | |
"https://arstechnica.com/cars/2017/10/elon-musks-boring-company-is-digging-a-10-mile-tunnel-in-maryland/", | |
"https://arstechnica.com/cars/2017/07/pared-down-electric-experience-driving-one-of-the-first-model-3s-off-the-line/", | |
"https://arstechnica.com/cars/2017/08/is-a-200-300-mile-range-enough-for-tesla-to-break-into-electric-trucking/", | |
"https://arstechnica.com/information-technology/2017/08/google-born-startup-thinks-its-time-for-a-ground-source-heat-pump-renaissance/", | |
"https://arstechnica.com/cars/2017/11/tesla-buys-automation-company-perbix-to-soup-up-factories/", | |
"https://arstechnica.com/information-technology/2017/11/economics-working-against-coal-as-cost-of-wind-solar-power-drops/", | |
"https://arstechnica.com/cars/2017/09/hyperloop-one-colorado-dot-to-study-360-mile-intercity-route/" | |
] | |
} | |
}, | |
{ | |
"indices": { | |
"indices": [ | |
"casterisk-1day-2017.06", | |
"casterisk-1day-2017.07", | |
"casterisk-1day-2017.08", | |
"casterisk-1day-2017.09", | |
"casterisk-1day-2017.10", | |
"casterisk-1day-2017.11", | |
"casterisk-5min-2017.12.14", | |
"casterisk-5min-2017.12.15", | |
"casterisk-5min-2017.12.16", | |
"casterisk-5min-2017.12.17" | |
], | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"missing": { | |
"field": "audience_segment_id" | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"indices": { | |
"indices": [ | |
"casterisk-1day-2017.12" | |
], | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"range": { | |
"_cache": true, | |
"ts": { | |
"to": "2017-12-13T04:59:00" | |
} | |
} | |
}, | |
{ | |
"missing": { | |
"field": "audience_segment_id" | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"indices": { | |
"indices": [ | |
"casterisk-5min-2017.12.13" | |
], | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"range": { | |
"_cache": true, | |
"ts": { | |
"from": "2017-12-13T05:00:00" | |
} | |
} | |
}, | |
{ | |
"missing": { | |
"field": "audience_segment_id" | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"indices": { | |
"indices": [ | |
"casterisk-5min-2017.12.18" | |
], | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"range": { | |
"_cache": false, | |
"ts": { | |
"to": "2017-12-18T15:44:00" | |
} | |
} | |
}, | |
{ | |
"missing": { | |
"field": "audience_segment_id" | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"indices": { | |
"indices": [ | |
"casterisk-raws" | |
], | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"range": { | |
"_cache": false, | |
"ts": { | |
"from": "2017-12-18T15:45:00" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
"aggs": { | |
"g0": { | |
"terms": { | |
"execution_hint": "map", | |
"field": "metas.canonical_url", | |
"order": { | |
"views": "desc" | |
}, | |
"size": 16 | |
}, | |
"aggs": { | |
"metas": { | |
"top_hits": { | |
"sort": [ | |
{ | |
"index_ts": { | |
"order": "desc" | |
} | |
} | |
], | |
"size": 1, | |
"_source": { | |
"include": [ | |
"metas.pub_date", | |
"metas.canonical_url" | |
] | |
} | |
} | |
}, | |
"g1": { | |
"aggs": { | |
"g2": { | |
"aggs": { | |
"g3": { | |
"terms": { | |
"execution_hint": "map", | |
"field": "referrers.from.domain", | |
"size": 16 | |
}, | |
"aggs": { | |
"referrers_domain": { | |
"terms": { | |
"execution_hint": "map", | |
"field": "referrers.from.domain", | |
"size": 0 | |
} | |
}, | |
"referrers_views": { | |
"sum": { | |
"field": "referrers.$any/$all/page_view" | |
} | |
} | |
} | |
} | |
}, | |
"filters": { | |
"filters": { | |
"referrers_category-search": { | |
"bool": { | |
"must": { | |
"term": { | |
"referrers.from.category": "search" | |
} | |
} | |
} | |
}, | |
"referrers_category-other": { | |
"bool": { | |
"must": { | |
"term": { | |
"referrers.from.category": "other" | |
} | |
} | |
} | |
}, | |
"referrers_category-social": { | |
"bool": { | |
"must": { | |
"term": { | |
"referrers.from.category": "social" | |
} | |
} | |
} | |
}, | |
"referrers_category-internal": { | |
"bool": { | |
"must": { | |
"term": { | |
"referrers.from.category": "internal" | |
} | |
} | |
} | |
}, | |
"referrers_category-direct": { | |
"bool": { | |
"must": { | |
"term": { | |
"referrers.from.category": "direct" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"nested": { | |
"path": "referrers" | |
} | |
}, | |
"views": { | |
"sum": { | |
"field": "metrics.$any/$all/page_view" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment