### CI Link

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+pull-request+part-2/7561/

### Repro line

./gradlew ':x-pack:plugin:spatial:test' --tests "org.elasticsearch.xpack.spatial.search.aggregations.bucket.geogrid.GeoTileTilerTests.testGeoGridSetValuesBoundingBoxes_UnboundedGeoShapeCellValues" -Dtests.seed=B78DF2D3C6E9F87B -Dtests.locale=es-PA -Dtests.timezone=Asia/Magadan -Druntime.java=8

### Does it reproduce?

Yes

### Applicable branches

7.17

### Failure history

_No response_

### Failure excerpt

```
  2> REPRODUCE WITH: ./gradlew ':x-pack:plugin:spatial:test' --tests "org.elasticsearch.xpack.spatial.search.aggregations.bucket.geogrid.GeoTileTilerTests.testGeoGridSetValuesBoundingBoxes_UnboundedGeoShapeCellValues" -Dtests.seed=B78DF2D3C6E9F87B -Dtests.locale=es-PA -Dtests.timezone=Asia/Magadan -Druntime.java=8
  2> java.lang.IllegalArgumentException: Unable to Tessellate shape [[0.0, 0.0] [0.0, -3.7434056992857674E-259] [-6.00631214911533E-180, -3.7434056992857674E-259] [-6.00631214911533E-180, 0.0] [0.0, 0.0] ]. Possible malformed shape detected.
        at __randomizedtesting.SeedInfo.seed([B78DF2D3C6E9F87B:C2BBC29EF3DD375D]:0)
        at org.apache.lucene.geo.Tessellator.tessellate(Tessellator.java:116)
        at org.apache.lucene.document.LatLonShape.createIndexableFields(LatLonShape.java:72)
        at org.elasticsearch.index.mapper.GeoShapeIndexer$LuceneGeometryIndexer.visit(GeoShapeIndexer.java:246)
        at org.elasticsearch.index.mapper.GeoShapeIndexer$LuceneGeometryIndexer.visit(GeoShapeIndexer.java:178)
        at org.elasticsearch.geometry.Polygon.visit(Polygon.java:84)
        at org.elasticsearch.index.mapper.GeoShapeIndexer.indexShape(GeoShapeIndexer.java:174)
        at org.elasticsearch.xpack.spatial.util.GeoTestUtils.binaryGeoShapeDocValuesField(GeoTestUtils.java:54)
        at org.elasticsearch.xpack.spatial.util.GeoTestUtils.geoShapeValue(GeoTestUtils.java:60)
        at org.elasticsearch.xpack.spatial.search.aggregations.bucket.geogrid.GeoGridTilerTestCase.testGeoGridSetValuesBoundingBoxes_UnboundedGeoShapeCellValues(GeoGridTilerTestCase.java:161)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:938)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:974)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)
        at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
        at org.apache.lucene.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:48)
        at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
        at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
        at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
        at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
        at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
        at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
        at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
        at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
        at java.lang.Thread.run(Thread.java:748)
```
x-pack/plugin/spatial/src/test/java/org/elasticsearch/xpack/spatial/search/aggregations/bucket/geogrid/GeoGridTilerTestCase.java
final int numTiles = values.docValueCount();
            final int expected = (int) getCellsForDiffPrecision(i);
            assertThat(numTiles, equalTo(expected));
        }
    }
    public void testGridCircuitBreaker() throws IOException {
        GeoGridTiler tiler = getUnboundedGridTiler(randomIntBetween(0, 3));
        Geometry geometry = GeometryTestUtils.randomPolygon(false);
        GeoShapeValues.GeoShapeValue value = geoShapeValue(geometry);
        List<Long> byteChangeHistory = new ArrayList<>();
        {
            GeoShapeCellValues values = new GeoShapeCellValues(null, tiler, byteChangeHistory::add);
            tiler.setValues(values, value);
        }
        final long maxNumBytes;
        final long curNumBytes;
        if (byteChangeHistory.size() == 1) {
            curNumBytes = maxNumBytes = byteChangeHistory.get(byteChangeHistory.size() - 1);
        } else {
            long oldNumBytes = -byteChangeHistory.get(byteChangeHistory.size() - 1);
            curNumBytes = byteChangeHistory.get(byteChangeHistory.size() - 2);
            maxNumBytes = oldNumBytes + curNumBytes;
        }
        CircuitBreakerService service = new HierarchyCircuitBreakerService(
            Settings.EMPTY,
            Collections.singletonList(new BreakerSettings("limited", maxNumBytes - 1, 1.0)),
            new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS)
        );
        CircuitBreaker limitedBreaker = service.getBreaker("limited");
        LongConsumer circuitBreakerConsumer = (l) -> limitedBreaker.addEstimateBytesAndMaybeBreak(l, "agg");