1.場景描述
ES中創建映射
PUT /usertag/_doc/_mapping?pretty
{
"_doc": {
"properties": {
"memberId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"phone": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"sex": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"channel": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"subOpenId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"address": {
"type": "text"
},
"regTime": {
"type": "date"
},
"orderCount": {
"type": "long"
},
"orderTime": {
"type": "date"
},
"orderMoney": {
"type": "float"
},
"favGoods": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"freeCouponTime": {
"type": "date"
},
"couponTimes": {
"type": "date"
},
"chargeMoney": {
"type": "double"
},
"overTime": {
"type": "long"
},
"feedBack": {
"type": "long"
}
}
}
}
2.報錯信息
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/usertag/_doc/_mapping] contains unrecognized parameter: [pretty ] -> did you mean [pretty]?"
}
],
"type": "illegal_argument_exception",
"reason": "request [/usertag/_doc/_mapping] contains unrecognized parameter: [pretty ] -> did you mean [pretty]?"
},
"status": 400
}
3.錯誤分析
關鍵語句:illegal_argument_exception
contains unrecognized parameter: [pretty ] -> did you mean [pretty]
意思:非法參數,包含不識別的參數:pretty空格 是不是想用pretty
4.解決問題
去掉pretty後邊的空格即可
5.最終結果
{
"acknowledged" : true
}