**Build scan:**
https://gradle-enterprise.elastic.co/s/6sxf663vnkl4g/tests/:server:test/org.elasticsearch.search.aggregations.bucket.geogrid.GeoTileGridAggregatorTests/testBoundedMultiValuedDocs
**Reproduction line:**
```
./gradlew ':server:test' --tests "org.elasticsearch.search.aggregations.bucket.geogrid.GeoTileGridAggregatorTests.testBoundedMultiValuedDocs" -Dtests.seed=A62BA7A35A3D27DF -Dtests.locale=nl -Dtests.timezone=Europe/Budapest -Druntime.java=21
```

**Applicable branches:**
main

**Reproduces locally?:**
Didn't try

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.search.aggregations.bucket.geogrid.GeoTileGridAggregatorTests&tests.test=testBoundedMultiValuedDocs


**Failure excerpt:**
```
java.lang.IllegalArgumentException: invalid latitude -96.04741020128131; must be between -90.0 and 90.0

  at __randomizedtesting.SeedInfo.seed([A62BA7A35A3D27DF:F1F316E40DCC2FB]:0)
  at org.apache.lucene.geo.GeoUtils.checkLatitude(GeoUtils.java:64)
  at org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude(GeoEncodingUtils.java:59)
  at org.elasticsearch.search.aggregations.bucket.geogrid.GeoTileBoundedPredicate.<init>(GeoTileBoundedPredicate.java:49)
  at org.elasticsearch.search.aggregations.bucket.geogrid.GeoTileCellIdSource.boundedCellMultiValues(GeoTileCellIdSource.java:69)
  at org.elasticsearch.search.aggregations.bucket.geogrid.CellIdSource.longValues(CellIdSource.java:65)
  at org.elasticsearch.search.aggregations.bucket.geogrid.GeoGridAggregator.getLeafCollector(GeoGridAggregator.java:75)
  at org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:221)
  at org.elasticsearch.search.aggregations.MultiBucketCollector$1.getLeafCollector(MultiBucketCollector.java:92)
  at org.elasticsearch.search.aggregations.AggregatorCollector.getLeafCollector(AggregatorCollector.java:35)
  at org.elasticsearch.search.internal.ContextIndexSearcher.searchLeaf(ContextIndexSearcher.java:510)
  at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:455)
  at org.elasticsearch.search.internal.ContextIndexSearcher.lambda$search$4(ContextIndexSearcher.java:370)
  at java.util.concurrent.FutureTask.run(FutureTask.java:317)
  at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:983)
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
  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)

```
server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregatorTests.java
final int encodedRight = encodeLongitude(bbox.right());
        final double right = encodeLongitude(maxTile.getMinX()) == encodedRight
            ? decodeLongitude(encodedRight)
            : decodeLongitude(encodedRight + 1);
        final int encodedBottom = encodeLatitude(bbox.bottom());
        final double top = encodeLatitude(maxTile.getMaxY()) == encodedBottom
            ? decodeLatitude(encodedBottom)
            : decodeLatitude(encodedBottom + 1);
        bbox.topLeft().reset(top, left);
        bbox.bottomRight().reset(bottom, right);
        return bbox;
    }
    @Override
    protected Rectangle getTile(double lng, double lat, int precision) {
        return GeoTileUtils.toBoundingBox(GeoTileUtils.longEncode(lng, lat, precision));
    }
    @Override
    protected GeoGridAggregationBuilder createBuilder(String name) {
        return new GeoTileGridAggregationBuilder(name);
    }
    public void testPrecision() {
        final GeoGridAggregationBuilder builder = createBuilder("_name");
        expectThrows(IllegalArgumentException.class, () -> builder.precision(-1));
        expectThrows(IllegalArgumentException.class, () -> builder.precision(30));
        int precision = randomIntBetween(0, 29);
        builder.precision(precision);
        assertEquals(precision, builder.precision());
    }
}