public RestHighLevelClient createLocalClient(String className, String fieldName, String indexName, Map<String, EsIndexProperties> indexDef) {
        String clientKey = "local:" + className + '/' + fieldName; //$NON-NLS-1$
        synchronized (clients) {
            if (clients.containsKey(clientKey)) {
                final RestHighLevelClient client = clients.get(clientKey);
                initializeIndices(client, indexDef, indexName);
                return client;
            } else {
                try {
                    Class<?> clientLocClass = Class.forName(className);
                    Field field = clientLocClass.getField(fieldName);
                    RestHighLevelClient client = (RestHighLevelClient) field.get(null);
                    clients.put(clientKey, client);
                    initializeIndices(client, indexDef, indexName);
                    return client;
                } catch (ClassNotFoundException | NoSuchFieldException | SecurityException
                        | IllegalArgumentException | IllegalAccessException e) {
                    throw new RuntimeException("Error using local elasticsearch client.", e); //$NON-NLS-1$
                }
            }
        }
    }
Creates a cache by looking it up in a static field.  Typically used for
testing.
@param className the class name
@param fieldName the field name
@param indexName the name of the ES index
@return the ES client
common/es/src/main/java/io/apiman/common/es/util/LocalClientFactory.java