Optional field for boosting results score

Hello,

I currently have this request:


'query' => 
     'multi_match' => [
         'query' => $queryString,
         'type' => 'bool_prefix',
         'fields' => [
             'label^3',
             'categories_list',
              'tags_list',
          ],
          'operator' => 'and',
      ]
 ]

Which does what i want, for example if i type "quick brown fox" i want to match all this words using those 3 fields.

Now what i want is to have an additional field only for boosting the score, lets say it's name is "keyword". So "Cute quick brown fox" would have a higher score but "quick brown fox" would still match.

How can i achieve this ?

Thanks

You should start with a bool query.
Put the multi_match part in the must array.
And add a should array, where you can put a match query in.

1 Like

That did it thanks :slight_smile:

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