File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
server/src/main/java/org/elasticsearch/index/query
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1717import org .elasticsearch .common .regex .Regex ;
1818import org .elasticsearch .core .Nullable ;
1919import org .elasticsearch .index .mapper .ConstantFieldType ;
20+ import org .elasticsearch .index .mapper .IndexFieldMapper ;
2021import org .elasticsearch .index .mapper .MappedFieldType ;
2122import org .elasticsearch .index .mapper .MappingLookup ;
2223import org .elasticsearch .index .mapper .ValueFetcher ;
2627
2728import java .util .Collections ;
2829import java .util .Map ;
30+ import java .util .Set ;
2931import java .util .function .LongSupplier ;
3032
3133/**
@@ -39,6 +41,13 @@ public class CoordinatorRewriteContext extends QueryRewriteContext {
3941
4042 public static final String TIER_FIELD_NAME = "_tier" ;
4143
44+ public static final Set <String > SUPPORTED_FIELDS = Set .of (
45+ DataStream .TIMESTAMP_FIELD_NAME ,
46+ IndexMetadata .EVENT_INGESTED_FIELD_NAME ,
47+ TIER_FIELD_NAME ,
48+ IndexFieldMapper .NAME
49+ );
50+
4251 static final ConstantFieldType TIER_FIELD_TYPE = new ConstantFieldType (TIER_FIELD_NAME , Map .of ()) {
4352 @ Override
4453 public ValueFetcher valueFetcher (SearchExecutionContext context , String format ) {
Original file line number Diff line number Diff line change 1616import org .elasticsearch .core .Tuple ;
1717import org .elasticsearch .index .IndexMode ;
1818import org .elasticsearch .index .mapper .MappedFieldType ;
19+ import org .elasticsearch .index .query .CoordinatorRewriteContext ;
1920import org .elasticsearch .index .query .QueryBuilder ;
2021import org .elasticsearch .index .query .SearchExecutionContext ;
2122import org .elasticsearch .xpack .esql .EsqlIllegalArgumentException ;
@@ -182,11 +183,8 @@ public static PhysicalPlan localPlan(
182183 /**
183184 * Extracts a filter that can be used to skip unmatched shards on the coordinator.
184185 */
185- private static final Set <String > CAN_MATCH_FIELDS = Set .of ("@timestamp" , "event.ingested" );
186-
187186 public static QueryBuilder canMatchFilter (PhysicalPlan plan ) {
188- // metadata field like _index, _tier
189- return detectFilter (plan , f -> CAN_MATCH_FIELDS .contains (f ) || f .startsWith ("_" ));
187+ return detectFilter (plan , CoordinatorRewriteContext .SUPPORTED_FIELDS ::contains );
190188 }
191189
192190 /**
You can’t perform that action at this time.
0 commit comments