why wildcard cannot use `@` in Elasticsearch?
Standard Analyzer is the culprit in your case.
email
field in your index seems to be analyzed
string. So when you index it it will split into somemail
, yahoo.com
and these two tokens will be saved in reverse index
. That's why you were not able to search with @yahoo
.You can use analyze
api to see how your term is getting tokenized.
curl -XGET "http://localhost:9200/_analyze?tokenizer=standard" -d "test@yahoo.com"
You will get following output:
{"tokens":[{"token":"test","start_offset":0,"end_offset":4,"type":"<ALPHANUM>","position":0},{"token":"yahoo.com","start_offset":5,"end_offset":13,"type":"<ALPHANUM>","position":1}]}
You can use uax_url_email if you want to search with @yahoo
Hope this helps!!