Cannot pass param in sql command

Hi everyone,
I just face a problem in passing a param value in SQL command,
The request is something like this

{
  "query": "select * from index where field in (?)",
  "params": [
    [
      "value1",
      "value2"
    ]
  ]
}

And I get this error

{
  "error": {
    "root_cause": [
      {
        "type": "x_content_parse_exception",
        "reason": "[1:108] Failed to parse object: unexpected token [START_ARRAY] found"
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[1:108] [sql/query] failed to parse field [params]",
    "caused_by": {
      "type": "x_content_parse_exception",
      "reason": "[1:108] Failed to parse object: unexpected token [START_ARRAY] found"
    }
  },
  "status": 400
}

Please let me know what's the thing I missed in this request and how can I correct this.
Thank you in advance.

You had extra brackets in there. Try this.

HI @aaron-nimocks,
Thanks for your comment, it works, but seems like it just takes the first value of the array and uses it in SQL command,
I just received just 1 record from the request instead of a list of records by the values I passed in my select statement,
I'm thinking about the solution that I need to generate the question mark placeholders based on the number of values I'm going to pass,
it would be convenient if I could pass a list of values with an array for fetching a list of records with IN command in SQL,
By the way, thank you guys for this great project,

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.