### Elasticsearch Version

8.11.0

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

MacOS

### Problem Description

I would expect a clear message for the following ES|QL query:

```
from index | where 1 year
```

But what I get is:

```
[esql] > Unexpected error from Elasticsearch: illegal_argument_exception - Unrecognized class type class java.time.Period
```

### Steps to Reproduce

See above.

### Logs (if relevant)

_No response_
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/analysis/Verifier.java
var exp = e instanceof Alias ? ((Alias) e).child() : e;
                    if (exp instanceof AggregateFunction aggFunc) {
                        Expression field = aggFunc.field();
                        
                        if ((field instanceof FieldAttribute
                            || field instanceof MetadataAttribute
                            || field instanceof ReferenceAttribute
                            || field instanceof Literal) == false) {
                            failures.add(
                                fail(
                                    e,
                                    "aggregate function's field must be an attribute or literal; found ["
                                        + field.sourceText()
                                        + "] of type ["
                                        + field.nodeName()
                                        + "]"
                                )
                            );
                        }
                    } else if (agg.groupings().contains(exp) == false) { 
                        failures.add(
                            fail(
                                exp,
                                "expected an aggregate function or group but got ["
                                    + exp.sourceText()
                                    + "] of type ["
                                    + exp.nodeName()
                                    + "]"
                            )
                        );