【发布时间】:2020-03-02 14:46:03
【问题描述】:
谁能指导我将位置的映射类型更改为geo_point。
服务:Aws ElasticSearch(6.2 版本) 数据库:dynamodb
我正在使用 aws 弹性搜索服务根据我的位置过滤值。 根据文档,我创建了一个触发器 lambda 函数 dbtoEs,它是在记录被添加索引后不久的 python 代码。
因为我在 dynamodb 中的位置类型是 输入位置 { 纬度:浮动 lon:浮点数 }
当我转到 Aws ElasticSearch 并检查索引时,该字段的映射类型也是 地点 { 纬度浮动 浮子 }
根据弹性地理距离查询 (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**
【问题讨论】:
标签: amazon-web-services react-native elasticsearch