WARNING: Version 2.0 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Pattern Replace Char Filter
editPattern Replace Char Filter
editThe pattern_replace
char filter allows the use of a regex to
manipulate the characters in a string before analysis. The regular
expression is defined using the pattern
parameter, and the replacement
string can be provided using the replacement
parameter (supporting
referencing the original text, as explained
here).
For more information check the
lucene
documentation
Here is a sample configuration:
{ "index" : { "analysis" : { "char_filter" : { "my_pattern":{ "type":"pattern_replace", "pattern":"sample(.*)", "replacement":"replacedSample $1" } }, "analyzer" : { "custom_with_char_filter" : { "tokenizer" : "standard", "char_filter" : ["my_pattern"] } } } } }