加载query dsl配置文件，在elasticSearch参数对应的es服务器上执行所有操作
@param elasticSearch
@param configFile
@return
490284
public static ClientInterface getConfigRestClientUtil(String elasticSearch,String configFile){
		ElasticSearch elasticSearchSink = getElasticSearchSink( elasticSearch);
		return elasticSearchSink.getConfigRestClientUtil(configFile);
	}
798452
private File[] resolveConfigFiles(File base, Map<String, Object> override) {
        //system properties
        //-Dconfig=config.json -> override
        //Override
        if (override != null) {
            String configFilesString = (String) override.remove("config");
            if (StringUtils.isNotBlank(configFilesString)) {
                log.info("Using config files: {}", configFilesString);

                String[] strings = StringUtils.split(configFilesString, ',');
                File[] files = new File[strings.length];
                for (int i = 0; i < strings.length; i++) {
                    files[i] = new File(base, strings[i]);
                }
                return files;
            }
        }

        //default
        useDefaultConfigFiles = true;
        return base.listFiles(DEFAULT_CONFIG_FILES_FILTER);
    }
902167
private static NetworkConfig fromFile(File configFile, boolean isJson) throws InvalidArgumentException, IOException, NetworkConfigurationException {

        // Sanity check
        if (configFile == null) {
            throw new InvalidArgumentException("configFile must be specified");
        }

        if (logger.isTraceEnabled()) {
            logger.trace(format("NetworkConfig.fromFile: %s  isJson = %b", configFile.getAbsolutePath(), isJson));
        }

        NetworkConfig config;

        // Json file
        try (InputStream stream = new FileInputStream(configFile)) {
            config = isJson ? fromJsonStream(stream) : fromYamlStream(stream);
        }

        return config;
    }
208266
@Deprecated
	private static void createIndexWithSettingsInElasticsearch(Client client, String index, String settings) throws Exception {
		logger.trace("createIndex([{}])", index);

		assert client != null;
		assert index != null;

		CreateIndexRequestBuilder cirb = client.admin().indices().prepareCreate(index);

		// If there are settings for this index, we use it. If not, using Elasticsearch defaults.
		if (settings != null) {
			logger.trace("Found settings for index [{}]: [{}]", index, settings);
			cirb.setSource(settings, XContentType.JSON);
		}

		CreateIndexResponse createIndexResponse = cirb.execute().actionGet();
		if (!createIndexResponse.isAcknowledged()) {
			logger.warn("Could not create index [{}]", index);
			throw new Exception("Could not create index ["+index+"].");
		}

		logger.trace("/createIndex([{}])", index);
	}
1351237
public static JKConfig readConfigFile(String configFileName) {
		URL url = getURL(configFileName);
		logger.debug(configFileName + " Url is ", url.toString());
		JKConfig config = new JKConfig(url);
		return config;
	}
1205538
function elasticsearch (elasticsearchClient) {
    // set client if passed
    if (defined(elasticsearchClient)) {
        // set client on model - throws error on invalid client
        this.elasticsearchClient = this.requireValidElasticsearchClient(elasticsearchClient)
        // return model when setting value
        return this
    }
    // if client is set to true then check if global client exists
    if (this.elasticsearchClient === true) {
        // if global client is set then set it locally
        this.elasticsearchClient = this.requireValidElasticsearchClient(ImmutableCoreModel.elasticsearchGlobal())
    }
    // return current client setting
    return this.elasticsearchClient
}
880916
protected function fetchConfig($configFile)
    {
        if (is_string($configFile) && ! is_readable($configFile)) {
            $configFile = [];
        }

        return ConfigFactory::create($configFile);
    }
339455
private static Properties load(String configFilePath)
	{
		Properties props = new Properties();
		BufferedInputStream fis = null;
		try {
			File configFile = new File(configFilePath);
	        fis = new BufferedInputStream(new FileInputStream(configFile));
	        props.load(fis);
        }
        catch(IOException e){
        	System.err.println("Could not load configuration file "+configFilePath);
        }
        finally{
			if(fis!=null){
			    try {
					fis.close();
				}
				catch (IOException e) {
		        	System.err.println("Error closing file stream of configuration file "+configFilePath);
				}
			}
        }
        return props;
	}
1129442
public static ElasticSearch getElasticSearchSink(String elasticSearch){
		init();
		if(elasticSearch == null || elasticSearch.equals("")) {

			return elasticSearchSink;
		}
		ElasticSearch elasticSearchSink = elasticSearchMap.get(elasticSearch);
		if(elasticSearchSink == null) {
			synchronized (elasticSearchMap) {
				elasticSearchSink = elasticSearchMap.get(elasticSearch);
				if(elasticSearchSink != null)
					return elasticSearchSink;
				context = DefaultApplicationContext.getApplicationContext("conf/elasticsearch.xml");
				elasticSearchSink = context.getTBeanObject(elasticSearch, ElasticSearch.class);
				if (elasticSearchSink != null) {
					elasticSearchMap.put(elasticSearch, elasticSearchSink);
				}
			}
		}
		return elasticSearchSink;
	}
