From 70f7390074d7244cbc9ed2bcef9a2b5a32837de4 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Wed, 15 Jul 2020 11:57:14 -0400 Subject: [PATCH] Allow runtime fields to depend on one another This updates a test so that runtime fields depend on one another and fixes support for it. --- .../org/elasticsearch/index/query/QueryShardContext.java | 3 +-- .../rest-api-spec/test/runtime_fields/10_keyword.yml | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/query/QueryShardContext.java b/server/src/main/java/org/elasticsearch/index/query/QueryShardContext.java index b550c6b5552b2..be449f625c399 100644 --- a/server/src/main/java/org/elasticsearch/index/query/QueryShardContext.java +++ b/server/src/main/java/org/elasticsearch/index/query/QueryShardContext.java @@ -297,8 +297,7 @@ MappedFieldType failIfFieldMappingNotFound(String name, MappedFieldType fieldMap public SearchLookup lookup() { if (lookup == null) { - lookup = new SearchLookup(getMapperService(), - mappedFieldType -> indexFieldDataService.apply(mappedFieldType, fullyQualifiedIndex.getName())); + lookup = new SearchLookup(getMapperService(), this::getForField); } return lookup; } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/runtime_fields/10_keyword.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/runtime_fields/10_keyword.yml index 2ccd18b13e9f4..604f11e8f7dbd 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/runtime_fields/10_keyword.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/runtime_fields/10_keyword.yml @@ -25,9 +25,10 @@ setup: type: script runtime_type: keyword script: | - String dow = doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT); - if (dow.startsWith('T')) { - value(dow); + for (String dow: doc['day_of_week']) { + if (dow.startsWith('T')) { + value(dow); + } } - do: