elasticsearch remove custom analyzer / filter
Asked Answered
N

2

15

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?

Nauseate answered 8/11, 2013 at 20:57 Comment(3)
what happens if you just re-post it without the filter_unused?Guernica
looking at the ES code I only see GET and POST methods in the REST analyze actions, no DELETE.Guernica
#12368377 Here you can see how to change analyzer settings of existing index.Cockadoodledoo
P
4

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.

Pincus answered 8/1, 2021 at 14:5 Comment(2)
This will not work anymore in ES 7.14. Setting to null will cause an exception.Gregg
@Gregg that is not correct; it still works on 7.x or 8.x; you may need to set the fields that are using this analyzer to use another one or null before resetting the analyzer. Think like deleting a row in a DB table where other table has with foreign keys linked to this row...Algetic
H
1

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

Hedgcock answered 18/6, 2014 at 0:33 Comment(1)
looks like for ES5.x.x this has been solved with elastic.co/guide/en/elasticsearch/reference/current/…Destructive

© 2022 - 2024 — McMap. All rights reserved.