当试图从我索引中的记录动态搜索纬度时,我得到了一个非法的纬度值。查看我的索引时,我看不到任何无效的纬度和经度值,所以我猜这是我的代码中的错误。
准确的错误;
{"type":"query_parsing_exception","reason":"illegal latitude value [269.99999983236194] for [geo_distance]","index":"addresses","line":1,"col":172}}]},"status":400}
Run Code Online (Sandbox Code Playgroud)
用于搜索的型号代码;
def self.search(query)
__elasticsearch__.search(
{
query:{
multi_match: {
query: query,
fields: ['full_address']
}
},
filter:{
geo_distance:{
distance: "6miles",
location: "address.location"
}
}
}
)
end
Run Code Online (Sandbox Code Playgroud)
映射;
{ "addresses" : {
"mappings" : {
"address" : {
"properties" : {
"county" : {
"type" : "string"
},
"full_address" : {
"type" : "string"
},
"location" : {
"type" : "geo_point"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
} }