As part of running a elastic/logging benchmark with synthetic source enabled, I noticed the following stacktrace in the Elasticsearch logs:

```
Caused by: org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: index_out_of_bounds_exception: null
        at org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$TermsDict.seekExact(Lucene90DocValuesProducer.java:1114) ~[lucene-core-9.8.0.jar:?]
        at org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducer$BaseSortedDocValues.lookupOrd(Lucene90DocValuesProducer.java:982) ~[lucene-core-9.8.0.jar:?]
        at org.apache.lucene.index.SingletonSortedSetDocValues.lookupOrd(SingletonSortedSetDocValues.java:95) ~[lucene-core-9.8.0.jar:?]
        at org.elasticsearch.index.mapper.SortedSetDocValuesSyntheticFieldLoader$ImmediateDocValuesLoader.write(SortedSetDocValuesSyntheticFieldLoader.java:198) ~[elasticsea
rch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.index.mapper.SortedSetDocValuesSyntheticFieldLoader.write(SortedSetDocValuesSyntheticFieldLoader.java:125) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?
]
        at org.elasticsearch.index.mapper.ObjectMapper$SyntheticSourceFieldLoader.write(ObjectMapper.java:711) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.index.mapper.ObjectMapper$SyntheticSourceFieldLoader.write(ObjectMapper.java:711) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.index.mapper.SourceLoader$Synthetic$SyntheticLeaf.source(SourceLoader.java:126) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.search.lookup.SyntheticSourceProvider$SyntheticSourceLeafLoader.getSource(SyntheticSourceProvider.java:74) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?
]
        at org.elasticsearch.search.lookup.SyntheticSourceProvider.getSource(SyntheticSourceProvider.java:40) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.search.lookup.LeafSearchLookup.lambda$new$0(LeafSearchLookup.java:39) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.script.AbstractFieldScript.extractFromSource(AbstractFieldScript.java:106) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.script.AbstractFieldScript.emitFromSource(AbstractFieldScript.java:126) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.script.LongFieldScript$1$1.execute(LongFieldScript.java:28) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.script.AbstractFieldScript.runForDoc(AbstractFieldScript.java:158) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.search.runtime.AbstractLongScriptFieldQuery.matches(AbstractLongScriptFieldQuery.java:33) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.search.runtime.AbstractLongScriptFieldQuery.matches(AbstractLongScriptFieldQuery.java:21) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.search.runtime.AbstractScriptFieldQuery$1$1.matches(AbstractScriptFieldQuery.java:77) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreRange(Weight.java:295) ~[lucene-core-9.8.0.jar:?]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:236) ~[lucene-core-9.8.0.jar:?]
        at org.elasticsearch.search.internal.CancellableBulkScorer.score(CancellableBulkScorer.java:45) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:38) ~[lucene-core-9.8.0.jar:?]
        at org.elasticsearch.search.internal.ContextIndexSearcher.searchLeaf(ContextIndexSearcher.java:526) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:455) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.search.internal.ContextIndexSearcher.lambda$search$4(ContextIndexSearcher.java:370) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
        at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) ~[elasticsearch-8.12.0-SNAPSHOT.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]
```

I don't have more information yet. I will update this issue when I know more.
server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java
@Override
    public void preProcess() {
        if (hasOnlySuggest()) {
            return;
        }
        long from = from() == -1 ? 0 : from();
        long size = size() == -1 ? 10 : size();
        long resultWindow = from + size;
        int maxResultWindow = indexService.getIndexSettings().getMaxResultWindow();
        if (resultWindow > maxResultWindow) {
            if (scrollContext() == null) {
                throw new IllegalArgumentException(
                    "Result window is too large, from + size must be less than or equal to: ["
                        + maxResultWindow
                        + "] but was ["
                        + resultWindow
                        + "]. See the scroll api for a more efficient way to request large data sets. "
                        + "This limit can be set by changing the ["
                        + IndexSettings.MAX_RESULT_WINDOW_SETTING.getKey()
                        + "] index level setting."
                );
            }
            throw new IllegalArgumentException(
                "Batch size is too large, size must be less than or equal to: ["
                    + maxResultWindow
                    + "] but was ["
                    + resultWindow
                    + "]. Scroll batch sizes cost as much memory as result windows so they are controlled by the ["
                    + IndexSettings.MAX_RESULT_WINDOW_SETTING.getKey()
                    + "] index level setting."