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
private final String name;
        private final List<QueryToFilterAdapter> filters = new ArrayList<>();
        private final boolean keyed;
        private final boolean keyedBucket;
        private final AggregationContext aggCtx;
        private final Aggregator parent;
        private final CardinalityUpperBound cardinality;
        private final Map<String, Object> metadata;
        private final Query rewrittenTopLevelQuery;
        private boolean valid = true;
        public AdapterBuilder(
            String name,
            boolean keyed,
            boolean keyedBucket,
            String otherBucketKey,
            AggregationContext aggCtx,
            Aggregator parent,
            CardinalityUpperBound cardinality,
            Map<String, Object> metadata
        ) throws IOException {
            this.name = name;
            this.keyed = keyed;
            this.keyedBucket = keyedBucket;
            this.aggCtx = aggCtx;
            this.parent = parent;
            this.cardinality = cardinality;
            this.metadata = metadata;
            this.rewrittenTopLevelQuery = aggCtx.searcher().rewrite(aggCtx.query());
            this.valid = parent == null && otherBucketKey == null && aggCtx.isInSortOrderExecutionRequired() == false;
        }