有人可以指导我将位置的地图类型更改为geo_point吗??
服务:AWS ElasticSearch(6.2版) 数据库:dynamodb
我正在使用aws弹性搜索服务根据我的位置过滤值。 根据文档,我创建了一个触发器lambda函数dbtoEs,这是在添加记录索引后不久的python代码。
因为我在dynamodb中的位置类型是 输入位置{ lat:浮动 lon:浮动 }
当我转到AWS ElasticSearch并检查索引时,此字段的映射类型也是 位置 { 浮动 lon float }
根据弹性地理距离查询(https://www.elastic.co/guide/en/elasticsearch/reference/6.2/query-dsl-geo-distance-query.html),位置的映射类型应为 geo_point
搜索查询过滤器示例
filter:[
{
geo_distance:{
distance:"2000 km",location:{
lon:77.676,lat:12.998
},}
},{
range:{
createdAt:{
gte:"now-1d/d"
}
}
}
],
搜索响应
{
"took":4,"timed_out":false,"_shards":{
"total":5,"successful":4,"skipped":0,"failed":1,"failures":[
{
"shard":4,"index":"spot","node":"*******","reason":{
"type":"query_shard_exception","reason":"failed to find geo_point field
[location]","index_uuid":"**********","index":"***"
}
}
]
},"hits":{
"total":0,"max_score":null,"hits":[
]
}
}
**Result Required: Filtered results should be based on location**