Filter on sub object field, based on other fields value

I have a document with two fields, one field is a string. the other a array:

{
    "foo": "bar",
    "faz": {
        "bar": "bla bla",
        "baz": "etc.. " 
    }
}

I want to be able to filter on faz.bar, but this is, dynamic on the value of foo. So if foo: baz i want to filter on faz.baz. Is there a query like faz.{foo} possible? How can i achieve the desired outcome?

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