Boost value depending on number of common terms

Assuming we have index called users and each of them have hobbies stored as array of strings like :["basketball", "games"].
We want to fetch users with common hobbies, although we want to boost users with more than one mutual hobby. Let's say if it is 1 common hobby, then boost value should be 1, if it is 2 common hobbies then boost should be 3 and if it is 3 common hobbies or more it should be 5.

Is it possible with terms_set query? Should it be somehow wrapped with function_score?

      terms_set: {
        hobbies: {
          terms: userDoingQuery.hobbies,
          minimum_should_match_script: {
            source: ???,
          },
          boost: ???,
        },
      }

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