public classLianXiangWord {private staticRestClient client;static{
client=RestClient.builder(new HttpHost("localhost",9200,"http")).build();
}public static void main(String[] args) throwsException {//LianXiangWorld("手机苹果",12);//SearchLianXiangWorld("手");
SearchLianXiangWorld("手");
}/*** 1.插入联想词
*@paramcontent
*@paramweight
*@throwsException*/
public static void LianXiangWorld(String content, int weight) throwsException {
Map params =Collections.emptyMap();
Map map = new HashMap<>();
Map map2 = new HashMap<>();
map.put("input", content);
map.put("weight", weight);
map2.put("content", map);
String jsonString=Tool.map2Json(map2);
HttpEntity entity= newNStringEntity(jsonString, ContentTyp