Create map using longitude and latitude coordinates

I have data coming into elastic that contains the longitude, latitude and even altitude points. I would like to have these plotted on a coordinate map in kibana. Search results showed I need to map another field that is of type: geo_point. I have done that but not sure what is next if the data data is already in elastic and was imported directly into elastic. Some mention the use of a template but I don't understand what to do with it or how.

  "mappings" : {
   "_meta" : {
    "created_by" : "ml-file-data-visualizer"
   },
   "properties" : {
    "collection" : {
      "type" : "keyword"
    },
    "created" : {
      "properties" : {
        "$date" : {
          "type" : "long"
        }
      }
    },
    "location" : {
      "type" : "geo_point"
    },
    "mAccuracy" : {
      "type" : "double"
    },
    "mAltitude" : {
      "type" : "double"
    },
    "mBearing" : {
      "type" : "double"
    },
    "mHasAccuracy" : {
      "type" : "boolean"
    },
    "mHasAltitude" : {
      "type" : "boolean"
    },
    "mHasBearing" : {
      "type" : "boolean"
    },
    "mHasSpeed" : {
      "type" : "boolean"
    },
    "mLatitude" : {
      "type" : "double"
    },
    "mLongitude" : {
      "type" : "double"
    },
    "mProvider" : {
      "type" : "keyword"
    },
    "mSpeed" : {
      "type" : "double"
    },
    "mTime" : {
      "properties" : {
        "$date" : {
          "type" : "long"
        }
      }
    },
    "mg_id" : {
      "type" : "keyword"
    },
    "profile_id" : {
      "type" : "keyword"
    },
    "type" : {
      "type" : "keyword"
    },
    "updated" : {
      "properties" : {
        "$date" : {
          "type" : "long"
        }
      }
    }
  }
}

}
}

It sounds like you have most of the steps figured out.

You need to index the data into an index with a mapping, and the one you pasted above looks good.

If your data was previously indexed in some other format, you need to reindex using reindex or update_by_query

1 Like

Thanks for responding. I managed to do the reindex and then viewed data in discover to confirm. The new index did not have the field. So my next question is, do I need to send new data to the index that has the field location, with the 2 lat and long values or will the existing mlat and mlong double values be mapped for me.

Ok so I did everything again and I did resend the data to include a location field. When I try to map the data it say add layer and select source. I select documents but my index does not appear. why?

Sorry nevermind, refreshed the index pattern and it works. Data surprises me though cause locations are way off.

Glad you figured out some of the mapping issues! I'm not sure what would cause locations to be in a place you don't expect- I would recommend opening another thread to ask, and you can include sample documents including sample coordinates

I actually confirmed the locations in google maps, so the coordinates were correct and the info provided to me on what to expect was not. Thanks for your help.

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