Created
April 30, 2015 06:39
-
-
Save justengland/e637215934e961fbee23 to your computer and use it in GitHub Desktop.
SearchTwit searches
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
POST tweets/tweet/_search | |
{ | |
"query": { | |
"match_all": {} | |
}, | |
"sort": { | |
"postDate": { | |
"order": "desc" | |
} | |
} | |
} | |
POST tweets/tweet/_search?search_type=count | |
{ | |
"aggregations": { | |
"hashTags_agg": { | |
"terms": { | |
"field": "hashTags", | |
"size": 1000 | |
} | |
} | |
} | |
} | |
POST tweets/tweet/_search?search_type=count | |
{ | |
"aggregations": { | |
"hashTags_agg": { | |
"terms": { | |
"field": "id", | |
"size": 100 | |
} | |
} | |
} | |
} | |
POST tweets/tweet/_search | |
{ | |
"query": { | |
"filtered" : { | |
"query" : { | |
"match_all" : {} | |
}, | |
"filter" : { | |
"and" : [ | |
{ "exists" : { "field" : "coordinates" } }, | |
{ | |
"geo_distance" : { | |
"distance" : "20000km", | |
"coordinates": { | |
"lat": 40.715, | |
"lon": -73.998 | |
} | |
} | |
} | |
] | |
} | |
} | |
}, | |
"sort": [ | |
{ | |
"_geo_distance": { | |
"coordinates": { | |
"lat": 40.715, | |
"lon": -73.998 | |
}, | |
"order": "asc", | |
"unit": "km", | |
"distance_type": "plane" | |
} | |
} | |
] | |
} | |
POST tweets/tweet/_search | |
{ | |
"query": { | |
"function_score": { | |
"functions": [ | |
{ | |
"gauss": { | |
"postDate": { | |
"origin": "Wed Apr 08 04:24:39 +0000 2015", | |
"scale": "18h", | |
"offset": "1h", | |
"decay": 0.3 | |
} | |
}, | |
"weight": 5 | |
}, | |
{ | |
"gauss": { | |
"rank": { | |
"origin": 1000, | |
"offset": 100, | |
"scale": 1 | |
} | |
}, | |
"weight": 5 | |
}, | |
{ | |
"gauss": { | |
"coordinates": { | |
"origin": { | |
"lat": 39.7469, | |
"lon": -105.2108 | |
}, | |
"offset": "2km", | |
"scale": "3km" | |
} | |
} | |
} | |
] | |
} | |
}, | |
"filter": { | |
"and": { | |
"filters": [ | |
{ | |
"query": { | |
"query_string": { | |
"default_field": "hashTags", | |
"query": "jobs OR art OR deals OR business OR fun OR women" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
POST tweets/tweet/_search | |
{ | |
"size": 100, | |
"query": { | |
"function_score": { | |
"functions": [ | |
{ | |
"gauss": { | |
"postDate": { | |
"origin": "Wed Apr 08 04:24:39 +0000 2015", | |
"scale": "18h", | |
"offset": "1h", | |
"decay": 0.3 | |
} | |
}, | |
"weight": 5 | |
}, | |
{ | |
"filter": { "term": { "id": [585475718936526800, 585475723126820900, 585475731523821600, 585475731519631400, 585475731527966700, 585475731507040300, 585475731519631400] }}, | |
"weight": 2 | |
} | |
], | |
"score_mode": "sum" | |
} | |
} | |
} | |
POST tweets/tweet/_search | |
{ | |
"size": 100, | |
"query": { | |
"function_score": { | |
"functions": [ | |
{ | |
"gauss": { | |
"postDate": { | |
"origin": "Wed Apr 08 04:24:39 +0000 2015", | |
"scale": "18h", | |
"offset": "1h", | |
"decay": 0.3 | |
} | |
}, | |
"weight": 5 | |
}, | |
{ | |
"filter": { | |
"term": { | |
"id": [ | |
585475718936526800, | |
585475723126820900, | |
585475731523821600, | |
585475731519631400, | |
585475731527966700, | |
585475731507040300, | |
585475731519631400 | |
] | |
} | |
}, | |
"weight": 2 | |
} | |
], | |
"score_mode": "sum" | |
} | |
} | |
} | |
POST tweets/tweet/ | |
{ | |
"query": { | |
"match_all": {} | |
}, | |
"facets": { | |
"tags": { | |
"terms": { | |
"field": "id" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment