App search - how to multi value boost

When providing an array of terms to 'value boost' on App search it will boost a document if ANY of the terms are present.
How do I boost for EVERY term that is present?

For example, a document with 3 matching terms should rank/score better than a document with only one matching term. This seems very simple but I can't seem to achieve it in App search.

Using Algolia I would use the 'optionalFilters' parameter. What is the Elastic alternative?

A hacky way i've discovered around this is to join the terms together into a string and pass it as the query, but this does not have the desired affect. The result from this is every document with the matching terms with the most matching scoring better (success), but all other documents in the index with no matching terms are eliminated and not delivered (fail). I don't want any documents eliminated. I simply want the index ranked/scored in terms of their relevance to the users selected tags.

For any future readers, the support team at elastic search helped directly with this and it's embarrassingly simple. Maybe this will help others. The solution was:

    {
    "query": "",
    "boosts": {
    "tags": [
    {
    "type": "value",
    "value": "<insert-value-to-match-against>",
    "operation": "add",
    "factor": 5
    },
    {
    "type": "value",
    "value": "<insert-value-to-match-against>",
    "operation": "add",
    "factor": 5
    }
    ]
    }
    }
3 Likes

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