1
votes

Given the following query, how do I rank each should clause higher than another one.

I'm trying to boost them in the order that they're listed.

{
    "size": 20,
    "query": {
        "bool": {
            "should": [
                {
                    "match_phrase": {
                       "fullName": "Michael Douglas"
                    }
                },
                {
                    "match_phrase_prefix": {
                       "fullName": "Michael Douglas"
                    }
                },
               {
                   "match": {
                      "lastName": "Michael Douglas"
                   }
               },
               {
                   "match": {
                      "firstName": "Michael Douglas"
                   }
               },
               {
                   "fuzzy_like_this": {
                       "like_text": "Michael Douglas"
                   }
               }
            ]
        }
    }
}

How do I boost each clause within the should array? This is what I can't wrap my head around.

1
I edited with the query and rephrased the question to be more direct at the end. I tried to get sample data, but editing all the personal info out was hindering the usefulness of the sample fuzzy results that came back. Example: I'm simply looking to make the second should, the exact match on fullName, rank higher than the fullName phrase prefix. If I can do that, I should be able to finish the rest off.Mike Gwilt
Why do you need to? If you just do a regular query string query with "Michael Douglas", Elasticsearch defaults will rank an exact phrase match higher than a single field match and that higher than a fuzzy match.kielni
An example would be making LastName result first every single time.Mike Gwilt
Kielni I have a question at stackoverflow.com/questions/24528933/… where by default to me, exact matches do not come out on top when using fuzzy matching.rsmarsha

1 Answers