Fieldname.keyword search returns different results

I have a field which uses a particular analyzer. For a scenario, i want the field to be matched without any analyzer being applied. So I ma using fielname.keyword for the match query. This query doesn't return value for search string which exactly matches the data in that field. This happens only f or fewer records.

Note: The field has email ids as comma separated string.

Below returns data for few records and doesn't return data for few others

<
DELETE members

PUT members/_settings
{
"analysis":{
"analyzer":{
"a1":{
"tokenizer": "comma"
}
}
}
}

PUT members/data/_mapping
{
"properties": {
"emailIds":{
"type": "text",
"analyzer": "a1"
}
}
}

PUT members/data/1
{
"emailIds": "abc@domain.com,xyz@domain2.com"
}
GET index/_search
{
"query": {
"match": {
"emailsIds.keyword":"abc@domain.com,xyz@domain2.com"
}
}
}
/>

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.

1 Like

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