Elasticsearch throw error on mappings

Hi Team

I am running on Elasticsearch 6.3, i am generate some geo-data from my script to elasticsearch through Elasticsearch python API.

my geo-point mapping according to https://www.elastic.co/guide/en/elasticsearch/reference/6.x/geo-point.html

mappings = {
   "_doc": {
      "properties": {
        "location": {
          "type": "geo_point"
        }
      }
   }
}

So first thing i am doing is to create indices by es.indices.create(index='dns_data', body=mappings)

And i am getting following error, anything wrong with my code?

TransportError(400, u'illegal_argument_exception', u'unknown setting [index._doc.properties.location.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings')

Regards
Chen Jun

I think the content of mappings should be quoted, right?

Hi Mark,

Thanks for your reply ..

You mean something like this?

mappings = {
"mappings": {
"_doc": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}

and

es.indices.create(index='dns_data', body=mappings)

Is that right?

Hi Mark,

I have get it working, thanks for your advice!

Can you share your solution, it might help someone in future :slight_smile:

Hi Mark,

I am using following mapping, and i thought i

mappings = {
"mappings": {
"_doc": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}

then use this mapping to create an indice "es.indices.create(index='dns_data', body=mappings)"

After that when post the location value over use following format, should be able to get the geo_point at elasticsearch index..
{'location':[{'lat':latitude, 'lon':longitude}]}

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