What is the best way to do full text search using Atlas? For example, I put mike@ and I want to see da.mike@gmail.com mike@gmail.com ... But not something like mikke@... mmike@..., such a result can show a search using autocomplete. As I understood, most likely I need to use regex
{
"$search": {
"index": "free-text",
{
"regex": {
"path": "email",
"query": ".*mike@.*",
},
},
},
}
Before that I created search index:
"email": [{
"tokenization": "nGram",
"type": "autocomplete"
},
{
"analyzer": "lucene.keyword",
"type": "string"
}
]
It works almost good, but it is a case-sensitive, and I can't find out how to send it as insensitive So, 1. Is there a better way how to build such a search?
2. if so, how to do a regex search insensitive to the case?
Thank you a lot for helping, guys!
Tru to create an index with autocomplete type, and build query as a phrase, regex, autocomplete, but the result was not good.