Change analyzer into an existing index

Hey there,
I have an existing index without any custom setting or mapping for any field, so everything is by default.
Into the docs I have a field named category which contains words like Women's or Womens.

POST my_index/_doc/
{
  "message": "This is the first document",
  "category": "Womens"
}


POST my_index/_doc/
{
  "message": "This is the second document",
  "category": "Women's"
}

I would like to get both type of docs with a _search operation.
So, I was trying to change index _settings with a custom char_filter to remove the single quote character:

PUT my_index/_settings
{
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "char_filter": [
            "my_char_filter"
          ]
        }
      },
      "char_filter": {
        "my_char_filter": {
          "type": "mapping",
          "mappings": [
            "' => "
          ]
        }
      }
  }
}

When I tried a _search I got only one type of document:

GET my_index/_search
{
  "query": {
    "match": {
      "text": {
        "category": "Womens"
      }
    }
  }
}

In another scenario, if I start from scratch creating a custom index as follow:

PUT my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "char_filter": [
            "my_char_filter"
          ]
        }
      },
      "char_filter": {
        "my_char_filter": {
          "type": "mapping",
          "mappings": [
            "' => "
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "text": {
        "type": "text",
        "analyzer": "my_analyzer"
      }
    }
  }
}

my search query will work.
What is wrong?

You cannot change analysers on existing indices like that, you will need to reindex.

so, probably it means that I understood the theory :slight_smile:
from your perspective, is there another posh way to get that result starting from the beginning?

There are search time analysers, but you are better off changing the indexing time analyser and reindexing.