Elastic term filter not working when term contains /

Hi Team,

I have some problem when I am doing filtering with term.
Say for Example I have a field in my index called "customer_id" the value is : LC/2089011

When I give to search for some other customer id like

bool:{
"filter":[{
"term":{
    "customer_id":"2089011"
}
 }]
}

By the above case It found the record which contains LC/2089011. Where I do not want this. Can any one help me?

If you used default mapping and elasticsearch v5.x or above the following query might solve your problem

bool:{
  "filter":[{
    "term":{
      "customer_id.keyword":"2089011"
    }
  }]
}

If this doesn't work, please provide the mapping for the field customer_id.

3 Likes

hi,

Else you'll need to change your field mapping (customer_id) to not analyzed.

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