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

**URL:** <https://discuss.elastic.co/t/uploading-scooter-data-to-kibana-analyzing-geo-data-later-on/229332>\
**Category:** Elasticsearch\
**Created:** [April 22, 2020, 6:15pm UTC](https://discuss.elastic.co/t/uploading-scooter-data-to-kibana-analyzing-geo-data-later-on/229332 "2020-04-22T18:15:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Infinity7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/infinity7/32/66805_2.png) [@Infinity7](https://discuss.elastic.co/u/Infinity7)\
**Post date:** [April 22, 2020, 6:15pm UTC](https://discuss.elastic.co/t/uploading-scooter-data-to-kibana-analyzing-geo-data-later-on/229332/1 "2020-04-22T18:15:06Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/6/9642c7b7fb05005df79da9831edf47ff137ef3d4.png)

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. 😃 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!_

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 20, 2020, 6:15pm UTC](https://discuss.elastic.co/t/uploading-scooter-data-to-kibana-analyzing-geo-data-later-on/229332/2 "2020-05-20T18:15:08Z")

</div>

Closed on May 20, 2020, 6:15pm UTC

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