2015-11-05 169 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)的正确索引(?),从而可搜索。