Zend certified PHP/Magento developer

Expand arguments passed to bash function that contains quotes

I want to execute this curl command with the json body. I want to able to execute it with the help of a bash function such as ‘query_db myId myClass’

function query_db(){
    curl -x socks5h://localhost:30001 -X POST https://my-db.us-east-1.es.amazonaws.com/my_db/_search?pretty -H 'Content-Type: application/json' -d '{
  "query": { 
    "bool": { 
      "must": [
        { "match": { "eventData.clazz":   "'$2'"       }},
        { "match": { "eventData.itemId":   "'$1'"       }}
      ]
  }
}
}'
}

However, the above query fails because $2 and $1 is not expanded into the actual arguments. How do I fix this function?