Reputation: 1142
I am trying to implement email search with ElasticSearch.
Here are the example documents.
{
...
"email": "[email protected]"
},
{
...
"email": "[email protected]"
}
So when I use the match query: { "match": { "email": "[email protected]"
} }
I get both of "[email protected]"
and "[email protected]"
but the result must be only "[email protected]"
.
I think it is because of @
character.
Any good solution to resolve this issue?
Upvotes: 2
Views: 2539
Reputation: 818
Use this to make your request 👍
GET my_index/_search
{
"query": {
"match_phrase_prefix" : {
"email": "[email protected]"
}
}
}
You will have the expecting result
Upvotes: 0
Reputation: 13855
You need to use the Email Tokenizer as specified here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-uaxurlemail-tokenizer.html
Upvotes: 1