Search doesn't work for email address, return 0 hits

(Sachin Chavan) #1

I am using Elasticsearch version 6.4 on AWS

my_index data from which I will be searching

{
"snapshot": {
"last_name": "Chavan",
"first_name": "Sachin",
"email_id": "sachin@mail.com",
"user_status": "active_user"
},
"tags": [
"Apple",
"Sachin",
"Chavan",
"sachin@mail.com"
]
}

if I search by this my_index/_search?q=tags:*sa*-- It works

But if I search for email like this my_index/_search?q=tags:*@mail* --- returns 0 hits,

I have gone through some solutions but it seems non of them works, tried for not_analyzed and uax_url_email tokenizer.

Please help me out here,if you can share exact settings and mapping I have to make while creating index then that will be really helpful.

(David Pilato) #2

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

(Rahul Desai) #3

You should look into using regexp queries: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html

(system) closed #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.