Unable to fetch exact value


(kanchan) #1

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.


(Christian Dahlqvist) #2

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


(kanchan) #3

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
}
}
}
}
}
}
}
}
}


(Christian Dahlqvist) #4

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


(kanchan) #5

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


(system) #6

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