2016-08-04 8 views

答えて

0

あなたはgeo_shape circle typeとして(以下areaという名前の)あなたの場所と半径を格納し、area与えられた点を含む文書のためのgeo_shape query検索を使用できます。

# 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

これで運がいいですか? – Val

+0

遅く応答して申し訳ありません!はい、これは私がそれを達成した方法です、ありがとう! –