Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add this to ElasticSearchConnection.java
- public HttpPost getHttpPostQueryFromJsonString(String jsonString) throws ParseException {
- JSONObject job = (JSONObject) this.parser.parse(jsonString);
- String tmpIndex = (String) job.get("els_index_str");
- if (tmpIndex == null || tmpIndex.trim().isEmpty()) {
- tmpIndex = this.index;
- } else {
- job.remove("els_index_str");
- }
- String tmpType = (String) job.get("els_type_str");
- if (tmpType == null || tmpType.trim().isEmpty()) {
- tmpType = this.type;
- } else {
- job.remove("els_type_str");
- }
- String fullHostString = esearchHost + "/" + tmpIndex + "/" + tmpType + "/_search";
- // System.out.println("host:"+fullHostString);
- HttpPost httpPost = new HttpPost(fullHostString);
- HttpEntity entity = new StringEntity(job.toJSONString(), "UTF-8");
- httpPost.setEntity(entity);
- return httpPost;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement