繁体   English   中英

ElasticSearch 创建索引返回错误

[英]ElasticSearch creating index returns error

我正在使用 elasticsearch v. 6.2.2 并尝试在 Kibana 6.2.2 中创建索引:我从初学者指南https://www.codementor.io/ashish1dev/getting-started-with-elasticsearch- du107nett


    PUT /company
    {
      "settings": {
        "index": {
           "number_of_shards": 1,
           "number_of_replicas": 1
        },
        "analysis": {
          "analyzer": {
            "analyzer-name": {
              "type": "custom",
              "tokenizer": "keyword",
              "filter": "lowercase"
            }
          }
        },
        "mappings": {
          "employee": {
            "properties": {
              "age": {
                "type": "long"
              },
              "experience": {
                "type": "long"      
              },
              "name": {
                "type": "string",
                "analyzer": "analyzer-name"
              }
            }
          }
        }
      }  
    }

执行此请求后出现错误

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "unknown setting [index.mappings.properties.age.type] 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.mappings.properties.age.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
  },
  "status": 400
}

在我想做喜欢这里之后

    POST /company/employee/?_create
   {
      "name": "Andrew",
      "age" : 45,
      "experience" : 10
   }

你能回答一下这段代码有什么问题吗

mappings不能嵌套在settings并且必须是顶级部分:

PUT /company
{
  "settings": {
    "index": {
      "number_of_shards": 1,
      "number_of_replicas": 1
    },
    "analysis": {
      "analyzer": {
        "analyzer-name": {
          "type": "custom",
          "tokenizer": "keyword",
          "filter": "lowercase"
        }
      }
    }
  },
  "mappings": {
    "employee": {
      "properties": {
        "age": {
          "type": "long"
        },
        "experience": {
          "type": "long"
        },
        "name": {
          "type": "string",
          "analyzer": "analyzer-name"
        }
      }
    }
  }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM