Elasticsearch 可以建议缺少的数组项吗?

Can Elasticsearch suggest missing items of an array?

假设我有一些成分组合的食谱。很多。

{"sales_name":"pizza Margherita", 
 "ingredients": ["flour", "water", "tomato", "mozzarella", "barm", "salt"]}

{"sales_name":"kaiser roll", 
 "ingredients": ["flour", "barm", "malt", "water", "salt"]}

{"sales_name":"Sacher Torte", 
 "ingredients": ["flour", "water", "sugar", "eggs", "chocolate", "apricot jam"]}

{"sales_name":"bratwurst", "ingredients": ["pork", "veal", "water", "salt"]}

给定包含某些成分的查询:"flour"、"water",Elasticsearch 如何通过在文档中计算它们来建议最有可能的其他成分?
在这个例子中:"salt" 在 "flour" 和 "water" 的食谱中出现了 2 次,而 "sugar" 只出现了一次。 因此查询结果应该是 "salt".

对成分使用聚合。由于我们已经在使用面粉和水,因此最好将它们排除在外。

{
  "query": {
    "terms": {
      "ingredients": [
        "water",
        "flour"
      ]
    }
  },
  "aggs": {
    "bestMatch": {
      "terms": {
        "field": "ingredients",
        "exclude": [
          "water",
          "flour"
        ]
      }
    }
  }
}