$lookup with $search when using field as query

Wondering how a $lookup paired with $search would work. I’m expecting the following to return something, but it doesn’t. However, hard coding the query does work.

db.getCollection('recipes').aggregate([
    {
        $match: {}
    },
    {
        $unwind: "$ingredients"
    },
    {
        $lookup: {
          let: { ingredient_name: "$ingredients.name" },
          from: "products",
          as: "product",
          pipeline: [
            {
                $search: {
                    index: "products",
                    text: {
                      query: "$$ingredient_name",
                      path: {
                        wildcard: "*"
                      }
                    }
                }
            },
            {
                $limit: 1
            }
          ]
        }
    }

I am not crazy.

This was already brought up here: https://jira.mongodb.org/browse/SERVER-71036.

Hi @Mahmoud_N_A , confirming that this is a known issue. Can you confirm that what you are trying to achieve is: for every ingredient which exists in the recipes collection, search for matching documents in the products collection. As mentioned in the linked Jira ticket, this could result in unbounded amount of $search queries running – do you have an approximate for the scale that you expect this to be executed at (e.g. how many ingredients will be searched at a time?)