The `search.aggs.rewrite_to_filter_by_filter` is a setting that can disable the filter by filter optimisation. It is n escape hatch setting, because normally the heuristics that control whether this optimisation is executed only trigger this optimisation if it makes sense. In the case that this setting would be set to `false` the filter by filter optimisation would forcefully never be enabled. However this only applies to `terms` and the `range` aggregations and not the `filters` (and `filter`) aggregation. However the filter by filter optimisation exist in both `terms`, `range` and `filters` aggregation.

The `search.aggs.rewrite_to_filter_by_filter` setting should be applicable to `terms`, `range` and `filters` aggregation.
server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FilterByFilterAggregator.java
LeafBucketCollector subCollector = sub;
            int filterOrd;
            @Override
            public void collect(int docId) throws IOException {
                collectBucket(subCollector, docId, filterOrd);
            }
            @Override
            public void setScorer(Scorable scorer) throws IOException {}
        }
        MatchCollector collector = new MatchCollector();
        filters().get(0).collect(aggCtx.getLeafReaderContext(), collector, live);
        for (int filterOrd = 1; filterOrd < filters().size(); filterOrd++) {
            collector.subCollector = collectableSubAggregators.getLeafCollector(aggCtx);
            collector.filterOrd = filterOrd;
            filters().get(filterOrd).collect(aggCtx.getLeafReaderContext(), collector, live);
        }
    }
    @Override
    public void collectDebugInfo(BiConsumer<String, Object> add) {
        super.collectDebugInfo(add);
        add.accept("segments_counted", segmentsCounted);
        add.accept("segments_collected", segmentsCollected);
        add.accept("segments_with_deleted_docs", segmentsWithDeletedDocs);
        add.accept("segments_with_doc_count_field", segmentsWithDocCountField);
    }
}