Elasticsearch Map case insensitive to not_analyzed documents
elasticsearch
Solution
I think this example meets your needs:
$ curl -XPUT localhost:9200/testindex/ -d '
{
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_keyword":{
"tokenizer":"keyword",
"filter":"lowercase"
}
}
}
}
},
"mappings":{
"test":{
"properties":{
"title":{
"analyzer":"analyzer_keyword",
"type":"string"
}
}
}
}
}'
taken from here: How to setup a tokenizer in elasticsearch
it uses both the keyword tokenizer and the lowercase filter on a string field which I believe does what you want.
Problem
I have a type with following mapping ``` PUT /testindex { "mappings" : { "products" : { "properties" : { "category_name" : { "type" : "string", "index" : "not_analyzed" } } } } } ``` I wanted to search for an exact word.Thats why i set this as not_analyzed. But the problem is i want to search that with lower case or upper case[case insensitive]. I searched for it and found a way to set case insensitive. ``` curl -XPOST localhost:9200/testindex -d '{ "mappings" : { "products" : { "properties" : { "category_name":{"type": "string", "index": "analyzed", "analyzer":"lowercase_keyword"} } } } }' ``` Is there any way to do these two mappings to same field.? Thanks..