You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/12/22 22:11:45 UTC

[GitHub] [nifi] ChrisSamo632 commented on a diff in pull request #6687: NIFI-10844 allow _source only output for GetElasticsearch and JsonQueryElasticsearch processors

ChrisSamo632 commented on code in PR #6687:
URL: https://github.com/apache/nifi/pull/6687#discussion_r1055894635


##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/test/java/org/apache/nifi/elasticsearch/integration/ElasticSearchClientService_IT.java:
##########
@@ -205,19 +206,29 @@ void testVerifyFailedApiKeyAuth() {
 
     @Test
     void testBasicSearch() throws Exception {
+        assertBasicSearch(null);
+    }
+
+    @Test
+    void testBasicSearchRequestParameters() throws Exception {
+        assertBasicSearch(createParameters("preference", "_local"));
+    }
+
+    private void assertBasicSearch(final Map<String, String> requestParameters) throws JsonProcessingException {
         final Map<String, Object> temp = new MapBuilder()
-            .of("size", 10, "query", new MapBuilder().of("match_all", new HashMap<>()).build(),
-                    "aggs", new MapBuilder()
-                            .of("term_counts", new MapBuilder()
-                                    .of("terms", new MapBuilder()
-                                            .of("field", "msg", "size", 5)
-                                            .build())
-                                    .build())
-                            .build())
+                .of("size", 10, "query", new MapBuilder().of("match_all", new HashMap<>()).build(),

Review Comment:
   I don't think this is required, the use of `HashMap` here (and throughout all uses of the `MapBuilder` class in the tests) has been to create an empty Map (i.e. JSON Object) for the `match_all` part of the Elasticsearch Query DSL request body
   
   I have, however, changed the `MapBuilder` to use a `LinkedHashMap` internally instead of a `HashMap`, which might be relevant for keeping things in order (although that shouldn't matter for the submission to Elasticsearch)



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org