【问题标题】:elasticsearch remove custom analyzer / filterelasticsearch 删除自定义分析器/过滤器
【发布时间】:2021-01-08 22:05:17
【问题描述】:

我是弹性搜索的新手,我想知道是否可以从索引中删除自定义分析器或自定义过滤器..

例如,想象以下索引设置:

    "settings" : {
        "analysis": {
            "filter":{
                "filter_metaphone":{
                    "encoder": "metaphone",
                    "type": "phonetic",
                    "replace": "false"
                },
                "filter_unused":{
                    "type": "edgeNGram",
                    "max_gram": "10",
                    "min_gram": "1" 
                }
            },
            "analyzer":{
                "name":{
                    "type": "custom",
                    "filter": ["filter_metaphone"],
                    "tokenizer": "standard"
                }
            }
        }   
    }

有什么方法可以通过 curl 删除过滤器 "filter_unused" 而无需删除并使用新的设置配置创建索引?

【问题讨论】:

  • 如果您在没有 filter_unused 的情况下重新发布它会发生什么?
  • 查看 ES 代码我只看到 REST 分析操作中的 GET 和 POST 方法,没有 DELETE。
  • stackoverflow.com/questions/12367877/… 在这里您可以看到如何更改现有索引的分析器设置。

标签: elasticsearch filter analyzer


【解决方案1】:

在将所有值设置为 null 后,分析器对我来说消失了(ES 6.8)

{
  "analysis": {
    "analyzer": {
      "my_search_analyzer" : {
        "filter" : null,
        "tokenizer" : null
      }
    }
  }
}

【讨论】:

  • 这在 ES 7.14 中不再起作用。设置为null 会导致异常。
【解决方案2】:

不,目前无法从索引设置中删除一个特定的分析器。

不过,您可以添加新的分析器。此处记录了该 API。

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-update-settings.html#indices-update-settings

【讨论】:

猜你喜欢
  • 2015-03-04
  • 1970-01-01
  • 1970-01-01
  • 2014-08-08
  • 2018-10-05
  • 2020-12-27
  • 1970-01-01
  • 1970-01-01
  • 2016-01-12
相关资源
最近更新 更多