When using the put mapping API you do not need to have a `mappings` object. 
 Also the type you are defining the mappings for should match the type in 
the URL.  Your request should work if you try the following:

PUT http://localhost:9200/foos/foo/_mapping
{
    "foo" : {
        "properties" : {
            "location" : {
                "type" : "geo_point"
            }
        }
    }
}

See here 
<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-put-mapping.html#indices-put-mapping>
 
for more information on the put mapping API.

On Monday, 6 October 2014 16:18:07 UTC+1, Ryan Bergman wrote:
>
> Hi,
>   I have an index with data that looks like this:
>           {
>                "id":"52534",
>                "name":"foo",
>                "location":{  
>                   "lat":39.18552295869955,
>                   "lon":-104.34581946342342
>                }
>             }
>
> I'm attempting to make a mapping for the lat/lon field so I can do 
> geospatial filters. However I get a weird error when attempting to make the 
> mapping:
>
> PUT http://localhost:9200/foos/foo/_mapping
> {
> "mappings":
> {
>     "location" : {
>         "properties" : {
>             "location" : {
>                 "type" : "geo_point"
>             }
>         }
>     }
> }
> }
>
> which results in 
> {
> error: "MapperParsingException[Root type mapping not empty after parsing! 
> Remaining fields: [mappings : 
> {location={properties={location={type=geo_point}}}}]]"
> status: 400
> }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/f6dfc5a2-c794-4a03-a563-0ee46bd7a626%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to