package org.elasticsearch.plugin.nlpcn.preAnalyzer;


import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;

/**
 * Created by fangbb on 2016-11-25.
 */
public class AnsjElasticConfigurator {
    public static ESLogger logger = Loggers.getLogger("sql-init");
    public static Environment environment;
    public static String ES_IP = "";
    public static String ES_PORT = "";

    public static void init(Settings settings) {
        try {
            ES_IP = settings.get("ansj.host");
            ES_PORT = settings.get("http.port");
            if (ES_IP == null || ES_IP.equals("")) {
                logger.error("ansj.host获取失败");
            } else {
                logger.info("ansj.host：" + ES_IP);
            }
            if (ES_PORT == null || ES_PORT.equals("")) {
                ES_PORT = "9200";
                logger.error("ES服务获取失败,使用默认端口:9200");
            } else {
                logger.info("http.port："+ ES_PORT);
            }
        } catch (Exception e) {
            logger.error(e.getMessage());
        }
    }
}

@@ -607,20 +607,23 @@
 gs.get(%22
-ansj
+network
 .host%22);
@@ -755,20 +755,23 @@
 .error(%22
-ansj
+network
 .host%E8%8E%B7%E5%8F%96%E5%A4%B1
@@ -829,12 +829,15 @@
 fo(%22
-ansj
+network
 .hos
@@ -989,12 +989,17 @@
 or(%22
-ES%E6%9C%8D%E5%8A%A1
+http.port
 %E8%8E%B7%E5%8F%96%E5%A4%B1%E8%B4%A5

modify init config