Command to add a user/password on Elastic search

In order to ass a new user/password on my elasticsearch, I need to execute the following line :
curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -H "Content-Type: application/json" -d '{
"password" : "elasticpassword"
}'

Or I can only do it with PowerShell. Does someone know, how I can executed it.
Thanks
Regards
Vinuja

I moved the question to #x-pack

The user creation process just uses a standard HTTP PUT, so you're free to use any tool you like that can perform HTTP requests.

Our documentation provides examples using curl, but PowerShell is an option as well. Our license management docs have an example of using Invoke-WebRequest to perform a PUT request on an Elasticsearch server - you could adapt that for your needs.

Alternatively, if you install Kibana, it provides 2 other options. Kibana with X-Pack provides a full UI for managing users and roles if that suits you, or the Dev Tools console in Kibana can also be used to send requests directly to Elasticsearch. Many of the examples in the documentation provide an "open in Console" link that will allow you to run that example through your local Kibana instance.

Finally, since you are on Windows, there is also a .NET API available that provides a straight forward programmatic interface to Elasticsearch, including X-Pack features.

1 Like

Thank you very much to your reply.
It works.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.