Newbie creating Elasticstack data with geo_point

I'm rather new to Elasticsearch and am trying to create data with a geo_point it it, similar to the example of log data that I saw in the Loading Sample Data tutorial. I am doing the following:

 curl -XPUT localhost:9200/foo-2016-12-15 -d '{
  "mappings": {
    "log": {
      "properties": {
        "coords": {
          "type": "geo_point"
        }
      }
    }
  }
}'
curl -XPUT 'localhost:9200/foo-2016-12-15/external/1481830503?pretty&pretty' -d '{
  "status": "True",
  "datacenter": "pok",
  "slack": "False",
  "lognum": 80055,
  "@timestamp": "2016-12-15T19:35:03.000Z",
  "flow": "Manager",
  "secs": 1481830503.0,
  "coords": {
    "lat": 41.7003713,
    "lon": -73.9209701
  }
}'

This fails for me with:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "remote_transport_exception",
        "reason" : "[D2phcF7][127.0.0.1:9300][indices:data/write/index[p]]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "[coords] is defined as an object in mapping [external] but this name is already used for a field in other types"
  },
  "status" : 400
}

What am I doing wrong? I would be happy to change the mapping or data as long as I can get it to work.

Your mapping is defined for a document of type "log" but your document is of the type "external".

Thanks, that helped. I got it working!

1 Like

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