Page MenuHomePhabricator
Paste P3359

grid bucketed geo search, bridges within 40km of sydney
ActivePublic

Authored by EBernhardson on Jul 7 2016, 7:20 PM.
{
"stats": [
"full_text"
],
"rescore": [
{
"query": {
"rescore_query": {
"function_score": {
"functions": [
{
"field_value_factor": {
"missing": 0,
"modifier": "log2p",
"field": "incoming_links"
}
},
{
"filter": {
"fquery": {
"query": {
"match": {
"template": {
"query": "Template:Featured article"
}
}
},
"_cache": true
}
},
"weight": 2
},
{
"filter": {
"fquery": {
"query": {
"match": {
"template": {
"query": "Template:Featured picture"
}
}
},
"_cache": true
}
},
"weight": 2
},
{
"filter": {
"fquery": {
"query": {
"match": {
"template": {
"query": "Template:Featured sound"
}
}
},
"_cache": true
}
},
"weight": 2
},
{
"filter": {
"fquery": {
"query": {
"match": {
"template": {
"query": "Template:Featured list"
}
}
},
"_cache": true
}
},
"weight": 1.75
},
{
"filter": {
"fquery": {
"query": {
"match": {
"template": {
"query": "Template:Good article"
}
}
},
"_cache": true
}
},
"weight": 1.5
}
]
}
},
"score_mode": "multiply",
"rescore_query_weight": 1,
"query_weight": 1
},
"window_size": 8192
}
],
"size": 0,
"query": {
"bool": {
"should": [
{
"query_string": {
"max_determinized_states": 500,
"query": "bridge",
"fields": [
"all.plain^1",
"all^0.5"
],
"auto_generate_phrase_queries": true,
"phrase_slop": 0,
"default_operator": "AND",
"allow_leading_wildcard": false,
"fuzzy_prefix_length": 2,
"rewrite": "top_terms_boost_1024"
}
},
{
"multi_match": {
"query": "bridge",
"fields": [
"all_near_match^2"
]
}
}
],
"filter": [
{
"nested": {
"path": "coordinates",
"filter": [
{
"term": {
"coordinates.globe": "earth"
}
},
{
"term": {
"coordinates.primary": 1
}
},
{
"geo_distance": {
"distance": "40km",
"coordinates.coord": {
"lat": -33.865,
"lon": 151.20944444444
}
}
}
]
}
}
],
"minimum_number_should_match": 1
}
},
"aggs": {
"my_grid": {
"nested": {
"path": "coordinates"
},
"aggs": {
"primary_coordinates": {
"filter": { "term": { "coordinates.primary": 1 } },
"aggs": {
"inner_grid": {
"geohash_grid": {
"field": "coordinates.coord",
"precision": 5
},
"aggs": {
"coord_to_page": {
"reverse_nested": {},
"aggs": {
"top_grid_hits": {
"top_hits": {
"_source": {
"include": [ "title", "namespace", "coordinates.coord" ]
},
"size": 2
}
}
}
}
}
}
}
}
}
}
},
"fields": "text.word_count",
"_source": [
"id",
"title",
"namespace",
"redirect.*",
"timestamp",
"text_bytes"
]
}