Created
February 21, 2015 17:22
-
-
Save benlovell/d9ab77fa280a324c0f72 to your computer and use it in GitHub Desktop.
Geo shapes
This file contains hidden or 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
{ | |
"registered_name": "Money Bags Finance", | |
"postcode_searchable": true, | |
"advisers": [ | |
{ | |
"_id": 1, | |
"name": "Ben Lovell", | |
"location": { | |
"type": "circle", | |
"coordinates": [-0.951230, 51.418228], | |
"radius": "50miles" | |
} | |
}, | |
{ | |
"_id": 2, | |
"name": "Graham Smith", | |
"location": { | |
"type": "circle", | |
"coordinates": [-0.943616, 51.428473], | |
"radius": "10miles" | |
} | |
} | |
] | |
} |
This file contains hidden or 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
{ | |
"mappings": { | |
"firm": { | |
"properties": { | |
"registered_name": { "type": "string", "index": "not_analyzed" }, | |
"postcode_searchable": { "type": "boolean" }, | |
"advisers": { | |
"type": "nested", | |
"properties": { | |
"location": { "type": "geo_shape" }, | |
"name": { "type": "string", "index": "not_analyzed" } | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or 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
{ | |
"query": { | |
"nested": { | |
"path": "advisers", | |
"score_mode": "max", | |
"query": { | |
"geo_shape": { | |
"location": { | |
"shape": { | |
"type": "point", | |
"coordinates": [-0.702309, 51.508525] | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment