Reproduces more or less deterministically on https://demo.elastic.co

```
POST _query
{
  "query":"from metrics-* | stats avg(event.duration) | limit 10"
}
```

```
Caused by: java.lang.NullPointerException: Cannot invoke "org.elasticsearch.index.mapper.MappedFieldType.typeName()" because "fieldType" is null
	at org.elasticsearch.xpack.esql.stats.SearchStats.detectSingleValue(SearchStats.java:185)
	at org.elasticsearch.xpack.esql.stats.SearchStats.lambda$isSingleValue$10(SearchStats.java:168)
	at org.elasticsearch.xpack.esql.stats.SearchStats.doWithContexts(SearchStats.java:283)
	at org.elasticsearch.xpack.esql.stats.SearchStats.isSingleValue(SearchStats.java:167)
	at org.elasticsearch.xpack.esql.optimizer.LocalPhysicalPlanOptimizer$PushStatsToSource.lambda$pushableStats$0(LocalPhysicalPlanOptimizer.java:379)
	at java.util.Map.computeIfAbsent(Map.java:1066)
	at org.elasticsearch.xpack.esql.optimizer.LocalPhysicalPlanOptimizer$PushStatsToSource.pushableStats(LocalPhysicalPlanOptimizer.java:364)
	at org.elasticsearch.xpack.esql.optimizer.LocalPhysicalPlanOptimizer$PushStatsToSource.rule(LocalPhysicalPlanOptimizer.java:331)
	at org.elasticsearch.xpack.esql.optimizer.LocalPhysicalPlanOptimizer$PushStatsToSource.rule(LocalPhysicalPlanOptimizer.java:323)
	at org.elasticsearch.xpack.esql.optimizer.PhysicalOptimizerRules$ParameterizedOptimizerRule.lambda$apply$0(PhysicalOptimizerRules.java:37)

```


x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/stats/SearchStats.java
import java.util.List;
import java.util.Map;
import static org.elasticsearch.index.mapper.DataStreamTimestampFieldMapper.TimestampFieldType;
import static org.elasticsearch.index.mapper.DateFieldMapper.DateFieldType;
import static org.elasticsearch.index.mapper.KeywordFieldMapper.KeywordFieldType;
public class SearchStats {
    private final List<SearchContext> contexts;
    private static class FieldStat {
        private Long count;
        private Boolean exists;
        private Object min, max;
        private Boolean singleValue;
    }
    private static final int CACHE_SIZE = 32;
    
    private final Map<String, FieldStat> cache = new LinkedHashMap<>(CACHE_SIZE, 0.75f, true) {
        @Override
        protected boolean removeEldestEntry(Map.Entry<String, FieldStat> eldest) {
            return size() > CACHE_SIZE;
        }
    };
    public SearchStats(List<SearchContext> contexts) {
        this.contexts = contexts;
    }
    public long count() {
        var count = new long[] { 0 };
        boolean completed = doWithContexts(r -> {
            count[0] += r.numDocs();
            return true;
        }, false);