Kaynağa Gözat

Remove deprecation warning when doc scripts refer to '_type' field (#53605)

We currently emit a warning in 8x when a script refers to the _type field for
a document. However, in 8x this field no longer exists, so the deprecation
warning is not required.

Relates to #41059
Alan Woodward 5 yıl önce
ebeveyn
işleme
795a92707f

+ 0 - 1
docs/reference/mapping/fields/type-field.asciidoc

@@ -57,7 +57,6 @@ GET my_index/_search
 
 --------------------------
 // TEST[warning:[types removal] Using the _type field in queries and aggregations is deprecated, prefer to use a field instead.]
-// TEST[warning:[types removal] Looking up doc types [_type] in scripts is deprecated.]
 
 <1> Querying on the `_type` field
 <2> Aggregating on the `_type` field

+ 0 - 12
server/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java

@@ -18,10 +18,8 @@
  */
 package org.elasticsearch.search.lookup;
 
-import org.apache.logging.log4j.LogManager;
 import org.apache.lucene.index.LeafReaderContext;
 import org.elasticsearch.ExceptionsHelper;
-import org.elasticsearch.common.logging.DeprecationLogger;
 import org.elasticsearch.index.fielddata.IndexFieldData;
 import org.elasticsearch.index.fielddata.ScriptDocValues;
 import org.elasticsearch.index.mapper.MappedFieldType;
@@ -38,12 +36,6 @@ import java.util.function.Function;
 
 public class LeafDocLookup implements Map<String, ScriptDocValues<?>> {
 
-    private static final DeprecationLogger DEPRECATION_LOGGER
-            = new DeprecationLogger(LogManager.getLogger(LeafDocLookup.class));
-    static final String TYPES_DEPRECATION_KEY = "type-field-doc-lookup";
-    static final String TYPES_DEPRECATION_MESSAGE =
-            "[types removal] Looking up doc types [_type] in scripts is deprecated.";
-
     private final Map<String, ScriptDocValues<?>> localCacheFieldData = new HashMap<>(4);
 
     private final MapperService mapperService;
@@ -74,10 +66,6 @@ public class LeafDocLookup implements Map<String, ScriptDocValues<?>> {
 
     @Override
     public ScriptDocValues<?> get(Object key) {
-        // deprecate _type
-        if ("_type".equals(key)) {
-            DEPRECATION_LOGGER.deprecatedAndMaybeLog(TYPES_DEPRECATION_KEY, TYPES_DEPRECATION_MESSAGE);
-        }
         // assume its a string...
         String fieldName = key.toString();
         ScriptDocValues<?> scriptValues = localCacheFieldData.get(fieldName);