@Test
void shouldNotPushDownFilterFarFromRelation() {

  when(settings.getSettingValue(Settings.Key.QUERY_SIZE_LIMIT)).thenReturn(200);
  ReferenceExpression field = ref("name", STRING);
  Expression filterExpr = dsl.equal(field, literal("John"));
  List<NamedExpression> groupByExprs = Arrays.asList(named("age", ref("age", INTEGER)));
  List<NamedAggregator> aggregators =
      Arrays.asList(named("avg(age)", new AvgAggregator(Arrays.asList(ref("age", INTEGER)),
          DOUBLE)));
  String indexName = "test";
  ElasticsearchIndex index = new ElasticsearchIndex(client, settings, indexName);
  PhysicalPlan plan = index.implement(
      filter(
          aggregation(
              relation(indexName),
              aggregators,
              groupByExprs
          ),
          filterExpr));
  assertTrue(plan instanceof FilterOperator);
}