@@ -687,14 +687,45 @@ public void testErrorMessageForInvalidIntervalParams() throws IOException {
687687 );
688688 }
689689
690- public void testErrorMessageForArrayValuesInParams () throws IOException {
690+ public void testArrayValuesAllowedInValueParams () throws IOException {
691+ Map <String , Object > responseMap = runEsql (
692+ RequestObjectBuilder .jsonBuilder ()
693+ .query ("row a = ?n1 | eval s = ?n2" )
694+ .params ("[{\" n1\" : [\" a1\" , \" a2\" ]}, {\" n2\" : [1, 2]}]" )
695+ );
696+ System .out .println (responseMap );
697+
698+ ListMatcher values = matchesList ().item (
699+ matchesList ().item (matchesList ().item ("a1" ).item ("a2" )).item (matchesList ().item (1 ).item (2 ))
700+ );
701+
702+ assertResultMap (
703+ responseMap ,
704+ matchesList ().item (matchesMap ().entry ("name" , "a" ).entry ("type" , "keyword" ))
705+ .item (matchesMap ().entry ("name" , "s" ).entry ("type" , "integer" )),
706+ values
707+ );
708+ }
709+
710+ public void testErrorMessageForArrayValuesInNonValueParams () throws IOException {
691711 ResponseException re = expectThrows (
692712 ResponseException .class ,
693- () -> runEsql (RequestObjectBuilder .jsonBuilder ().query ("row a = 1 | eval x = ?" ).params ("[{\" n1\" : [5, 6, 7]}]" ))
713+ () -> runEsql (
714+ RequestObjectBuilder .jsonBuilder ().query ("row a = 1 | eval ?n1 = 5" ).params ("[{\" n1\" : {\" identifier\" : [\" integer\" ]}}]" )
715+ )
716+ );
717+ assertThat (
718+ EntityUtils .toString (re .getResponse ().getEntity ()),
719+ containsString ("\" Failed to parse params: [1:47] n1={identifier=[integer]} parameter is multivalued" )
720+ );
721+
722+ re = expectThrows (
723+ ResponseException .class ,
724+ () -> runEsql (RequestObjectBuilder .jsonBuilder ().query ("row a = 1 | keep ?n1" ).params ("[{\" n1\" : {\" pattern\" : [\" a*\" ]}}]" ))
694725 );
695726 assertThat (
696727 EntityUtils .toString (re .getResponse ().getEntity ()),
697- containsString ("Failed to parse params: [1:45 ] n1=[5, 6, 7] is not supported as a parameter " )
728+ containsString ("\" Failed to parse params: [1:43 ] n1={pattern=[a*]} parameter is multivalued " )
698729 );
699730 }
700731
0 commit comments