Flag a result based on a ES "sub" query

Hi all!

Hopefully somebody is able to assist or point me in the right direction with this. I look after an online store and we use Elasticsearch (v 5.5) for all of our product lookups. We want to implement functionality to allow us to flag products for some of our customers as being "of note". For example we may wish to flag certain products as being "preferred" or "recommended" (or a number of other options). This however needs to be done dynamically on the fly as customers are going to have different parameters for what needs to be flagged.

I've had a hunt around and struggling to work out how to do this.

Originally I thought about playing with the scoring, however we use that to determine the order our results are returned in (with weight towards own brand and popular products), so can't see that working. Any thoughts?

Our "standard" query is along these lines:

GET index/_search
{
  "_source": "*",
  "from": 0,
  "size": 15,
  "sort": {
    "_score": {
      "order": "desc"
    },
    "product_name.keyword": {
      "order": "asc",
      "unmapped_type": "keyword"
    }
  },
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "must": [
            {
              "match": {
                "_type": "product"
              }
            },
            {
              "match": {
                "scores.clearance_offer": 0
              }
            }
          ],
          "must_not": {
            "match": {
              "product_id": "0"
            }
          },
          "filter": [
            [
              {
                "match": {
                  "category.keyword": "Paper"
                }
              }
            ]
          ]
        }
      },
      "score_mode": "multiply",
      "functions": [
        {
          "field_value_factor": {
            "field": "scores.top_seller",
            "factor": 100
          }
        },
        {
          "field_value_factor": {
            "field": "scores.brand",
            "factor": 0.25
          }
        }
      ]
    }
  }
}

And our flag query would look something like this (this is heavily simplified and will contain products from other categories). In this case we'd want the results from the Paper category to have every product marked unless it had a "paper-type attribute" of "toilet-tissue"

{
  "bool":{
    "should":[
      {
        "bool":{
          "must":{
            "term":{
              "category_primary.keyword":"paper"
            }
          },
          "must_not":[
            {
              "nested":{
                "path":"full_attributes",
                "query":{
                  "bool":{
                    "must":[
                      {
                        "term":{
                          "full_attributes.attribute_name.slug":"paper-type"
                        }
                      },
                      {
                        "terms":{
                          "full_attributes.attribute_value.slug":[
                            "toilet-tissue"
                          ]
                        }
                      }
                    ]
                  }
                }
              }
            }
          ]
        }
      }
    ]
  }
}