Can I specify regexp in stopwords for stop analyzer in elasticsearch? Can I specify regexp in stopwords for stop analyzer in elasticsearch? elasticsearch elasticsearch

Can I specify regexp in stopwords for stop analyzer in elasticsearch?


Me again.. I don't seem to be able to add regexp to stopwords. However, I did manage to work around it by adding another filter called filter_amount. This is what it looks like:

             "filter_amount": {              "type": "pattern_replace",              "pattern": "[\\d]+([\\.,][\\d]+)?",              "replacement": ""             }

So this is what the settings should look like:

PUT /products{"settings": {    "analysis": {      "filter": {          "my_stopwords": {              "type":       "stop",              "stopwords": [ "l", "g" ]          },         "filter_amount": {              "type": "pattern_replace",              "pattern": "[\\d]+([\\.,][\\d]+)?",              "replacement": ""          }        },        "analyzer": {            "my_analyzer": {                "type":         "custom",                "tokenizer":    "standard",                "filter":       [ "lowercase", "my_stopwords", "filter_amount"]        }}  }}}

The rest is the same. Cheers!