The Roadmap to Becoming an Expert 🗺 ⠀ Courtesy of @moismai ⠀ Believe it or not, There is a system to becoming a master 🔮 ⠀ It’s been documented. This post is breaks down key elements to…
So last week while I was setting the analyzers on ElasticSearch settings for Email field, it took me some good time to find the perfect custom analyzer for my purpose, so I feel it might be useful to share this with someone who needs it.
Let me briefly explain what I am trying to do with my Email field. The email addresses will be stored as a comma separated string with potentially multiple email addresses, and what I am expecting is after the to search to retrieve the matching results. Besides the exact match like search for "john.doe@gmail.com"
, I also want to be able to search for "john.doe"
or "gmail.com"
to retrieve the relative information.
Here is the full schema for it:
And the search schema is:
[Search > Response]
“john.doe@gmail.com” > 1,2
“john.doe@outlook.com” > 2,4
“john@yahoo.com” > 5
“john.doe” > 1,2,3,4
“john” > 1,2,3,4,5
“gmail.com” > 1,2
“outlook.com” > 2,3,4
If you decide to keep reading, then it means you have the same needs as I did so I hope the following solution can actually help.
So… In the official documentation they did have a good solution but it was not easy to find, at least for me, by using regular expression:
This setting will perfectly address the issues from above, and do not generate way to much tokens in your ES cluster.
At the end I want to share two good gadgets that I found very helpful with ES analyzers and regular expression.
Desde la fase 2 o 1 de la desescalada, la famosa palabra creada a razón de una pandemia que nos va a dejar otra enfermedad Esta nueva pandemia no es más que la de la ofensa, división y ruptura. La…
Different people have different ideas of what it means to be a successful writer. For some aspiring writers, success means being a published author with a novel on the New York Times bestseller list…
Not like shattered vases when they hit the ground. But like artifacts recognizing its beauty through brokeness You should have come with a warning sign, ‘THIS SIDE UP” “HANDLE WITH CARE” “FRAGILE”….I…