Accent-insensitive search

Hi, after spending hours trying to figure out I need a help with:

How to search accent-insensitive + case insensitive?

I have created an index:

curl -X PUT "localhost:9200/my_index?pretty" -H 'Content-Type: application/json' -d'
{
  "settings": {
    "analysis": {
      "analyzer": {
        "foo": { 
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "asciifolding"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "text": {
        "type": "text",
        "analyzer": "foo", 
        "search_analyzer": "foo" 
      }
    }
  }
}
'

Insert data:

curl -X PUT "localhost:9200/my_index/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
  "text": "Perlová" 
}
'

And then try to search the steet name:

curl -X GET "localhost:9200/my_index/_search?pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
    "match": {
      "text": {
        "query": "perlova"
      }
    }
  }
}
'

I would expected to get the result, but nothing is found. It works only If I write the exact word with all accents, but I also need the street to be found, when I search it without accent. Any help would be appreciated. Thank you.

I tried it on 7.5.2:

DELETE /my_index
PUT /my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "foo": { 
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "asciifolding"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "text": {
        "type": "text",
        "analyzer": "foo", 
        "search_analyzer": "foo" 
      }
    }
  }
}
PUT /my_index/_doc/1?refresh=true
{
  "text": "Perlová" 
}
GET /my_index/_search
{
  "query": {
    "match": {
      "text": {
        "query": "perlova"
      }
    }
  }
}

And I got back:

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1,
      "relation" : "eq"
    },
    "max_score" : 0.2876821,
    "hits" : [
      {
        "_index" : "my_index",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 0.2876821,
        "_source" : {
          "text" : "Perlová"
        }
      }
    ]
  }
}

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