简体   繁体   中英

ElasticSearch creating index returns error

I'm using elasticsearch v. 6.2.2 and try to Create an Index in Kibana 6.2.2: I get this code from guide for beginners 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"
              }
            }
          }
        }
      }  
    }

I get an error after executing this request

{
  "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
}

After I wanted to do like here

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

Could you please answer what's wrong with this code

mappings cannot be nested inside settings and must be a top-level section:

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"
        }
      }
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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