cURL commands on Windows

(Sameer Dharur) #1

How exactly does one go about using cURL commands on Windows to manipulate Elasticsearch? What are the prerequisite installations required in order to use them? Could someone please guide me through this process?

(Magnus Bäck) #2

You don't have to use curl. It's just a HTTP client. On Windows I'd use Fiddler, Postman or similar instead.

(Sameer Dharur) #3

Hey, I just discovered the wonderfully convenient Sense extension on the Chrome browser that does this very neatly. It takes cURL commands as the input and converts them to the required JSON files and indexes/searches accordingly.

Any idea how I can index multiple documents into ElasticSearch all at one go using these HTTP clients? That's the one leap I must take to complete my project.

Thanks in advance!

(Magnus Bäck) #4

Yes, Sense is a good choice. Look into the bulk API for indexing multiple documents per request.

(Sameer Dharur) #5

Any idea how I could bulk-index directly from a file containing the logs?

(Magnus Bäck) #6

Use Logstash.

(Joshua Rich) #7

Instead of using curl, if you have Powershell installed, you can use the Invoke-RestMethod cmdlet:

Invoke-RestMethod -Uri '' -Method 'POST' -Body '
  "query": {
    "match_all": { }


Hi I am new on ELK,
Do you how I can do a cmdlet like :
curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -H "Content-Type: application/json" -d '{
"password" : "elasticpassword"

on PowerShell please ?


(Russ Cam) #9

The equivalent in PowerShell would be something like

$username = "elastic"
$currentPassword = "changeme"
$newPassword = "elasticpassword"
$bytes = [Text.Encoding]::UTF8.GetBytes(("{0}:{1}" -f $username, $currentPassword))
$authHeaderValue = [Convert]::ToBase64String($bytes)

$response = Invoke-RestMethod "http://localhost:9200/_xpack/security/user/elastic/_password" -Method Post `
                                -Headers @{Authorization=("Basic {0}" -f $authHeaderValue)} `
                                -Body "{
    `"password`" : `"$newPassword`"


Thanks a lot forloop, it's working now.

(system) #11