I am trying to make it possible to search for a username or email.
My documents look like this:
{
"_index": "dump",
"_type": "dumps",
"_id": "AVrtBPc-9qPScMUXa_Dq",
"_score": 1,
"_source": {
"name": "random user",
"email": "random-user@gmail.com",
"username": "random-user123"
}
}
But whenever it hits a special character it returns nothing. So if I search for "random" it returns "random-user", but if I search for "random-user" it returns nothing. Same with email, the @ makes the request return nothing.
This may be a silly question, but I am fairly new to ES. Any way I could make both fields searchable with special characters? I also want them to match exact. If I search for "user" I want to to return ONLY "user" and not "user1", "user-2" or "user 123" etc.
EDIT:
I found a solution. I changed the query to search for keywords and that seemed to do it.