Reputation: 25
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
Upvotes: 1
Views: 709
Reputation: 217254
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"
}
}
}
}
}
Upvotes: 1