Elasticsearch 7:根映射定义具有不受支持的参数(mapper_parsing_exception) [英] Elasticsearch 7 : Root mapping definition has unsupported parameters (mapper_parsing_exception)

查看:262
本文介绍了Elasticsearch 7:根映射定义具有不受支持的参数(mapper_parsing_exception)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在Elasticsearch 7中插入以下映射

When trying to insert the following mapping in Elasticsearch 7

PUT my_index/items/_mapping
{
   "settings":{

   },
   "mappings":{
      "items":{
         "properties":{
            "products":{
               "properties":{
                  "classification":{
                     "type":"text",
                     "fields":{
                        "raw":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  },
                  "original_text":{
                     "type":"text",
                     "store":false,
                     "fields":{
                        "raw":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  }
               }
            },
            "title":{
               "type":"text",
               "fields":{
                  "raw":{
                     "type":"keyword",
                     "ignore_above":256
                  }
               },
               "analyzer":"autocomplete"
            },
            "image":{
               "properties":{
                  "type":{
                     "type":"text",
                     "fields":{
                        "raw":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  },
                  "location":{
                     "type":"text",
                     "store":false,
                     "fields":{
                        "raw":{
                           "type":"keyword",
                           "ignore_above":256
                        }
                     }
                  }
               }
            }
         }
      }
   }
}

我收到以下形式的错误:

I get an error of the form:

{
"error": {
    "root_cause": [
    {
        "type": "mapper_parsing_exception",
        "reason": "Root mapping definition has unsupported parameters:  

导致此错误的原因是什么?

What is causing this error?

推荐答案

在Elasticsearch 7中,不赞成使用映射类型,这会导致中断从根本上改变这个问题。

In Elasticsearch 7, mapping types have been deprecated, which is causing the breaking change at the source of this problem.

公告,由Elasticsearch小组针对弃用,路线图和替代方法进行。

Announcement by the Elasticsearch team of the deprecation, roadmap, and alternatives.

要解决此问题,只需删除所有对映射类型的引用(项目)。

To fix this, simply remove all references to mapping types ("items" in this example):

PUT my_index/_mapping
{
   "settings":{

   },
   "mappings":{
      "properties":{
         "products":{
            "properties":{
               "classification":{
                  "type":"text",
                  "fields":{
                     "raw":{
                        "type":"keyword",
                        "ignore_above":256
                     }
                  }
               },
               "original_text":{
                  "type":"text",
                  "store":false,
                  "fields":{
                     "raw":{
                        "type":"keyword",
                        "ignore_above":256
                     }
                  }
               }
            }
         },
         "title":{
            "type":"text",
            "fields":{
               "raw":{
                  "type":"keyword",
                  "ignore_above":256
               }
            },
            "analyzer":"autocomplete"
         },
         "image":{
            "properties":{
               "type":{
                  "type":"text",
                  "fields":{
                     "raw":{
                        "type":"keyword",
                        "ignore_above":256
                     }
                  }
               },
               "location":{
                  "type":"text",
                  "store":false,
                  "fields":{
                     "raw":{
                        "type":"keyword",
                        "ignore_above":256
                     }
                  }
               }
            }
         }
      }
   }
}

这篇关于Elasticsearch 7:根映射定义具有不受支持的参数(mapper_parsing_exception)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