2015-11-05 142 views
0

我想獲得一個記錄相交圓的列表。elasticsearch geo_shape查詢返回沒有結果

的映射: 我有一個geo_point和geo_shape但我在geo_shape專門

{ 
    "mappings": { 
     "poi": { 
     "properties": { 
      "id": { 
       "type": "string", 
       "index": "not_analyzed" 
      }, 
      "type": { 
       "type": "string", 
       "index": "not_analyzed" 
      }, 
      "name": { 
       "type": "string", 
       "analyzer": "whitespace" 
      }, 
      "pin": { 
       "type": "geo_point" 
      }, 
      "geometry": { 
       "type": "geo_shape", 
       "tree": "quadtree", 
       "precision": "1m" 
      }, 
      "extras": { 
       "type": "object" 
      } 
     } 
     } 
    } 
} 

記錄(第一個列表,不一定匹配)

{ 
    "id": 416824728, 
    "pin": [ 
     11.2418666, 
     46.4718564 
    ], 
    "geometry": { 
     "type": "Point", 
     "coordinates": [ 
     11.2418666, 
     46.4718564 
     ] 
    }, 
    "extras": { 
     "capacity": "5", 
     "amenity": "parking", 
     "fee": "no" 
    }, 
    "name": "", 
    "type": "poi" 
} 

查詢指:

{ 
    "query": { 
     "filtered": { 
     "query": { 
      "match_all": {} 
     }, 
     "filter": { 
      "geo_shape": { 
       "geometry": { 
        "shape": { 
        "type": "circle", 
        "radius": "100km", 
        "coordinates": [ 
         11, 
         46 
        ] 
        } 
       } 
      } 
     } 
     } 
    } 
} 

有什麼建議嗎?

感謝

+0

我已經創建了索引/映射並添加了您共享的示例文檔,並且您的搜索查詢完全返回該文檔。你能告訴你如何做查詢(什麼客戶端,哪個HTTP方法,哪個URL,...)? – Val

+0

是的,我有我的自我嘗試相同的結果..看到我的回覆 (其實我已經交叉發佈從這裏https://discuss.elastic.co/t/geo-shape-query-return-empty-set/ 33860) 謝謝 – lcapra

回答

0

我使用並行Node.js的大宗原料藥的實施和記錄,其中不可搜索。

利用承諾我已經使用了批量API,但只有點類型可以搜索。

切換到一個接一個地插入記錄後,所有記錄(包括Polygon和LineString)的正確索引(?),從而可搜索。