@@ -0,0 +1,1350 @@
+package index.sjtu.sk;%0A%0Aimport java.net.InetAddress;%0Aimport java.net.UnknownHostException;%0Aimport java.util.*;%0Aimport org.elasticsearch.client.Client;%0Aimport org.elasticsearch.client.transport.TransportClient;%0Aimport org.elasticsearch.common.settings.Settings;%0Aimport org.elasticsearch.common.transport.InetSocketTransportAddress;%0A%0Apublic class IndexController %7B%0A%09private static IndexController ic = null;%0A%09private static Client client = null;%09%0A%09%0A%09private IndexController() %7B%0A%09%09// build TransportClient %0A%09%09Settings settings = Settings.settingsBuilder().%0A%09%09%09%09put(%22cluster.name%22, %22knshen-cluster%22).%0A%09%09%09%09put(%22client.transport.sniff%22, true).%0A%09%09%09%09build();%0A%09%09%0A%09%09try %7B%0A%09%09%09client = TransportClient.builder().settings(settings).build().%0A%09%09%09%09%09addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(%22localhost%22), 9300));%0A%0A%09%09%7D catch(UnknownHostException uhe) %7B%0A%09%09%09uhe.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static IndexController createIndexControllerInstance() %7B%0A%09%09if(ic == null) %7B%0A%09%09%09synchronized(IndexController.class) %7B%0A%09%09%09%09if(ic == null) %7B%0A%09%09%09%09%09ic = new IndexController();%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return ic;%0A%09%7D%0A%09%0A%09public boolean insert2Index(String index, String type, List%3CMap%3CString, Object%3E%3E data) %7B%0A%09%09%0A%09%09return true;%0A%09%7D%0A%09%0A%09public static void main(String%5B%5D args) %7B%0A%09%09IndexController ic = IndexController.createIndexControllerInstance();%0A%09%09%0A%09%7D%0A%0A%7D%0A

create index controller