1

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

1 Answer 1

1

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"
        }
      }
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.