错误
[body] => {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse"}],"type":"mapper_parsing_exception","reason":"failed to
parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can
only be called on some xcontent bytes or compressed xcontent ytes"}},"status":400}
将文档添加到索引时出现错误。
http://localhost:9595/patient_trimester
{
"patient_trimester": {
"aliases": {
},
"mappings": {
"_default_": {
"_all": {
"enabled": true
},
"dynamic_templates": [
{
"string_fields": {
"mapping": {
"index": "not_analyzed",
"omit_norms": true,
"type": "string"
},
"match": "*",
"match_mapping_type": "string"
}
}
],
"properties": {
"@version": {
"type": "string",
"index": "not_analyzed"
}
}
},
"patient_trimester": {
"_all": {
"enabled": true
},
"dynamic_templates": [
{
"string_fields": {
"mapping": {
"index": "not_analyzed",
"omit_norms": true,
"type": "string"
},
"match": "*",
"match_mapping_type": "string"
}
}
],
"properties": {
"@timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"@version": {
"type": "string",
"index": "not_analyzed"
},
"last_consult_by": {
"type": "string",
"index": "not_analyzed"
},
"mpi": {
"type": "string",
"index": "not_analyzed"
},
"bill_id": {
"type": "integer"
},
"bill_date": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"site": {
"type": "string",
"index": "not_analyzed"
},
"effective_edd": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"is_converted": {
"type": "integer"
},
"admitting_physician": {
"type": "string",
"index": "not_analyzed"
},
"days": {
"type": "integer"
},
"trim": {
"type": "string",
"index": "not_analyzed"
},
"tags": {
"type": "string",
"index": "not_analyzed"
}
}
}
},
"warmers": {
}
}
}
这就是我通过邮递员创建索引的方式。
$ result变量中的
(
[last_consult_by] => xxxxxx
[mpi] => xxxxxxxx
[bill_id] => 176073
[bill_date] => 2018-07-12 12:00:00
[site] => xxx
[effective_edd] => 2018-07-28 12:00:00
[is_converted] => 0
[admitting_physician] => xxxxxxxxx
[days] => 16
[trim] => Array
(
[trim3] => 1
)
)
$params = [
'index' => 'patient_trimester',
'type' => 'patient_trimester',
'body' => $result
];
$res = $client->index($params);
print_r($res); exit;
我不明白为什么发生mapper_parsing_exception。 这是因为我映射了数据类型吗?给有效_edd,bill_date的数据类型指定的映射,并且修整是正确的吗? 请帮我解决这个问题。