云搜索的latlon格式

问题描述 投票:0回答:1

我想在云搜索中做地理搜索,我做索引是这样的:

enter image description here

当我上传文件时

[{"type": "add", "id": "kdhrlfh1304532987654321987654321", "fields":{"name": "user1", "latlon":[12.628611, 120.694152] , "phoneverifiedon": "2015-05-04T15:39:03Z", "fbnumfriends": 172}},
{"type": "add", "id": "kdhrlfh1304532987654321987654322", "fields": {"name": "user2", "latlon":[12.628645,20.694178] , "phoneverifiedon": "2015-05-04T15:39:03Z", "fbnumfriends": 172}}]

我遇到以下错误

Status: error
Adds: 0
Deletes: 0
Errors:
{ ["Field "latlon" must have array type to have multiple values (near operation with index 1; document_id kdhrlfh1304532987654321987654321)","Validation error for field 'latlon': Invalid latlon value 12.628611"] }

我为“latlon”字段尝试了多种格式 请建议 cloudsearch 中 lat long 的正确格式是什么

amazon-dynamodb amazon-cloudsearch
1个回答
4
投票

文档提交的正确语法是单个字符串,两个值以逗号分隔,例如

"latlon" : "12.628611, 120.694152"

[
  {
    "type": "add",
    "id": "kdhrlfh1304532987654321987654321",
    "fields": {
      "name": "user1",
      "latlon" : "12.628611, 120.694152"
      "phoneverifiedon": "2015-05-04T15:39:03Z",
      "fbnumfriends": 172
    }
  }
]

提交语法与查询语法不匹配,使用数组表示经纬度,这绝对令人困惑

https://forums.aws.amazon.com/thread.jspa?threadID=151633

© www.soinside.com 2019 - 2024. All rights reserved.