user2970458
user2970458

Reputation: 151

elasticsearch remove custom analyzer / filter

I'm new to Elasticsearch and I was wondering if it's possible to delete a custom analyzer or a custom filter from an index.

For example, imagine the following index settings:

    "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"
                }
            }
        }   
    }

Is there any way to delete the filter "filter_unused" via curl without removing and creating the index with a new settings configuration?

Upvotes: 15

Views: 8674

Answers (2)

Oleg Skr
Oleg Skr

Reputation: 386

After setting all values to null, the analyzer has disappeared for me (ES 6.8, 7.x, 8.x)

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

See Reset an index setting doc.

Upvotes: 4

Andy
Andy

Reputation: 8949

No, there is not a way to delete one specific analyzer from an index setting at this time.

You could add new analyzers though. That API is documented here.

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

Upvotes: 1

Related Questions