# Why mapping isn't woking with python Elasticsearch?

**URL:** <https://discuss.elastic.co/t/why-mapping-isnt-woking-with-python-elasticsearch/235600>\
**Category:** Elasticsearch\
**Created:** [June 3, 2020, 4:15pm UTC](https://discuss.elastic.co/t/why-mapping-isnt-woking-with-python-elasticsearch/235600 "2020-06-03T16:15:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![New\_user](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/new_user/32/46098_2.png) [@New\_user](https://discuss.elastic.co/u/New_user)\
**Post date:** [June 3, 2020, 4:15pm UTC](https://discuss.elastic.co/t/why-mapping-isnt-woking-with-python-elasticsearch/235600/1 "2020-06-03T16:15:39Z")

</div>

I need to map lat, long to geo-point. I stream data every 10 seconds from a website. I get only first occurrence of the "position" from json and only I take lat, long and timestamp. I did mapping and when I run my code the data is streaming but can't see the mapping in Kibana.

Here is my code.

```auto
import time,schedule
import requests
from elasticsearch import Elasticsearch 
import warnings
import sys
warnings.filterwarnings("ignore")
import logging
import json

log_format = "%(asctime)s::%(levelname)s::%(name)s::"\
             "%(filename)s::%(lineno)d::%(message)s"
logging.basicConfig(stream=sys.stdout, level=logging.INFO, format=log_format)

URL = "https://www.n2yo.com/rest/v1/satellite/positions/25544/41.702/-76.014/0/2/&apiKey=key"

def connectES():
	es = Elasticsearch('http://ip:port',timeout=600)
	logging.info('Step 1: Connect to Elasticsearch: OK!!')
	return es
	
es = connectES()

settings = {
             'settings': {
                         'number_of_shards':1,
                         'number_of_replicas':0
                         },
              'mappings': {
                          'properties':{
                                   'satlatitude':{'type':'geo_point'},
                                   'satlongitude':{"type":'geo_point'},
                                   'timestamp':{'type':'float'}
                                           
                                        }
                          }
           }
es.indices.create(index = "satellitepositions", ignore = 400, body=settings)

def collect_data():
  data = requests.get(url = URL).json() 
  del data['positions'][1]
  
  my_dict={}
  my_dict["satlatitude"]= data["positions"][0]["satlatitude"]
  my_dict["satlongitude"]= data["positions"][0]["satlongitude"]
  my_dict["timestamp"]= data["positions"][0]["timestamp"]

  new_data = json.dumps(my_dict)
  
  es.index(index='satellitepositions', doc_type='satelitepos', body=new_data)
  
  logging.info('Step 2: Data streaming and saving to Elasticsearch : OK!!')
    
  
schedule.every(10).seconds.do(collect_data)

while True:
  schedule.run_pending()
  time.sleep(1) 

```

Output in Kibana:

 ![kibana_result](https://us1.discourse-cdn.com/elastic/original/3X/d/b/dba0bb5636623e5a0447a32ec9b6af118ceffacb.png)

 ![2](https://us1.discourse-cdn.com/elastic/original/3X/f/9/f9008a7354898638262a0b02ad54f3c03c60092d.png)

 ![3](https://us1.discourse-cdn.com/elastic/original/3X/e/b/eb3fe4690f66e43662ec6d1bb508d8d76ce4e4f6.png)

Can some one tell me where the my error is...  
Thanks

---

<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:** [July 1, 2020, 4:15pm UTC](https://discuss.elastic.co/t/why-mapping-isnt-woking-with-python-elasticsearch/235600/2 "2020-07-01T16:15:48Z")

</div>

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