Reputation: 13
I am trying to create an elasticsearch index with python whose content is a series of coordinates to later visualize this data in a kibana map.
Unfortunately I am getting this error message:
RequestError(400, 'parse_exception', 'unknown key [properties] for create index')
This is the code I am using:
es = Elasticsearch()
mappings = {
"properties": {
"geo": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
es.indices.create(index='geodata', body=mappings)
es_entries['geo']={ 'location': str(coor[0])+","+str(coor[1])}
es.index(index='geodata', doc_type="doc", body=es_entries)
Upvotes: 1
Views: 2193
Reputation: 217274
Great job so far, you're almost there. There are a few changes to make:
mappings = {
"mappings": { <--- add this
"properties": {
"geo": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
}
es.indices.create(index='geodata', body=mappings)
es_entries['geo']={ 'location': str(coor[0])+","+str(coor[1])}
es.index(index='geodata', doc_type="_doc", body=es_entries)
^
|
modify this
Upvotes: 1