ES報錯:illegal_argument_exception

在這裏插入圖片描述


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
}

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章