Mapper parsing exception: Root mapping definition has unsupported parameters

PUT /ag2_vehicle_stats
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"doc": {
"properties": {
"vin": {
"type": "keyword"
},
"error_reported": {
"type": "integer"
},
"num_records": {
"type": "integer"
},
"start_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"end_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"num_days": {
"type": "integer"
}
}
}
}
}

Then, I got the following error msg:
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [doc : {properties={odo_index={type=integer}, battery_usage_high={type=integer}, daily_fuel_dist_p99={type=double}, num_records={type=integer}, new_seg_battery_drive_energy_capacity_in_kwh={type=double}, cell_volt_diff_drive_mean_now={type=double}, city_last_day={type=keyword}, battery_life_in_days={type=integer}, total_distance_on_battery={type=integer}, daily_batt_dist_p99={type=double}, daily_charge_energy_avg_in_kwh={type=double}, num_days={type=integer}}}]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [doc : {properties={odo_index={type=integer}, battery_usage_high={type=integer}, daily_fuel_dist_p99={type=double}, num_records={type=integer}, new_seg_battery_drive_energy_capacity_in_kwh={type=double}, cell_volt_diff_drive_mean_now={type=double}, city_last_day={type=keyword}, battery_life_in_days={type=integer}, total_distance_on_battery={type=integer}, daily_batt_dist_p99={type=double}, daily_charge_energy_avg_in_kwh={type=double}, num_days={type=integer}}}]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [doc : {properties={odo_index={type=integer}, battery_usage_high={type=integer}, daily_fuel_dist_p99={type=double}, num_records={type=integer}, new_seg_battery_drive_energy_capacity_in_kwh={type=double}, cell_volt_diff_drive_mean_now={type=double}, city_last_day={type=keyword}, battery_life_in_days={type=integer}, total_distance_on_battery={type=integer}, daily_batt_dist_p99={type=double}, daily_charge_energy_avg_in_kwh={type=double}, num_days={type=integer}}}]"
}
},
"status" : 400
}

What's wrong here?

I have changed "doc" to "_doc" and got new error as below:

The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true

Remove it entirely.

Thank you for the help David. It solved my problem.

Now another issue here:

I tried to put the command in python code to automate the process:
curl -H Content-Type:application/json --user admin:dev -XPUT localhost:9200/ag2_vehicle_stats-2020-03-23 -d @/home/elk-daily-updates/ag2_vehicle_stats.json

However, I got the following error msg:
"took" : 59303,
"errors" : true,
"items" : [
{
"index" : {
"_index" : "ag2_vehicle_stats-2020-03-23",
"_type" : "doc",
"_id" : "Nz0aHnEBZhYEtxZotiMK",
"status" : 400,
"error" : {
"type" : "illegal_argument_exception",
"reason" : "Rejecting mapping update to [ag2_vehicle_stats-2020-03-23] as the final mapping would have more than 1 type: [_doc, doc]"
}
}
}

What is wrong with the command above?

.

Most likely your json file is using doc instead of _doc as the type name.

Yeah, it works now.

Thanks for your help, David!

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