I have the following ElasticSearch query which I would think would return all matches on the email field where it equals myemails@email.com
"query": {
"bool": {
"must": [
{
"match": {
"email": "myemail@gmail.com"
}
}
]
}
}
The mapping for the user type that is being searched is the following:
{
"users": {
"mappings": {
"user": {
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"nickname": {
"type": "string"
},
}
}
}
}
}
The following is a sample of results returned from ElasticSearch
[{
"_index": "users",
"_type": "user",
"_id": "54b19c417dcc4fe40d728e2c",
"_score": 0.23983537,
"_source": {
"email": "johnsmith@gmail.com",
"name": "John Smith",
"nickname": "jsmith",
},
{
"_index": "users",
"_type": "user",
"_id": "9c417dcc4fe40d728e2c54b1",
"_score": 0.23983537,
"_source": {
"email": "myemail@gmail.com",
"name": "Walter White",
"nickname": "wwhite",
},
{
"_index": "users",
"_type": "user",
"_id": "4fe40d728e2c54b19c417dcc",
"_score": 0.23983537,
"_source": {
"email": "JimmyFallon@gmail.com",
"name": "Jimmy Fallon",
"nickname": "jfallon",
}]
From the above query, I would think this would need to have an exact match with 'myemail@gmail.com' as the email property value.
How does the ElasticSearch DSL query need to change in order to only return exact matches on email.