Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Mar 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,12 +36,6 @@

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;
Expand Down Expand Up @@ -74,10 +66,6 @@ public void setDocument(int docId) {

@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);
Expand Down