The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true.
时间: 2024-05-05 21:17:16 浏览: 238
PDSCH_mapping0116.rar_LTE link_pdsch mapping type_pdsch mapping
5星 · 资源好评率100%
This error message typically occurs when trying to create a mapping for Elasticsearch 7.x or later, which requires the use of the `_doc` type instead of explicit types like `tweet` or `user`. To resolve this error, you can either set `include_type_name` to `true` in your mapping definition, or remove any references to explicit types and use `_doc` as the default type.
For example, if you were previously using a mapping like this:
```
PUT my_index
{
"mappings": {
"tweet": {
"properties": {
"message": {
"type": "text"
}
}
}
}
}
```
You would need to update it to use `_doc` instead:
```
PUT my_index
{
"mappings": {
"_doc": {
"properties": {
"message": {
"type": "text"
}
}
}
}
}
```
Alternatively, you could add `include_type_name: true` to your mapping definition:
```
PUT my_index
{
"mappings": {
"include_type_name": true,
"tweet": {
"properties": {
"message": {
"type": "text"
}
}
}
}
}
```
阅读全文