Uploading scooter data to Kibana (analyzing geo data later on)

Hello guys,

I am very new to Kibana and would like to analyze scooter data to learn about:

  • distance travelled per scooter, e.g. per day
  • number of rides per scooter, e.g. per day
  • position of the scooters (e.g. in a heatmap)
  • battery status (e.g. average, day curve)
  • (...)

My first question is how I get the data into Kibana to be able to analyze it in regards to the aim above.
As an input I have .json files that look like the following. It shows for every scooter (id) the current battery level and location. I have this kind of file for every 2 minutes.

    "id": "9408a9a2-e421-4eff-b9ff-c173297b3580",
    "state": "ACTIVE",
    "lastLocationUpdate": "2020-04-19T15:33:24Z",
    "lastStateChange": "2020-04-14T09:25:19Z",
    "batteryLevel": 31,
    "lat": 57.713175,
    "lng": 11.979854,
    "maxSpeed": 20,
    "zoneId": "GOTHENBURG",
    "licencePlate": "233232",
    "vin": "AC233232",
    "code": 233232,
    "isRentable": true,
    "iotVendor": "okai"
    "id": "9c27eb36-b5ce-47ef-a420-03bcfa255b71",
    "state": "ACTIVE",
    "lastLocationUpdate": "2020-04-19T15:32:25Z",
    "lastStateChange": "2020-04-16T11:30:40Z",
    "batteryLevel": 79,
    "lat": 51.932435,
    "lng": 7.613829,
    "maxSpeed": 20,
    "zoneId": "MUENSTER",
    "licencePlate": "269WSA",
    "vin": "AC225888",
    "code": 225888,
    "isRentable": true,
    "iotVendor": "okai"

What I've done so far: (might be completely wrong way)

After completing the Kibana tutorial I tried to upload the files to elastic.. as an index(?).
That did not work so I rearanged the files using python and created a .json file for every combination of timestamp and id:

{"@timestamp": "2020-04-19T17:40:00Z", "id": "0a18b4cc-6a74-4868-b12e-e1a9be6ff955", "battery": 41, "geo": {"coordinates": {"lat": 52.366745, "lon": 9.696898}}}

Uploading to elastic worked then but not the steps I tried after that.
I thought that I probably need a mapping like in the tutorial so I did that first:

`PUT /tier_sample_2020_04_19_new
  "mappings": {
    "properties": {
      "battery": {"type": "integer"},
      "geo": {
        "properties": {
          "coordinates": {
            "type": "geo_point"

But when I now try to upload the files it gives me an error:

For the upload I am using python aswell:

`res = requests.get('http://localhost:9200')
print (res.content)
es = Elasticsearch([{'host': 'localhost', 'port': '9200'}])

i = 0

for filename in os.listdir(directory):
	if filename.endswith(".json"):
		f = open(filename)
		docket_content = f.read()
		# Send the data into es
		es.index(index='tier_sample_2020_04_19_new', doc_type='docket', id=i, body=json.loads(docket_content))
		i = i + 1`

I hope someone can help me. :smiley: For me as a non computer science student this is all very new to me... Rough hints which videos etc. I should check out are also appreciated!

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