Elasticsearch - check if the parameter is not empty

In SQL, we can perform the following in the where clause:

SELECT * FROM tbl WHERE :parameter <> '' OR :parameter is not null

Is this possible in Elasticsearch to check if the input parameter/value is not null or empty? I checked the exists query but the parameter is a field, not a parameter.

No.

Why not doing that on the client who creates the query instead of in the query itself?
First time I'm seeing this in SQL.

Thanks for you reply. Just for follow up for context, I need to modify the existing dsl query such that I need to ensure that the ${userId1} is not empty using terms lookup:

{
   "bool":{
      "must":[
         {
            "bool":{
               "should":[
                  {
                     "terms":{
                        "userAccessCodes":{
                           "index":"user-access-codes",
                           "id":"${userId1}",
                           "path":"userAccessCodes"
                        }
                     }
                  },
                  {
                     "terms":{
                        "userAccessCodes":{
                           "index":"user-access-codes",
                           "id":"${userId2}",
                           "path":"userAccessCodes"
                        }
                     }
                  }
               ]
            }
         }
      ]
   }
}

Where userId1 and userId2 are generated? Are you using a query template?