diff --git a/core/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java b/core/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java index f7776f299a6e9..6ce060c493e1e 100644 --- a/core/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java +++ b/core/src/main/java/org/elasticsearch/search/lookup/LeafDocLookup.java @@ -33,9 +33,9 @@ import java.util.Map; import java.util.Set; -public class LeafDocLookup implements Map { +public class LeafDocLookup implements Map> { - private final Map localCacheFieldData = new HashMap<>(4); + private final Map> localCacheFieldData = new HashMap<>(4); private final MapperService mapperService; private final IndexFieldDataService fieldDataService; @@ -67,10 +67,10 @@ public void setDocument(int docId) { } @Override - public Object get(Object key) { + public ScriptDocValues get(Object key) { // assume its a string... String fieldName = key.toString(); - ScriptDocValues scriptValues = localCacheFieldData.get(fieldName); + ScriptDocValues scriptValues = localCacheFieldData.get(fieldName); if (scriptValues == null) { final MappedFieldType fieldType = mapperService.fullName(fieldName); if (fieldType == null) { @@ -78,9 +78,9 @@ public Object get(Object key) { } // load fielddata on behalf of the script: otherwise it would need additional permissions // to deal with pagedbytes/ramusagestimator/etc - scriptValues = AccessController.doPrivileged(new PrivilegedAction() { + scriptValues = AccessController.doPrivileged(new PrivilegedAction>() { @Override - public ScriptDocValues run() { + public ScriptDocValues run() { return fieldDataService.getForField(fieldType).load(reader).getScriptValues(); } }); @@ -94,7 +94,7 @@ public ScriptDocValues run() { public boolean containsKey(Object key) { // assume its a string... String fieldName = key.toString(); - ScriptDocValues scriptValues = localCacheFieldData.get(fieldName); + ScriptDocValues scriptValues = localCacheFieldData.get(fieldName); if (scriptValues == null) { MappedFieldType fieldType = mapperService.fullName(fieldName); if (fieldType == null) { @@ -120,17 +120,17 @@ public boolean containsValue(Object value) { } @Override - public Object put(Object key, Object value) { + public ScriptDocValues put(String key, ScriptDocValues value) { throw new UnsupportedOperationException(); } @Override - public Object remove(Object key) { + public ScriptDocValues remove(Object key) { throw new UnsupportedOperationException(); } @Override - public void putAll(Map m) { + public void putAll(Map> m) { throw new UnsupportedOperationException(); } @@ -140,17 +140,17 @@ public void clear() { } @Override - public Set keySet() { + public Set keySet() { throw new UnsupportedOperationException(); } @Override - public Collection values() { + public Collection> values() { throw new UnsupportedOperationException(); } @Override - public Set entrySet() { + public Set>> entrySet() { throw new UnsupportedOperationException(); } }