Prefix with multi_match


(Paddy Mahadeva) #1

Hi,

I am running the below search query on my index

{
  "_source": "false", 
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "fields": ["email","name", "company",  "phone"],
            "query": "tes",
            "type" : "phrase_prefix"
          }
        }
      ]
    }
  },
  "highlight": {
    "fields": {"name": {}, "company" : {}, "email" : {}, "phone" : {}}
  }
}

I have some sample data with the field values
name: test paddy
name : test user
name : test logger
name : test

When I run the above query, I do not get any results, but when I change it to "query": "test", I start seeing 1 result "test". I was expecting to see in both cases all the above names that i have. Am I missing something here?


(Paddy Mahadeva) #2

Hi,

I noticed that multi_match with prefix is working with text fields, but fails with keywords, long fields etc Also, when I tried

{ "query": {
    "prefix" : { "phone" : 99 }
  }
}

with number fields and keyword fields its working.

So is it like multi_match and prefix don't work well with keyword and number fields?


(system) #3

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