Mapping to dynamic type of index


(Giovanni Di Lembo) #1

Hi all,
I try to map to all my dynamic type a mapping like that:

PUT my_index
{
     "mappings" : {
     "_doc": {
       "properties":{
 	   "magnitude":{"type": "float"},
    "phase":{"type": "float"},
    "time":{"type": "float"},
     "time_ms":{"type": "float"}
    }  
  }  
 }
}

Now when I try to post an object like this:

POST my_index/10001
{
         "magnitude" : 0.22864656066894531,
         "phase" : 44.902667641471815,
         "time" : 1.53259831858E9,
	"time_ms" : 1.53259831858E9

  }

I got :

    error":{
          "root_cause":[
             {
                "type": "illegal_argument_exception",
                "reason": "Rejecting mapping update to [webwams] as the final mapping would have more 
                  than 1 type: [_doc, 10001]"
             }
         ],
          "type": "illegal_argument_exception",
          "reason": "Rejecting mapping update to [webwams] as the final mapping would have more than 
          1 type: [_doc, 10001]"
    },
    "status": 400
    }

(Gaetan Gingras) #2

Hi,

You are missing the _doc type in your post request :

POST my_index/_doc/10001
{
         "magnitude" : 0.22864656066894531,
         "phase" : 44.902667641471815,
         "time" : 1.53259831858E9,
	     "time_ms" : 1.53259831858E9
} 

Regards,

Gaetan


(system) #3

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