Gruber
Gruber

Reputation: 4568

Elasticsearch queries and character substitution

My Elasticsearch queries are not working properly because sometimes (not always) my stored data have spaces () substituted with underscores (_). When users search with spaces, the don't get the entries with underscores in the results.

For example, if users search for the string annoying problem they get nothing because annoying_problem is the string stored in the index.

I have many similar problems for other characters as well, such as Ø being replaced with o in the data used to populate my index.

How should I solve this?

Upvotes: 0

Views: 131

Answers (1)

Dhruv Pal
Dhruv Pal

Reputation: 959

try using stopwords

{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": { 
          "type": "standard", 
          "stopwords": [ "_"] 
        }
      }
    }
  }
}

refrence https://www.elastic.co/guide/en/elasticsearch/guide/current/using-stopwords.html

Upvotes: 1

Related Questions