1

Is there a way how to filter multiple characters during analyzing in ElastisSearch? We would like to setup it so if user searches 'botled' then he get the documents that include 'bottled' or 'botttled', etc., i.e no matter double, tripple letters.

I have looking for solution in token filters https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-tokenfilters.html, but it seems that none of them matches our requirements.

1 Answer 1

1

by default elasticsearch text field is tokenized based on whitespace, i.e. only words are indexed and are searchable.


would regex search work for you?
GET /_search
{
    "query": {
        "regexp": {
            "user": {
                "value": "b+o+t+t+l+e+d+"
            }
        }
    }
}

b+ --> one or more occurrence of b

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. Your solution is also applicable. Although I originally thought that the repeating chars would be removed just during the analysis, but your solution is also helpful. By the way, I found out that we really needed something more like a "fuzzy search" rather than what I was asking for, but that's my stupidity. Thank you for your time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.