首页 > 解决方案 > Elasticsearch 根映射不支持的参数

问题描述

我正在尝试使用如下 PUT 命令在弹性搜索中配置索引,并得到如下错误。我无法弄清楚错误是什么。我正在为 ELK 使用 7.4.2 版本

PUT代码如下:

PUT /myfeed
{
   "settings": {
      "index": {
         "number_of_shards": 1,
         "number_of_replicas": 0
      },
      "analysis": {
         "analyzer": {
            "folding": {
               "type": "custom",
               "tokenizer": "standard",
               "char_filter": ["html_strip"],
               "filter": ["lowercase", "asciifolding"]
            }
         }
      }
   },
   "mappings": {
      "feed": {
         "_all": {
            "enabled": false
         },
         "properties": {
            "feed": {
               "type": "keyword"
            },
            "link": {
               "type": "keyword"
            },
            "published": {
               "type": "date"
            },
            "message": {
               "type": "string",
               "analyzer": "folding"
            },
            "title": {
               "type": "string",
               "analyzer": "folding"
            }
         }
      }
   }
}

控制台上的错误如下:

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Root mapping definition has unsupported parameters:  [feed : {_all={enabled=false}, properties={feed={type=keyword}, link={type=keyword}, published={type=date}, message={analyzer=folding, type=string}, title={analyzer=folding, type=string}}}]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [feed : {_all={enabled=false}, properties={feed={type=keyword}, link={type=keyword}, published={type=date}, message={analyzer=folding, type=string}, title={analyzer=folding, type=string}}}]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "Root mapping definition has unsupported parameters:  [feed : {_all={enabled=false}, properties={feed={type=keyword}, link={type=keyword}, published={type=date}, message={analyzer=folding, type=string}, title={analyzer=folding, type=string}}}]"
    }
  },
  "status": 400
}

请帮我解决这个问题

标签: elasticsearchmappinglogstash

解决方案


_all 已弃用,如 Lupanoide 所说(谢谢)所以对我有用的映射如下

 PUT /myfeed
{
  "mappings": {
         "properties": {
            "feed": {
               "type": "keyword"
            },
            "link": {
               "type": "keyword"
            },
            "published": {
               "type": "date"
            },
            "message": {
               "type": "text",
               "analyzer": "folding"
            },
            "title": {
               "type": "keyword"
            }
         }
      },
   "settings": {
      "index": {
         "number_of_shards": 1,
         "number_of_replicas": 0
      },
      "analysis": {
         "analyzer": {
            "folding": {
               "type": "custom",
               "tokenizer": "standard",
               "char_filter": ["html_strip"],
               "filter": ["lowercase", "asciifolding"]
            }
         }
      }
   }
}

谢谢


推荐阅读