I have used below custom analyzer
PUT my_index
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"custom_analyzer": {
"type": "custom",
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "ngram",
"min_gram": 1,
"max_gram": 10
}
}
}
}
},
"mappings": {
"doc": {
"properties": {
"my_field": {
"type": "text",
"analyzer": "custom_analyzer",
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
}
}
}
}
}
}
PUT my_index/doc/2
{
"my_field":"$title123.txt"
}
PUT my_index/doc/1
{
"my_field":"$titan@123#.txt"
}
Here special character search is working fine but if i search for titan i'm getting both the documents (my_field with title in it) which is irrelevant search