Create nested mappings there is still an error

hallo, can you help me with this problem

PUT office
{
"mappings": {
"departments" : [{
"properties":{
"id":{
"type":"integer"
},
"deptName":{
"type":"string"
},
"employee_details":{
"type":"nested",
"properties":{
"empId":{
"type":"integer"
},
"empName":{
"type":"string"
}
}
}
}
}
]
}
}

and this error

{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [departments : [{properties={deptName={type=string}, employee_details={type=nested, properties={empId={type=integer}, empName={type=string}}}, id={type=integer}}}]]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [departments : [{properties={deptName={type=string}, employee_details={type=nested, properties={empId={type=integer}, empName={type=string}}}, id={type=integer}}}]]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters: [departments : [{properties={deptName={type=string}, employee_details={type=nested, properties={empId={type=integer}, empName={type=string}}}, id={type=integer}}}]]"
}
},
"status" : 400
}

You need to remove:

"departments" : [{

And

}
]

I have tried to delete it but it keeps getting an error like this

{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "No handler for type [string] declared on field [deptName]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping [_doc]: No handler for type [string] declared on field [deptName]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "No handler for type [string] declared on field [deptName]"
}
},
"status" : 400
}

Change string to text.

Also please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

oke thx for your solution

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.