Case insensitive search with fieldname.keyword

Hi

I need search results with exact matching of word but it should be case insensitive.

"Abc","ABC","aBc" : all should come in result
but
"Abc Def", "ABC FG" : should not come (do not search for substring)

GET people/people/_search
{
  "query": {
    "bool": { 
      "must":[
          {
              "match": {
                "city.keyword": "York"
              }
          }
      ]   
    }
  }
}

Thanks
Aneesh L

You should try using match_phrase instead on the city field

GET people/people/_search
{
  "query": {
    "bool": { 
      "must":[
          {
              "match_phrase": {
                "city": "York"
              }
          }
      ]   
    }
  }
}

image

But its giving New York also
I need only whole word match

I'd use a lowercase based analyzer in that case.

You mean a settings/mapping change?

Yes.

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