Elasticsearch PUT 插入數據

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.atype_id] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "unknown setting [index.atype_id] please check that any required plugins are installed, or check the breaking changes documentation for removed settings",
    "suppressed": [
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.id] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.name] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.package] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.rank] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.state] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      },
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.status] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
      }
    ]
  },
  "status": 400
}

當出現   illegal_argument_exception 時候 意思是非法參數異常。也就是URI 缺乏參數。在建立Elasticsearch的index 有一個 type (也就是Mysql數據中的表名), 在curl的時候沒有輸入這個type的話php

就會報錯sql

unknown setting [index.status] please check that any required plugins are installed, or check the breaking changes documentation for removed settings出現這個錯誤,這個錯誤就說明 你在插入數據的時候 不知道你要把你的這條數據插入到哪一個表裏面去,因此就報錯了。相似於Mysql 由於要指定一張表的插入,不能隨便插入不是。。。。json

 

因此 正確的方法 URL 是app

curl -H "Content-Type: application/json" -X PUT 'http://localhost:9200/index/type' -d
相關文章
相關標籤/搜索