### CI Link

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+pull-request+part-1/37011/

### Repro line

./gradlew 'null' --tests "org.elasticsearch.search.aggregations.metrics.MedianAbsoluteDeviationAggregatorTests.testQueryFiltering" -Dtests.seed=AB1022A12018B138 -Dtests.locale=fr-CA -Dtests.timezone=Asia/Amman -Druntime.java=20

### Does it reproduce?

Yes

### Applicable branches

main

### Failure history

_No response_

### Failure excerpt

java.lang.AssertionError: 
Expected: within <10.0> percent of <125.0>
     but: was <103.56692363555098>
Expected :within <10.0> percent of <125.0>
Actual   :<103.56692363555098>

	at __randomizedtesting.SeedInfo.seed([AB1022A12018B138:6F79CE6D4F544F21]:0)
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
	at org.junit.Assert.assertThat(Assert.java:956)
	at org.junit.Assert.assertThat(Assert.java:923)
	at org.elasticsearch.search.aggregations.metrics.MedianAbsoluteDeviationAggregatorTests.lambda$testQueryFiltering$11(MedianAbsoluteDeviationAggregatorTests.java:130)
	at org.elasticsearch.search.aggregations.AggregatorTestCase.testCase(AggregatorTestCase.java:699)
	at org.elasticsearch.search.aggregations.metrics.MedianAbsoluteDeviationAggregatorTests.testAggregation(MedianAbsoluteDeviationAggregatorTests.java:233)
	at org.elasticsearch.search.aggregations.metrics.MedianAbsoluteDeviationAggregatorTests.testAggregation(MedianAbsoluteDeviationAggregatorTests.java:223)
	at org.elasticsearch.search.aggregations.metrics.MedianAbsoluteDeviationAggregatorTests.testQueryFiltering(MedianAbsoluteDeviationAggregatorTests.java:125)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
server/src/test/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregatorTests.java
private final double expected;
        private final double error;
        public IsCloseToRelative(double expected, double error) {
            this.expected = expected;
            this.error = error;
        }
        @Override
        protected boolean matchesSafely(Double actual) {
            final double deviation = Math.abs(actual - expected);
            final double observedError = deviation / Math.abs(expected);
            return observedError <= error;
        }
        @Override
        public void describeTo(Description description) {
            description.appendText("within ").appendValue(error * 100).appendText(" percent of ").appendValue(expected);
        }
        public static IsCloseToRelative closeToRelative(double expected, double error) {
            return new IsCloseToRelative(expected, error);
        }
        public static IsCloseToRelative closeToRelative(double expected) {
            return closeToRelative(expected, 0.1);
        }
    }
    /**
     * This class is an implementation of median absolute deviation that computes an exact value, rather than the approximation used in the
     * aggregation. It's used to verify that the aggregation's approximate results are close enough to the exact result
     */
    public static class ExactMedianAbsoluteDeviation {