Hi Team,

I wanted to update the datatype of latitude and longitude fields from 
double to geo_points .

Index name  :- visit.hippo_en
Type :- visit:PlaceDocument

PUT /visit.hippo_en/visit:PlaceDocument/_mapping
{ 
    "location": {
      "properties" :{
        "coordinates": {
            "properties":{
              "coordinates": {
                 "properties":{ 
                    "latitude": {
                        "type": "geo_point"
                       
                     },
                     "longitude": {
                        "type": "geo_point"
                       
                     }
                 }
              }
                 
          }
        }
      }
   }
}

then getting below error 


{
   "error": "MapperParsingException[Root type mapping not empty after 
parsing! Remaining fields:   [location : 
{properties={coordinates={properties={coordinates={properties={latitude={type=geo_point},
 
longitude={type=geo_point}}}}}}}]]",
   "status": 400
}

when trying to update through java API
below is the code

CreateIndex createIndex = new CreateIndex.Builder(visitHippoIndexName + 
UNDERSCORE + lang).build();
jestClient.execute(createIndex);

String geoPointMapping = "\n" +
"    \"location\": {\n" +
"      \"properties\" :{\n" +
"        \"coordinates\": {\n" +
"            \"properties\":{\n" +
"              \"coordinates\": {\n" +
"                 \"properties\":{ \n" +
"                    \"latitude\": {\n" +
"                        \"type\": \"geo_point\"\n" +
"                       \n" +
"                     },\n" +
"                     \"longitude\": {\n" +
"                        \"type\": \"geo_point\"\n" +
"                       \n" +
"                     }\n" +
"                 }\n" +
"              }\n" +
"                 \n" +
"          }\n" +
"        }\n" +
"      }\n" +
"   }";

if(nodeType.equals("visit:PlaceDocument")){
PutMapping keyMapping = new PutMapping.Builder(visitHippoIndexName + 
UNDERSCORE + lang, nodeType, geoPointMapping).build();
jestClient.execute(keyMapping);
}


Index index = new Index.Builder(source).index(visitHippoIndexName + 
UNDERSCORE + lang).type(nodeType).id(handleNode.getIdentifier()).build();
jestClient.execute(index);

It gives me below exception

2015-03-24 10:27:13,787][DEBUG][action.admin.indices.mapping.put] 
[Carnivore] failed to put mappings on indices [[visit.hi
po_en]], type [visit:PlaceDocument]
rg.elasticsearch.index.mapper.MapperParsingException: malformed mapping no 
root object found
       at 
org.elasticsearch.index.mapper.DocumentMapperParser.extractMapping(DocumentMapperParser.java:338)
       at 
org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:183)
       at 
org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:444)
       at 
org.elasticsearch.cluster.metadata.MetaDataMappingService$4.execute(MetaDataMappingService.java:505)
       at 
org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:329)
       at 
org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(Prio
itizedEsThreadPoolExecutor.java:153)
       at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
       at java.lang.Thread.run(Thread.java:745)

i am giving the root object which is location in this case.
But still error.

Please advise how to update the double object to geopoints?


Thanks,
Nidhi



-- 
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/776927e3-e551-4269-bf17-962134a4b17a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to