Unable to fetch exact value

Hi,

I am trying to get exact value but it code is doing likely search:

GET /hist_latest/_search
{
"query": {

 "bool": {
    
    "should": [
      {
        
        "match": {
         
          "bank_client_entity_name":"CNH CAPITAL RECEIVABLES"
          
        }
      }
    ]  
  }

}
}

Please give any solution for it.

What is the mapping for that field? Which version of Elasticsearch are you using?

elasticsearch version 5.3.0 and mapping for field bank_client_entity_name is given below:

{
"hist_latest": {
"mappings": {
"logs": {
"bank_client_entity_name": {
"full_name": "bank_client_entity_name",
"mapping": {
"bank_client_entity_name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
}

If you are looking for an exact match you can run a terms query against the keyword mapped subfield bank_client_entity_name.keyword.

Thanks!!!!!!!!!!!! Christian_Dahlqvist, Its working fine.

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