elasticsearch - 如何从logstash将geo_point类型数据添加到elasticsearch?

标签 elasticsearch filter logstash kibana geo

我想在我的程序中添加一些自定义地理搜索功能(不是 geoip,将 IP 地址转换为坐标)。如何将自定义纬度和经度数据过滤为 elasticsearch geo_type 格式数据,以便我可以在 kibana 平铺 map 中可视化?

最佳答案

正如您可能已经发现的,有一个(有点笨拙)的解决方案。 基本上,您需要先设置 geo_point 字段的映射,然后才能以这种方式记录数据(我还直接使用 ES python 模块,而不是通过logstash 进行记录..只是为了确定)。

那么如何设置正确的映射呢?

  1. 确保您使用新的 elasticsearch 实例(或者至少尚未设置您将使用的索引和类型的映射)

  2. 从 sense 运行(或使用适当的curl命令)

PUT <index_name> { "mappings": { "<type_name>": { "properties": { "timestamp": { "type": "date" }, "message": { "type": "string" }, "location": { "type": "geo_point" } <etc.> } } } }

现在你已经很出色了,只需确保你的 geo_points 采用 ES 除外的格式即可

有关绘制地理点的更多信息:

ElasticSearch how to setup geo_point

这里:

https://discuss.elastic.co/t/geo-point-logging-from-python-to-elasticsearch/37336

关于elasticsearch - 如何从logstash将geo_point类型数据添加到elasticsearch?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30861405/

相关文章:

elasticsearch - BadResponseCodeError,:error = >"Got response code ' 401'通过URL联系Elasticsearch

c# - 带过滤器的 Elasticsearch 建议

javascript - Js中如何按对象过滤对象

python - 在日志记录配置文件中使用外部模块

javascript - 更好的 jQuery 对象过滤

powershell - 使用 powershell 命令处理用户名中的撇号(单引号) - Get-Azureaduser

linux - Filebeat 和 Logstash 有时会读取旧文件

elasticsearch - 检查输入是否包含字段值作为子字符串

c# - Elasticsearch NEST 2.0 无法通过 ID 删除对象

php - 在elasticsearch索引中存储带有可选参数的日期时间?