Kibana-working-with-coordinate-map

提供:Dev Guides
移動先:案内検索

Kibana-座標マップの操作

Kibanaの座標マップは、地理的領域を表示し、指定した集計に基づいて領域を円でマークします。

座標マップのインデックスを作成

座標マップに使用されるバケット集約は、ジオハッシュ集約です。 このタイプの集約の場合、使用するインデックスには、geo pointタイプのフィールドが必要です。 ジオポイントは、緯度と経度の組み合わせです。

Kibana開発ツールを使用してインデックスを作成し、それにバルクデータを追加します。 マッピングを追加し、必要なgeo_pointタイプを追加します。

私たちが使用しようとしているデータはここに示されています-

{"index":{"_id":1}}
{"location": "2.089330000000046,41.47367000000008", "city": "SantCugat"}
{"index":{"_id":2}}
{"location": "2.2947825000000677,41.601800991000076", "city": "Granollers"}
{"index":{"_id":3}}
{"location": "2.1105957495300474,41.5496295760424", "city": "Sabadell"}
{"index":{"_id":4}}
{"location": "2.132605678083895,41.5370461908878", "city": "Barbera"}
{"index":{"_id":5}}
{"location": "2.151270020052683,41.497779918345415", "city": "Cerdanyola"}
{"index":{"_id":6}}
{"location": "2.1364609496220606,41.371303520399344", "city": "Barcelona"}
{"index":{"_id":7}}
{"location": "2.0819450306711165,41.385491966414705", "city": "Sant Just Desvern"}
{"index":{"_id":8}}
{"location": "2.00532082278266,41.542294286427385", "city": "Rubi"}
{"index":{"_id":9}}
{"location": "1.9560805366930398,41.56142635214226", "city": "Viladecavalls"}
{"index":{"_id":10}}
{"location": "2.09205348251486,41.39327140161001", "city": "Esplugas de Llobregat"}

次に、以下に示すように、Kibana Dev Toolsで次のコマンドを実行します-

PUT/cities
{
   "mappings": {
      "_doc": {
         "properties": {
            "location": {
               "type": "geo_point"
            }
         }
      }
   }
}

POST/cities/_city/_bulk?refresh
{"index":{"_id":1}}
{"location": "2.089330000000046,41.47367000000008", "city": "SantCugat"}
{"index":{"_id":2}}
{"location": "2.2947825000000677,41.601800991000076", "city": "Granollers"}
{"index":{"_id":3}}
{"location": "2.1105957495300474,41.5496295760424", "city": "Sabadell"}
{"index":{"_id":4}}
{"location": "2.132605678083895,41.5370461908878", "city": "Barbera"}
{"index":{"_id":5}}
{"location": "2.151270020052683,41.497779918345415", "city": "Cerdanyola"}
{"index":{"_id":6}}
{"location": "2.1364609496220606,41.371303520399344", "city": "Barcelona"}
{"index":{"_id":7}}
{"location": "2.0819450306711165,41.385491966414705", "city": "Sant Just Desvern"}
{"index":{"_id":8}}
{"location": "2.00532082278266,41.542294286427385", "city": "Rubi"}
{"index":{"_id":9}}
{"location": "1.9560805366930398,41.56142635214226", "city": "Viladecavalls"}
{"index":{"_id":10}}
{"location": "2.09205348251486,41.3s9327140161001", "city": "Esplugas de Llobregat"}

今、Kibana開発ツールで上記のコマンドを実行します-

Kibana dev tools

上記は、_docタイプのインデックス名の都市を作成し、フィールドの場所はgeo_pointタイプです。

次に、インデックスにデータを追加しましょう。都市-

キバナインデックス名

インデックス名の引用をデータで作成しました。 次に、[管理]タブを使用して都市のインデックスパターンを作成します。

キバナインデックスパターン

都市インデックス内のフィールドの詳細はここに示されています-

キバナインデックスの詳細

場所のタイプはgeo_pointであることがわかります。 これを使用して視覚化を作成できます。

座標マップの使用を開始する

Visualizationに移動して、座標マップを選択します。

座標マップ

インデックスパターンの都市を選択し、以下に示すように集約メトリックとバケットを構成します-

集約メトリックの構成

分析ボタンをクリックすると、次の画面が表示されます-

分析ボタン

経度と緯度に基づいて、円は上記のように地図上にプロットされます。