Hisoka-X commented on code in PR #6425:
URL: https://github.com/apache/seatunnel/pull/6425#discussion_r1560405030
##########
seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java:
##########
@@ -289,6 +289,25 @@ public ScrollResult searchByScroll(
return getDocsFromScrollRequest(endpoint,
JsonUtils.toJsonString(param));
}
+ /**
+ * first time to request search documents by scroll call
/${index}/_search?scroll=${scroll}
+ *
+ * @param index index name
+ * @param scrollTime such as:1m
+ * @param scrollSize fetch documents count in one request
+ */
+ public ScrollResult searchByScroll(
+ String index, Map<String, Object> query, String scrollTime, int
scrollSize) {
+ Map<String, Object> param = new HashMap<>();
+ param.put("query", query);
+ param.put("sort", new String[] {"_doc"});
+ param.put("size", scrollSize);
+ String endpoint = "/" + index + "/_search?scroll=" + scrollTime;
+ ScrollResult scrollResult =
+ getDocsFromScrollRequest(endpoint,
JsonUtils.toJsonString(param));
+ return scrollResult;
+ }
+
Review Comment:
please do refactor for
https://github.com/apache/seatunnel/pull/6425/files#diff-a0b35c49c2e2395164f1617e1ae439a0584bdf6e5f82a985a2386c32af2c380fR277
to reduce same code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]