How to convert KQL to curl command in bash

How can I run this KQL in the bash command

POST _all/_delete_by_query
{
 "query": {
   "range": {
     "@timestamp": {
       "lte": "now-5d"
      }
    }
  }
}

Thank you in advance!

curl --user name:password -X POST "localhost:9200/my-index-000001/_delete_by_query?conflicts=proceed&pretty" -H 'Content-Type: application/json' -d'
{
  "query": {
   "range": {
     "@timestamp": {
       "lte": "now-5d"
      }
    }
  }
}

Replace with the appropriate authentication and your hostname.

How about in a shell script?

We don't provide official guidance for shell scripting, so this is something for you to play around with.

Hello, this works for me.

curl -XPOST "YourLocalhost:9200/YourIndexName/_delete_by_query" -H 'Content-Type: application/json' -d' { "query": { "range": { "@timestamp": { "lte": "now-5d" } } } }' -u YourElasticUsername:AndPassword

I added my Elastic Username and Password to the last of the command.
Thank you!