往 ElasticSearch 写数据的时候报了个奇怪的错误:
Exception in thread "main" ElasticsearchParseException[field must be either lat/lon or geohash]
查看 ES 索引发现 location 字段是 geo_point 类型的,我在 Java 代码里对应字段使用的是 ES 提供的 GeoPoint 字段,感觉序列化之后写入 ES 不应该报错。
翻了 ES 的文档,geo_point 类型支持的数据格式有四种:
PUT my_index/my_type/1
{
"text": "Geo-point as an object",
"location": {
"lat": 41.12,
"lon": -71.34
}
}
PUT my_index/my_type/2
{
"text": "Geo-point as a string",
"location": "41.12,-71.34"
}
PUT my_index/my_type/3
{
"text": "Geo-point as a geohash",
"location": "drm3btev3e86"
}
PUT my_index/my_type/4
{
<