Querying a Data source

I’m trying to query a data source using HTTP API using a script.
I’m basing the script off of this example on the official documentation:

POST /api/tsdb/query HTTP/1.1
Accept: application/json
Content-Type: application/json

{
  "from": "1420066800000",
  "to": "1575845999999",
  "queries": [
    {
      "refId": "A",
      "intervalMs": 86400000,
      "maxDataPoints": 1092,
      "datasourceId": 86,
      "rawSql": "SELECT 1 as valueOne, 2 as valueTwo",
      "format": "table"
    }
  ]
}

On the example above, it uses a rawSQL query, but in my case, my data source uses another query language. My query looks like this:

users_state:$User_State

I tried placing it to the rawSQL value but im getting {"message":"No queries found in query"} error message.

Can you suggest a way to approach this properly?

what datasource are you trying to query?

I am using elasticsearch datasource