Elasticsearch Query: Returning results with Diacritics (Accents and special characters)

Hi All,

Im pretty new to elasticsearch so bare with me.

Im trying to return results for names with Diacritics (example: é at the end of the name). I want to be able to search using regular characters and receive all results, including names with diacritics (Example: want to search for Beyonce and return all results with Beyoncé).

I am using Insomnia Step API to run the elasticserach query. Post method and JSON

After doing research I added the following code to the end of my query.....

"settings" : {
"analysis" : {
"analyzer" : {
"default" : {
"tokenizer" : "standard",
"filter" : ["standard", "my_ascii_folding"]
}
},
"filter" : {
"my_ascii_folding" : {
"type" : "asciifolding",
"preserve_original" : true
}
}
}
}
}

Im still not getting any results from added that to my query. What am I missing?

You don't need to add that to your query, you can instead set it on the field:

Here's an example:

PUT /test
{
  "settings" : {
    "analysis" : {
      "analyzer" : {
        "my-asciifolding" : {
          "tokenizer" : "standard",
          "filter" : ["standard", "lowercase", "asciifolding"]
        }
      }
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "person": {
          "type": "text",
          "analyzer": "my-asciifolding"
        }
      }
    }
  }
}

POST /test/doc/1
{ "person": "Beyoncé" }

POST /test/_analyze
{
  "field": "person",
  "text": "Beyoncé"
}


POST /test/_search
{
  "query": {
    "match": {
      "person": "beyonce"
    }
  }
}

what do you mean by set it on the field?

This is my current query with the previous piece removed.

What are the mappings and settings for your index? (GET /<index>)

I dont believe I have access to the index. Is there anyway to update the query without updating the index?

If and when I get access to the index what code should be added?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.