簡體   English   中英

使用AWS ElasticSearch Service實例將兩個包含地理位置和緯度的浮點字段映射到kibana中的geo_point

[英]Mapping two float fields containing geo langitude and latitude into geo_point in kibana using the AWS ElasticSearch Service Instance

我正在構建一個解決方案,該解決方案通過kinesis流和Firehose到Elastic Search域處理Lambda(Python 2.7)中的數據。 數據存儲在Python字典中,並作為JSON轉儲到Kinesis

                dataDictionary = {
                "precipitationType": precipitationType,
                "location": location,
                "humidity" : humidity,
                "groundTemp": groundTemp,
                "airTemp": airTemp,
                "windSpeed": windSpeed,
                "windDirection": windDirection,
                "measureDate": parsedMeasureDate,
                "systemDate": systemDate,
                "stationGeoLatitude": stationGeoLatitude,
                "stationGeoLongitude": stationGeoLongitude
            }
            #Push data to AWS Kinesis Stream
            res = kinesis.put_record(StreamName = LocalStreamName,Data=json.dumps(dataDictionary),PartitionKey='systemDate')

流程成功,但是想要在Kibana中的地圖上顯示結果,我只有兩個float字段,沒有geo_point / geohash字段

我無法弄清楚如何在AWS ElasticSearch Service中映射它們。 我找到了一些有關映射的文檔,但是我不知道如何在AWS中使用它。 也許我應該在Python代碼中以其他方式傳遞此數據?

您必須使用映射,並告訴elasticsearch將兩個字段映射為一個地理位置:

https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html

您將必須重新索引數據,但首先要指定映射。

您可以使用python客戶端執行此操作,也可以手動發布json映射:

放置your_index

{
  "mappings": {
    "your_type": {
      "properties": {
        "location": {
          "type": "geo_point"
        }
      }
    }
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM