2016-08-04 2 views

Antwort

0

könnten Sie speichert Ihren Standort und Radius als geo_shape circle type (area unter dem Namen) und dann eine geo_shape query Suche nach Dokumenten, deren area Verwendung enthält den gegebenen Punkt.

# 1. create the index with the geo_shape field 
PUT index 
{ 
    "mappings": { 
     "type": { 
      "properties": { 
       "area": { "type": "geo_shape" } 
      } 
     } 
    } 
} 

# 2. index a document with a shape 
PUT index/type/1 
{ 
    "area" : { 
    "type" : "circle", 
    "coordinates" : [-45.0, 45.0], 
    "radius" : "100m" 
    } 
} 

# 3. use a geo_shape query 

POST index/type/_search 
{ 
    "query":{ 
    "bool": { 
     "filter": { 
      "geo_shape": { 
       "area": { 
        "shape": { 
         "type": "point", 
         "coordinates" : [-45.0001, 45.0001] 
        }, 
        "relation": "contains" 
       } 
      } 
     } 
    } 
    } 
} 
+0

etwas Glück dabei? – Val

+0

Entschuldigung für die späte Antwort! Ja, so habe ich es geschafft, danke! –

Verwandte Themen