laravel - laravel 中的 Elasticsearch geo_point 映射
问题描述
我正在尝试将我的位置映射为“geo_point”。我使用 mysql DB 将点类型数据存储为“位置”。这是我的模型-'GeoSearch'的代码。
`protected $mapping = [
'properties' => [
'id' => [
'type' => 'integer',
'index' => 'not_analyzed'
],
'Address' => [
'type' => 'string',
'analyzer' => 'english'
],
'city' => [
'type' => 'string',
'analyzer' => 'english'
],
'area' => [
'type' => 'string',
'analyzer' => 'english'
],
'location' => [
'type' => 'geo_point',
'ignore_malformed' => true
],
]
];`
但是,当我尝试使用 scout 进行索引时php artisan scout:import "App\GeoSearch"
,会显示以下错误。
"type":"illegal_argument_exception","reason":"mapp
er [location] of different type, current_type [text], merged_type [geo_poin
t]"}]
这是我的数据示例。由于“位置”存储为空间数据类型“点”,因此它以字节串形式显示。
{
"id": 32817,
"longitude": "90.36189739",
"latitude": "23.80241151",
"Address": "abc",
"city": "X",
"area": "Y",
"location": "0x000000000101000000B2A3AB53299756404C6239D76ACD3740",
}
提前致谢 :)
解决方案
推荐阅读
- db2 - 将两行合并为具有相同ID的一行sql db2
- flutter - 颤动问题中的HTTP调用类型转换错误
- gremlin - Gremlin:如何找到源自起始节点并与特定其他节点有连接的节点?
- javascript - 如何在没有推送序列的情况下验证弹出序列?
- python - 无法在带有 Python 3.8 的 Conda 环境中安装 matplotlib
- python - 在 matplotlib.pyplot 中绘制带有日期的线性回归
- django - 努力显示 django 验证消息
- c++ - 菜单按钮触发另一个窗口
- python - 将两个时间序列与 tz 感知的日期时间索引相结合
- angular - 您如何处理动态加载内容上的“检查后表达式已更改”?