From b1161cba35d06c73d862aafc9190f79953d437f5 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Wed, 17 Jun 2020 10:36:31 -0700 Subject: [PATCH] Rename SearchContext#smartNameFieldType. (#58203) The concept of a 'smart name' doesn't make sense now that there are no mapping types. --- .../java/org/elasticsearch/search/DefaultSearchContext.java | 2 +- .../main/java/org/elasticsearch/search/fetch/FetchPhase.java | 2 +- .../elasticsearch/search/internal/FilteredSearchContext.java | 4 ++-- .../java/org/elasticsearch/search/internal/SearchContext.java | 4 ++-- .../elasticsearch/search/aggregations/AggregatorTestCase.java | 2 +- .../main/java/org/elasticsearch/test/TestSearchContext.java | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java b/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java index 8ea78b7af4e..22e48b77c0c 100644 --- a/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java +++ b/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java @@ -796,7 +796,7 @@ final class DefaultSearchContext extends SearchContext { } @Override - public MappedFieldType smartNameFieldType(String name) { + public MappedFieldType fieldType(String name) { return mapperService().fieldType(name); } diff --git a/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java index 3bd74558d59..ed76181c646 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java @@ -120,7 +120,7 @@ public class FetchPhase implements SearchPhase { Collection fieldNames = context.mapperService().simpleMatchToFullName(fieldNameOrPattern); for (String fieldName : fieldNames) { - MappedFieldType fieldType = context.smartNameFieldType(fieldName); + MappedFieldType fieldType = context.fieldType(fieldName); if (fieldType == null) { // Only fail if we know it is a object field, missing paths / fields shouldn't fail. if (context.getObjectMapper(fieldName) != null) { diff --git a/server/src/main/java/org/elasticsearch/search/internal/FilteredSearchContext.java b/server/src/main/java/org/elasticsearch/search/internal/FilteredSearchContext.java index 41c46fc6a81..ecbc5f465c9 100644 --- a/server/src/main/java/org/elasticsearch/search/internal/FilteredSearchContext.java +++ b/server/src/main/java/org/elasticsearch/search/internal/FilteredSearchContext.java @@ -497,8 +497,8 @@ public abstract class FilteredSearchContext extends SearchContext { } @Override - public MappedFieldType smartNameFieldType(String name) { - return in.smartNameFieldType(name); + public MappedFieldType fieldType(String name) { + return in.fieldType(name); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/internal/SearchContext.java b/server/src/main/java/org/elasticsearch/search/internal/SearchContext.java index 67577d61a74..6c057902048 100644 --- a/server/src/main/java/org/elasticsearch/search/internal/SearchContext.java +++ b/server/src/main/java/org/elasticsearch/search/internal/SearchContext.java @@ -388,9 +388,9 @@ public abstract class SearchContext extends AbstractRefCounted implements Releas } /** - * Looks up the given field, but does not restrict to fields in the types set on this context. + * Given the full name of a field, returns its {@link MappedFieldType}. */ - public abstract MappedFieldType smartNameFieldType(String name); + public abstract MappedFieldType fieldType(String name); public abstract ObjectMapper getObjectMapper(String name); diff --git a/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java b/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java index e309f08b753..2cf9978bc08 100644 --- a/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java @@ -181,7 +181,7 @@ public abstract class AggregatorTestCase extends ESTestCase { MappedFieldType fieldType = entry.getValue(); when(mapperService.fieldType(fieldName)).thenReturn(fieldType); - when(searchContext.smartNameFieldType(fieldName)).thenReturn(fieldType); + when(searchContext.fieldType(fieldName)).thenReturn(fieldType); } } diff --git a/test/framework/src/main/java/org/elasticsearch/test/TestSearchContext.java b/test/framework/src/main/java/org/elasticsearch/test/TestSearchContext.java index f7f410e6389..605023fafd2 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/TestSearchContext.java +++ b/test/framework/src/main/java/org/elasticsearch/test/TestSearchContext.java @@ -578,7 +578,7 @@ public class TestSearchContext extends SearchContext { } @Override - public MappedFieldType smartNameFieldType(String name) { + public MappedFieldType fieldType(String name) { if (mapperService() != null) { return mapperService().fieldType(name); }