I am upgrading elasticsearch from 2.x to 7.x. I am trying to re-add index mappings from 2.x. I want to know how to alter a mapping to make it compatible with 7.x.
Here is the result of GET /syslog/_mapping from 2.x
{
"syslog": {
"mappings": {
"syslog": {
"properties": {
"@timestamp": {
"type": "date",
"format": "dateOptionalTime"
},
"@version": {
"type": "string"
},
"_index": {
"type": "string"
},
"_type": {
"type": "string"
},
"file": {
"type": "string"
},
"host": {
"type": "string"
},
"message": {
"type": "string"
},
"offset": {
"type": "string"
},
"received_at": {
"type": "date",
"format": "dateOptionalTime"
},
"received_from": {
"type": "string"
},
"syslog_facility": {
"type": "string"
},
"syslog_facility_code": {
"type": "long"
},
"syslog_hostname": {
"type": "string"
},
"syslog_message": {
"type": "string"
},
"syslog_pid": {
"type": "string"
},
"syslog_program": {
"type": "string"
},
"syslog_severity": {
"type": "string"
},
"syslog_severity_code": {
"type": "long"
},
"syslog_timestamp": {
"type": "string"
}
}
}
}
}
}
I try adding adding the mapping by doing this in 7.6
PUT /syslog/_mapping
{
"syslog": {
"mappings": {
"syslog": {
"properties": {
"@timestamp": {
"type": "date",
"format": "dateOptionalTime"
},
"@version": {
"type": "string"
},
"_index": {
"type": "string"
},
"_type": {
"type": "string"
},
"file": {
"type": "string"
},
"host": {
"type": "string"
},
"message": {
"type": "string"
},
"offset": {
"type": "string"
},
"received_at": {
"type": "date",
"format": "dateOptionalTime"
},
"received_from": {
"type": "string"
},
"syslog_facility": {
"type": "string"
},
"syslog_facility_code": {
"type": "long"
},
"syslog_hostname": {
"type": "string"
},
"syslog_message": {
"type": "string"
},
"syslog_pid": {
"type": "string"
},
"syslog_program": {
"type": "string"
},
"syslog_severity": {
"type": "string"
},
"syslog_severity_code": {
"type": "long"
},
"syslog_timestamp": {
"type": "string"
}
}
}
}
}
}
But I get the following error
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [syslog : {mappings={syslog={properties={syslog_pid={type=string}, syslog_severity_code={type=long}, _index={type=string}, offset={type=string}, syslog_facility={type=string}, _type={type=string}, syslog_facility_code={type=long}, syslog_program={type=string}, message={type=string}, syslog_message={type=string}, syslog_severity={type=string}, received_from={type=string}, @timestamp={format=dateOptionalTime, type=date}, file={type=string}, syslog_hostname={type=string}, received_at={format=dateOptionalTime, type=date}, syslog_timestamp={type=string}, @version={type=string}, host={type=string}}}}}]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [syslog : {mappings={syslog={properties={syslog_pid={type=string}, syslog_severity_code={type=long}, _index={type=string}, offset={type=string}, syslog_facility={type=string}, _type={type=string}, syslog_facility_code={type=long}, syslog_program={type=string}, message={type=string}, syslog_message={type=string}, syslog_severity={type=string}, received_from={type=string}, @timestamp={format=dateOptionalTime, type=date}, file={type=string}, syslog_hostname={type=string}, received_at={format=dateOptionalTime, type=date}, syslog_timestamp={type=string}, @version={type=string}, host={type=string}}}}}]"
},
"status" : 400
}
It does not tell me what the unsupported parameters are (and instead lists everything). Which parameters are not supported? How can I format it correctly so that is is accepted by the mapping API?