Case insensitive exact matches in Elasticsearch

Steps to Follow

Step 1: insert setting and mapping to elastic search

Note: if index is present then delete that.

curl -X PUT "localhost:9200/index_name" -H 'Content-Type: application/json' -d'
{ "settings": { "analysis": { "normalizer": { "my_normalizer": { "type": "custom", "char_filter": [], "filter": ["lowercase", "asciifolding"] } } } }, "mappings": { "_doc": { "properties": { "foo": { "type": "keyword", "normalizer": "my_normalizer" } } } }}

Step 2:  insert document

Note: you can store your data here

PUT index/_doc/1{  "foo": "BÀR"}PUT index/_doc/2{  "foo": "bar"}

Step 3: refresh index

POST index/_refresh

Step 4: search data from elastic search

GET index/_search{  "query": {    "term": {      "foo": "BAR"    }  }}GET index/_search{  "query": {    "term": {      "foo": "bAr"    }  }}

both will give same result.