Skip to content

Instantly share code, notes, and snippets.

@nickpeihl
Created October 25, 2018 21:59
Show Gist options
  • Save nickpeihl/4ecbe179485a50b2f80f1357b12745e8 to your computer and use it in GitHub Desktop.
Save nickpeihl/4ecbe179485a50b2f80f1357b12745e8 to your computer and use it in GitHub Desktop.
Elasticsearch tests with GeoJSON winding order
PUT rhr_test
{
"mappings": {
"doc": {
"properties": {
"geometry": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "1.0m",
"distance_error_pct": 0.025
}
}
}
}
}
POST _bulk
{ "index": { "_index": "rhr_test", "_type": "doc" } }
{ "geometry": {"type":"Polygon","coordinates":[[[100,0],[100,1],[101,1],[101,0],[100,0]],[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]},"properties":{"rfc7946":"false"} }
{ "index": { "_index": "rhr_test", "_type": "doc" } }
{ "geometry": {"type":"Polygon","coordinates":[[[100,0],[101,0],[101,1],[100,1],[100,0]],[[100.2,0.2],[100.2,0.8],[100.8,0.8],[100.8,0.2],[100.2,0.2]]]},"properties":{"rfc7946":"true"} }
GET rhr_test/_search
{
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_shape": {
"geometry": {
"shape": {
"type": "point",
"coordinates": [
100.9149169921875,
0.41198375451568836
]
},
"relation": "contains"
}
}
}
}
}
}
GET rhr_test/_search
{
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_shape": {
"geometry": {
"shape": {
"type": "point",
"coordinates": [
100.54412841796875,
0.47789973201328145
]
},
"relation": "contains"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment