首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Elasticsearch错误- mapper_parsing_exception

Elasticsearch错误- mapper_parsing_exception
EN

Stack Overflow用户
提问于 2021-03-06 08:45:42
回答 1查看 574关注 0票数 0

我正在试着运行下面的代码,但是我得到了这个错误。请帮我修一下。谢谢:

代码语言:javascript
复制
PUT synonyms_hotel
{
  "settings": {
    "index": {
      "analysis": {
        "analyzer": {
          "synonym_analyzer": {
            "tokenizer": "standard",
            "filter": [
              "lowercase",
              "synonym_graph"
            ]
          }
        },
        "filter": {
          "synonym_graph": {
            "type": "synonym_graph",
            "synonyms": [
              "courtyard, marriot"
            ]
          }
        }
      }
    }
  },
  "mappings": {
    "hotel": {
      "properties": {
        "name": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "keyword"
            }
          }
        },
        "city": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "keyword"
            }
          }
        },
        "name_suggest": {
          "type": "completion",
          "analyzer": "autocomplete",
          "search_analyzer": "standard"
        }
      }
    }
  }
}

错误:

代码语言:javascript
复制
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "Root mapping definition has unsupported parameters:  [hotel : {properties={name_suggest={search_analyzer=standard, analyzer=autocomplete, type=completion}, city={type=text, fields={raw={type=keyword}}}, name={type=text, fields={raw={type=keyword}}}}}]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [hotel : {properties={name_suggest={search_analyzer=standard, analyzer=autocomplete, type=completion}, city={type=text, fields={raw={type=keyword}}}, name={type=text, fields={raw={type=keyword}}}}}]",
    "caused_by" : {
      "type" : "mapper_parsing_exception",
      "reason" : "Root mapping definition has unsupported parameters:  [hotel : {properties={name_suggest={search_analyzer=standard, analyzer=autocomplete, type=completion}, city={type=text, fields={raw={type=keyword}}}, name={type=text, fields={raw={type=keyword}}}}}]"
    }
  },
  "status" : 400
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-06 08:48:59

您可能正在使用Elasticsearch 7+和映射类型已被废弃。,因此只需删除hotel级别:

代码语言:javascript
复制
PUT synonyms_hotel
{
  "settings": {
    "index": {
      "analysis": {
        "analyzer": {
          "synonym_analyzer": {
            "tokenizer": "standard",
            "filter": [
              "lowercase",
              "synonym_graph"
            ]
          }
        },
        "filter": {
          "synonym_graph": {
            "type": "synonym_graph",
            "synonyms": [
              "courtyard, marriot"
            ]
          }
        }
      }
    }
  },
  "mappings": {
      "properties": {                     <--- remove hotel here
        "name": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "keyword"
            }
          }
        },
        "city": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "keyword"
            }
          }
        },
        "name_suggest": {
          "type": "completion",
          "analyzer": "autocomplete",
          "search_analyzer": "standard"
        }
      }
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66503904

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档