1288136
public static function fromFile($configFile)
    {
        if (false === FileIO::exists($configFile)) {
            throw new ConfigException(sprintf('unable to read "%s"', $configFile));
        }

        return new self(require $configFile);
    }
422076
def initialize(self, conf, ctx):
        
        config = get_config()['ElasticsearchIndexBolt']
        elasticsearch_class = import_name(config['elasticsearch_class'])
        self.es = elasticsearch_class(**config['elasticsearch_init'])
        self.index = config['index']
        self.doc_type = config['doc_type']
293121
public static ElasticsearchClient getInstance(Path config, FsSettings settings, int version) throws ClassNotFoundException {
        Objects.requireNonNull(settings, "settings can not be null");

        Class<ElasticsearchClient> clazz = null;
        try {
            clazz = findClass(version);
        } catch (ClassNotFoundException e) {
            logger.trace("ElasticsearchClient class not found for version {} in the classpath. Skipping...", version);
        }

        if (clazz == null) {
            throw new ClassNotFoundException("Can not find any ElasticsearchClient in the classpath. " +
                    "Did you forget to add the elasticsearch client library?");
        }

        logger.trace("Found [{}] class as the elasticsearch client implementation.", clazz.getName());
        try {
            Constructor<? extends ElasticsearchClient> constructor = clazz.getConstructor(Path.class, FsSettings.class);
            return constructor.newInstance(config, settings);
        } catch (NoSuchMethodException e) {
            throw new IllegalArgumentException("Class " + clazz.getName() + " does not have the expected ctor (Path, FsSettings).", e);
        } catch (IllegalAccessException|InstantiationException| InvocationTargetException e) {
            throw new IllegalArgumentException("Can not create an instance of " + clazz.getName(), e);
        }
    }
901946
public  <T> ESDatas<T> scroll(String path,String dslTemplate,String scroll,Map params,Class<T> type) throws ElasticSearchException{
		throw new java.lang.UnsupportedOperationException();
	}
434462
public   String addDocument(String indexName, String indexType,String addTemplate, Object bean,String refreshOption) throws ElasticSearchException{
		StringBuilder builder = new StringBuilder();
		ClassUtil.ClassInfo classInfo = ClassUtil.getClassInfo(bean.getClass());
		Object id = BuildTool.getId(bean,classInfo);
		Object routing = BuildTool.getRouting(bean,classInfo);

		builder.append(indexName).append("/").append(indexType);
		if(id != null){
			builder.append("/").append(id);
		}
		Object parentId = BuildTool.getParentId(bean,classInfo);
		if(refreshOption != null ){
			builder.append("?").append(refreshOption);
			if(parentId != null){
				builder.append("&parent=").append(parentId);
			}
			if(routing != null){
				builder.append("&routing=").append(routing);
			}
		}
		else if(parentId != null){
			builder.append("?parent=").append(parentId);
			if(routing != null){
				builder.append("&routing=").append(routing);
			}
		}
		else if(routing != null){
			builder.append("?routing=").append(routing);
		}
		String path = builder.toString();
		builder.setLength(0);
		path = this.client.executeHttp(path,ESTemplateHelper.evalDocumentTemplate(esUtil,builder,indexType,indexName,addTemplate,bean,"create"),ClientUtil.HTTP_POST);
		builder = null;
		return path;
	}
97741
public  <T> ESDatas<T> searchAll(String index,  int fetchSize ,Class<T> type) throws ElasticSearchException{
		return searchAll(index,  fetchSize ,(ScrollHandler<T>) null,type);
	}
99095
@VisibleForTesting
    public final Configuration getConfig(final File configFile) throws IOException {
        try (FileInputStream in = new FileInputStream(configFile)) {
            return getConfig(configFile, in);
        }
    }
707930
public static ElasticsearchClient getInstance(Path config, FsSettings settings) {

        Objects.requireNonNull(settings, "settings can not be null");

        for (int i = 7; i >= 1; i--) {
            logger.debug("Trying to find a client version {}", i);

            try {
                return getInstance(config, settings, i);
            } catch (ClassNotFoundException ignored) {
            }
        }

        throw new IllegalArgumentException("Can not find any ElasticsearchClient in the classpath. " +
                "Did you forget to add the elasticsearch client library?");
    }