How to filter values with wildcard symbols?

Hi. I'm newbee in elasticsearch. My question is what's wrong with the query I'm using:
Model (partially):

{
  "hello_world_index" : {
    "mappings" : {
      "entity" : {
        "dynamic" : "strict",
        "properties" : {
          "employees" : {
            "properties" : {
              "name" : {
                "type" : "text",
                "fields" : {
                  "raw" : {
                    "type" : "keyword"
                  }}}}}}}}}}

Data that exists:

"employees" : [
{
"id" : "2",
"name" : "b?ob*",
"type" : 0
}
],

The query I send:
POST -d ' {"query": {"bool":{"must":[{"bool":{"should":[{"match_phrase_prefix":{"employees.name":{"query":"b?ob*"}}}]}}]}}}'
returns this record fine
But when I use the following queries I expect to see no result:

"query":"b\\*ob"
"query":"\"b*ob"\"

but I get the same data.

The problem is that you are using the default analyzer where you should may be not use any.

Try to search in name.raw

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