### Elasticsearch Version

8.11.0

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

MacOS

### Problem Description

When sending a ESQL query with the `enrich` command that involves a policy that does not existing a `NullPointerException` is thrown and shown as error messages to the user:

Query:
```
row a  = 1| enrich missing-policy
```

Returns:
```
null_pointer_exception - Cannot invoke "org.elasticsearch.xpack.core.enrich.EnrichPolicy.getMatchField()" because "policy" is null
```

### Steps to Reproduce

See above.

### Logs (if relevant)

_No response_
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java
}
    
    public void testAggsWithDuplicatesAndNonExistingField() throws Exception {
        verifyUnsupported("""
            row a = 1, b = 2
            | stats x = max(non_existing), x = count(a) by b
            """, "Unknown column [non_existing]");
    }
    
    
    public void testAggsWithDuplicates() throws Exception {
        var plan = analyze("""
            row a = 1, b = 2
            | stats x = count(a), x = min(a), x = max(a) by b
            | sort x
            """);
        var limit = as(plan, Limit.class);
        var order = as(limit.child(), OrderBy.class);
        var agg = as(order.child(), Aggregate.class);
        var aggregates = agg.aggregates();
        assertThat(aggregates, hasSize(2));
        assertThat(Expressions.names(aggregates), contains("x", "b"));
        var alias = as(aggregates.get(0), Alias.class);
        var max = as(alias.child(), Max.class);
    }
    
    public void testAggsWithOverridingInputAndGrouping() throws Exception {
        var plan = analyze("""
            row a = 1, b = 2
            | stats b = count(a), b = max(a) by b