【发布时间】:2016-08-11 20:12:35
【问题描述】:
哟!过去几天在处理 elasticsearch 2.x 中的“geo_point”映射时遇到了一些问题。在尝试映射我的模拟数据以包含“geo_point”时,我在运行以下脚本时在控制台中收到错误:
curl -XDELETE localhost:9200/users
curl -XPOST localhost:9200/users -d "{"mappings":{"user":{"properties":{"coords":{"type":"geo_point"}}}}}"
{"error":{"root_cause":[{"type":"parse_exception","reason":"failed to parse source for create index"}],"type":"parse_exception","reason":"failed to parse source for create index","caused_by":{"type":"json_parse_exception","reason":"Unrecognized token 'geo_point': was expecting ('true', 'false' or 'null')\n at [Source: [B@4d7cc1ea; line: 1, column: 56]"}},"status":400}%
我的模拟数据如下:
{
...
"coords": [-84.370829, 33.756670] //<lon, lat>
...
}
它默认将我的“坐标”保存为双精度类型。我确保在使用我的 mongodb 集合中的数据播种 ES 之前运行上述脚本。我可以使用他们的 geoNear 函数很好地查询 Mongo,但出于性能原因,需要 ES 来进行地理查询。
任何帮助都会很棒!
【问题讨论】:
标签: curl elasticsearch geolocation geospatial elasticsearch-2.0