conf/elasticsearch.properties   es参数配置文件,在上面的两个xml文件中引用,所以我们只需要修改elasticsearch.properties即可。
  第三步、配置ES查询DSL
在resources下创建配置文件estrace/xxx.xml,配置一个query dsl脚本,名称为queryServiceByCondition,我们将在后面的ClientInterface 组件中通过queryServiceByCondition引用这个脚本,定义脚本内容;
加载query dsl文件,并执行查询操作
  @Override
  public String searchInfo(JSONObject jsonObject) {
        Map<String, Object> params = formatParams(jsonObject);
        JSONObject result = new JSONObject();
        //创建加载配置文件的客户端工具,用来检索文档,单实例多线程安全
        ClientInterface clientUtil = ElasticSearchHelper.getConfigRestClientUtil("esmapper/opinion.xml");
        ESDatas<OpinionInfo> esDatas = clientUtil.searchList("act_yq_info_summary/_search",//act_yq_info_summary为索引名称,search为操作的action
                "searchOpinionInfo",//esmapper/opinion.xml中定义的dsl语句
                params, OpinionInfo.class);
        result.put("esDatas", esDatas);
        return JSONObject.toJSONString(result);
    }
关于BBOSS语法的具体学习,可以移步到 高性能elasticsearch ORM开发库使用介绍,或者入QQ群 166471282
4、提供一个mapping设置和dsl的示例,仅供参考;
PUT /act_yq_info_summary/
{  
   "settings":{  
      "number_of_shards":6,
      "index.refresh_interval": "5s",
      "analysis" : {
          "analyzer" : {
                "ik" : {
                    "tokenizer" : "ik_max_word"
                }
            }
        }
   },
   "mappings":{  
      "articles":{  
         "dynamic_date_formats":[  
            "yyyy-MM-dd HH:mm:ss",
            "yyyyMMdd",
            "yyyy-MM-dd"
         ],
         "dynamic":"false",
         "properties":{  
            "infoUid":{  
               "type":"text"
            },
            "compareId":{  
               "type":"text"
            },
            "plats":{  
               "type":"keyword"
            },
            "keyWords":{  
               "type":"keyword"
            },
            "infoTitle":{  
               "type":"text",
               "store":true,
               "analyzer" : "ik_max_word"
            },
            "infoDetail":{  
               "type":"text",
               "store":true,
               "analyzer" : "ik_max_word"
            },
            "infoUrl":{  
               "type":"text"
            },
            "pubTime":{  
               "type":"date",
               "format":"yyyy-MM-dd HH:mm:ss"
            },
            "platsType":{  
               "type":"keyword"
            },
            "mlEmotion":{  
               "type":"keyword"
            },
            "userEmotion":{  
               "type":"keyword"
            }
         }
      }
   }
}
查询的DSL

