2017-08-01 48 views
1

我對Elasticsearch相當陌生,而且我試圖用Kibana可視化一些JSON數據。我遇到的麻煩是地理點映射格式。JSON帶有不匹配Elasticsearch文檔格式的字段的地理點映射

含有相關位置字段的JSON對象(LON/LAT)看起來像這樣:

"geoNetwork": { 
    "city": "Test City", 
    "cityId": "1234567", 
    "continent": "Americas", 
    "country": "Canada", 
    "latitude": "44.1234", 
    "longitude": "-63.6940", 
    "metro": "(not set)", 
    "networkDomain": "bellaliant.net", 
    "networkLocation": "bell aliant regional communications inc.", 
    "region": "Nova Scotia", 
    "subContinent": "Northern America" 
    }, 

此不匹配Elasticsearch文檔中的地理點的格式(https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html,第一實例),經度和緯度不是geoNetwork(位置)對象中唯一的兩個鍵。

有沒有一種方法來定義地理點映射,以便我可以按原樣使用JSON,還是必須修改JSON模式以使對象與地圖中的某個地理點格式匹配文檔?

回答

0

可悲的是你問是不可能:(

Elasticsearch 需要一個GeoPoint/GeoLocation中/ ......對於任何地理操作。

從那裏所以

,我會建議您更新JSON用新的GeoPoint領域。

如果因爲某些技術原因,這是不可能的,雖然我沒有用他們自己,我會查找elasticsearch攝入管道。它的行爲與SQL觸發器類似。您可以在索引處理之前動態添加新字段,這意味着您可以在經緯度字段中插入一個新的GeoPoint字段。

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

食入管道https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html

相關問題