How could I do to set es query case sensitive?


(xuanyetouci) #1
GET _search
{
  "query": {
    "match": {
      "name": "3g"
    }
  }
}    

now I can get named 3g and 3G
how counld I do to only get named 3g?


(David Pilato) #2

Please format your code using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

Please edit your post.

You can change the analyzer or the type of the field. For example, use a keyword type instead of text.
If you are using all defaults, then you can probably do:

GET _search
{
  "query": {
    "match": {
      "name.keyword": "3g"
    }
  }
}

(xuanyetouci) #3

Thank you very much for your help.
I use name.keyword seems not work,
But I use kibana find a hint .raw seems work.


(David Pilato) #4

I believe you'd better provide your own mapping instead of relying on default mapping.

The default foo.raw subfield was an old one. Default moved to foo.keyword in more recent versions.


(xuanyetouci) #5

yes, I will try it,
and I must thank you again for your generous help.


(system) #6

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