1、使用postman请求数据
http://localhost:9200/megacorp/employee/_search
2、出现以下错误
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "Unknown key for a VALUE_STRING in [first_name].",
"line": 2,
"col": 23
}
],
"type": "parsing_exception",
"reason": "Unknown key for a VALUE_STRING in [first_name].",
"line": 2,
"col": 23
},
"status": 400
}
3、原因:因为我的请求body里包含了数据
{
"first_name": "John",
"last_name": "Smith",
"age": 27,
"about": "I love to go rock climbing",
"interests": [
"sports",
"music"
]
}
4、删除body数据重新请求,结果如下
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1.0,
"hits": [
{
"_index": "megacorp",
"_type": "employee",
"_id": "2",
"_score": 1.0,
"_source": {
"first_name": "Jane",
"last_name": "Smith",
"age": 32,
"about": "I like to collect rock albums",
"interests": [
"music"
]
}
},
{
"_index": "megacorp",
"_type": "employee",
"_id": "1",
"_score": 1.0,
"_source": {
"first_name": "John",
"last_name": "Smith",
"age": 27,
"about": "I love to go rock climbing",
"interests": [
"sports",
"music"
]
}
}
]
}
}
Comments NOTHING