@Override
public Object get(Object key) {
// assume its a string...
String fieldName = key.toString();
ScriptDocValues scriptValues = localCacheFieldData.get(fieldName);
if (scriptValues == null) {
FieldMapper mapper = mapperService.smartNameFieldMapper(fieldName, types);
if (mapper == null) {
throw new ElasticsearchIllegalArgumentException("No field found for [" + fieldName + "] in mapping with types " + Arrays.toString(types) + "");
}
scriptValues = fieldDataService.getForField(mapper).load(reader).getScriptValues();
localCacheFieldData.put(fieldName, scriptValues);
}
scriptValues.setNextDocId(docId);
return scriptValues;
}