gresockj commented on a change in pull request #5193:
URL: https://github.com/apache/nifi/pull/5193#discussion_r676486405



##########
File path: 
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java
##########
@@ -375,44 +383,143 @@ private int handleSearchCount(Object raw) {
     }
 
     @Override
-    public SearchResponse search(String query, String index, String type) {
-        Response response = runQuery("_search", query, index, type);
-        Map<String, Object> parsed = parseResponse(response);
+    public SearchResponse search(String query, String index, String type, 
Map<String, String> requestParameters) {
+        try {
+            final Response response = runQuery("_search", query, index, type, 
requestParameters);
+            return buildSearchResponse(response);
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    @Override
+    public SearchResponse scroll(String scroll) {
+        try {
+            final HttpEntity scrollEntity = new NStringEntity(scroll, 
ContentType.APPLICATION_JSON);
+            final Response response = client.performRequest("POST", 
"/_search/scroll", Collections.emptyMap(), scrollEntity);
+
+            return buildSearchResponse(response);
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    @Override
+    public String initialisePointInTime(String index, String keepAlive) {
+        try {
+            final Map<String, String> params = new HashMap<String, String>() {{
+                if (StringUtils.isNotBlank(keepAlive)) {
+                    put("keep_alive", keepAlive);
+                }
+            }};
+            final Response response = client.performRequest("POST", index + 
"/_pit", params);
+            final String body = 
IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);

Review comment:
       If you name it DEFAULT_CHARSET, it could add some semantic value here. 
Since it's only used twice, perhaps it's overkill, though.




-- 
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]


Reply via email to