### Description

As we have more rules doing analysis across plans, a number of methods are useful to add to the `QueryPlan` class itself, mainly around expressions:

```
- expressions() - return the expressions declared by this plan
- references() - return the references from the expressions above
```
x-pack/plugin/ql/src/test/java/org/elasticsearch/xpack/ql/plan/QueryPlanTests.java
}
        });
        assertEquals(singletonList(limit.limit().fold()), list);
    }
    public void testForEachWithExpressionTopLevelInCollection() throws Exception {
        FieldAttribute one = fieldAttribute("one", INTEGER);
        FieldAttribute two = fieldAttribute("two", INTEGER);
        Project project = new Project(EMPTY, relation(), asList(one, two));
        List<NamedExpression> list = new ArrayList<>();
        project.forEachExpression(NamedExpression.class, n -> {
            if (n.name().equals("one")) {
                list.add(n);
            }
        });
        assertEquals(singletonList(one), list);
    }
    public void testForEachWithExpressionTreeInCollection() throws Exception {
        Alias one = new Alias(EMPTY, "one", of(42));
        FieldAttribute two = fieldAttribute();
        Project project = new Project(EMPTY, relation(), asList(one, two));
        List<Object> list = new ArrayList<>();
        project.forEachExpression(Literal.class, l -> {
            if (l.fold().equals(42)) {
                list.add(l.fold());
            }
        });
        assertEquals(singletonList(one.child().fold()), list);
    }
}