A preview call can be quite expensive and cause timeout in a cluster. As a short term fix we identified 2 (hopefully) small fixes:

- make the call cancellable, the main issue here seems to be that preview calls search without using a parent task id(see this fix for data feeds: https://github.com/elastic/elasticsearch/pull/88142/files#diff-aba58244cb8f9dfa3ac3b6efeb02259e3d5956576f56c1ff5e243dd2aac27381)
- pass the timeout parameter of the preview call to the search call, currently a timeout can be specified, but is ignored for the inner search call, which is executed with no timeout (see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html#search-search-api-query-params).

Both changes are bugs and shall be relatively simple to implement and considered for backport to the 7.17 branch.

@przemekwitek can you have a look at this?

related: #88010
x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/transforms/pivot/PivotTests.java
assertThat(pivot.processSearchResponse(searchResponseFromAggs(aggs), null, null, null, null, null), is(nullValue()));
        CompositeAggregation compositeAgg = mock(CompositeAggregation.class);
        when(compositeAgg.getName()).thenReturn("_transform");
        when(compositeAgg.getBuckets()).thenReturn(List.of());
        when(compositeAgg.afterKey()).thenReturn(null);
        aggs = new Aggregations(List.of(compositeAgg));
        assertThat(pivot.processSearchResponse(searchResponseFromAggs(aggs), null, null, null, null, null), is(nullValue()));
        when(compositeAgg.getBuckets()).thenReturn(List.of());
        when(compositeAgg.afterKey()).thenReturn(Map.of("key", "value"));
        aggs = new Aggregations(List.of(compositeAgg));
        
        assertThat(pivot.processSearchResponse(searchResponseFromAggs(aggs), null, null, null, null, null), is(notNullValue()));
        CompositeAggregation.Bucket bucket = mock(CompositeAggregation.Bucket.class);
        List<? extends CompositeAggregation.Bucket> buckets = List.of(bucket);
        doReturn(buckets).when(compositeAgg).getBuckets();
        when(compositeAgg.afterKey()).thenReturn(null);
        aggs = new Aggregations(List.of(compositeAgg));
        assertThat(pivot.processSearchResponse(searchResponseFromAggs(aggs), null, null, null, null, null), is(nullValue()));
    }
    private static SearchResponse searchResponseFromAggs(Aggregations aggs) {
        SearchResponseSections sections = new SearchResponseSections(null, aggs, null, false, null, null, 1);
        SearchResponse searchResponse = new SearchResponse(sections, null, 10, 5, 0, 0, new ShardSearchFailure[0], null);
        return searchResponse;
    }
    private class MyMockClient extends NoOpClient {
        MyMockClient(String testName) {
            super(testName);
        }
        @SuppressWarnings("unchecked")
        @Override