Maps, geojson and display in Kibana

I want to load geojson files in Kibana. I am following the examples here https://www.elastic.co/blog/custom-region-maps-in-kibana-6-0. Need help to figure out from the point of downloading the aus_state.geojson, how do I "display" in Kibana. I tried to ingest the data using CURL (same way as the shakespeare.json). Not getting far and would appreciate some help.

The explanations starting with the "Configuring your source" section in that blog post seem pretty good. Basically, you need to tell Kibana about this new geojson via kibana.yml config, serve the geojson from a web server accessible to Kibana, and then set up an aggregation, configuring it to use your custom setup.

Got to the part where http://localhost:8000/aus_state.geojson is showing the file. Also, made the changes to kibana.yml. When following the tutorial to "The Aggregation Settings" - kind of lost of how to start. Am I to use the Visualize -> Maps -> Region Map ? For this I need to reference an index. This is the part I not connecting the dots.

Do you have an index pattern created? You will need to do that. The visualization then refers to the index pattern. And yes, that is the correct visualization type I think.

I have a index pattern created,
PUT /australia
{
"mappings": {
"features": {
"properties": {
"geometry": {
"properties": {
"STATE_NAME": {"type": "keyword"},
"STATE_CODE": {"type": "integer"}
}
}
}
}
}
}

I see that as a ES index with 0 docs. How do I load ES docs ? Logstash , curl did not work for me. I did successfully load shakespear.json in the same manner, but the aus_state.geojson gives this error:

PS C:\Users\avranc\Documents\demo\maps\aus_states> dir


    Directory: C:\Users\avranc\Documents\demo\maps\aus_states


Mode                LastWriteTime         Length Name                                                                                                                                               
----                -------------         ------ ----                                                                                                                                               
d-----         7/4/2018   9:32 AM                __MACOSX                                                                                                                                           
-a----         7/4/2018   9:32 AM        3468990 aus_state.geojson                                                                                                                                  
-a----         7/4/2018   9:32 AM         535363 aus_state.png                                                                                                                                      
-a----         7/4/2018   9:32 AM           6640 aus_state.rds                                                                                                                                      
-a----         7/4/2018   9:32 AM        3468990 JSON-aus_state.json                                                                                                                                



PS C:\Users\avranc\Documents\demo\maps\aus_states> Invoke-RestMethod "http://localhost:9200/australia/doc/_bulk?pretty" -Method Post -ContentType 'application/x-ndjson' -InFile "aus_state.geojson"

Invoke-RestMethod : {
  "error" : {
    "root_cause" : [
      {
        "type" : "json_e_o_f_exception",
        "reason" : "Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@2bebec83; line: 1, column: 1])\n at 
[Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@2bebec83; line: 1, column: 3]"
      }
    ],
    "type" : "json_e_o_f_exception",
    "reason" : "Unexpected end-of-input: expected close marker for Object (start marker at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@2bebec83; line: 1, column: 1])\n at 
[Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@2bebec83; line: 1, column: 3]"
  },
  "status" : 500
}
At line:1 char:1
+ Invoke-RestMethod "http://localhost:9200/australia/doc/_bulk?pretty"  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

First off, looks like you have created an index in Elasticsearch but not an index pattern in Kibana. This guide will walk you through creating an index pattern: https://www.elastic.co/guide/en/kibana/current/tutorial-define-index.html

After that you need data that you want to visualize on a map. The aus_state.geojson is the mapping information. You will need to add data to Elasticsearch that has geopoint data in it (and that point lies in Australia) if you want to visualize it against the geodata.

Before I create the Kibana index, how do I load the data in ES? The error above is trying to load the aus_state.geojson file. I am familiar with creating index in Kibana, so should be good there.

That file aus_state.geojson is not data that is intended to be loaded into ES, it is just the geoshapes. You need to supply your own data to load into ES. The blog post has an example.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.