# Elasticsearch

**URL:** <https://discuss.elastic.co/t/elasticsearch/329632>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [April 10, 2023, 2:13am UTC](https://discuss.elastic.co/t/elasticsearch/329632 "2023-04-10T02:13:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 2:13am UTC](https://discuss.elastic.co/t/elasticsearch/329632/1 "2023-04-10T02:13:07Z")

</div>

HI I I want to run the container of elasticsearch :  
i use this command  
docker run --name es01 --net elastic -p 9200:9200 -it [docker.elastic.co/elasticsearch/elasticsearch:8.2.3](http://docker.elastic.co/elasticsearch/elasticsearch:8.2.3)  
and this :  
docker cp es01:/usr/share/elasticsearch/config/certs/http\_ca.crt .  
but when i try this command i have an error :  
curl --cacert http\_ca.crt -u elastic [https://localhost:9200](https://localhost:9200)  
the error :  
Invoke-WebRequest : Parameter cannot be processed because the parameter name 'u' is ambiguous. Possible matches include: -UseBasicParsing -Uri -UseDefaultCredentials  
-UserAgent.  
At line:1 char:27

- curl --cacert http\_ca.crt -u elastic [https://localhost:9200](https://localhost:9200)
  - CategoryInfo : InvalidArgument: (🙂 [Invoke-WebRequest], ParameterBindingException
  - FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 10, 2023, 2:26am UTC](https://discuss.elastic.co/t/elasticsearch/329632/2 "2023-04-10T02:26:08Z")

</div>

> [@Fatiha](#):
>
> curl --cacert http\_ca.crt -u elastic [https://localhost:9200](https://localhost:9200)

Where are trying this command?

> [@Fatiha](#):
>
> Invoke-WebRequest : Parameter cannot be processed because the parameter name 'u' is ambiguous. Possible matches include: -UseBasicParsing -Uri -UseDefaultCredentials

Can you provide more context about this? Are you on Windows? This looks like an error from PowerShell.

If I'm not wrong this is not really _curl_, it is an alias in PowerShell to `Invoke-WebRequest`, so your curl command will not work as expected for a Linux system.

Your error does not seem to be related to Elasticsearch, try to open `https://localhost:9200` on a web browser to test the connection.

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 11:55am UTC](https://discuss.elastic.co/t/elasticsearch/329632/3 "2023-04-10T11:55:03Z")

</div>

yes I am in windows 11  
I use this command to verify that I can connect to my Elasticsearch cluster  
when I go to my browser with this url `https://localhost:9200`  
that what I have :  
This page isn’t working

**localhost** didn’t send any data.

ERR\_EMPTY\_RESPONSE

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 11:57am UTC](https://discuss.elastic.co/t/elasticsearch/329632/4 "2023-04-10T11:57:08Z")

</div>

I use powershell

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 12:01pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/5 "2023-04-10T12:01:52Z")

</div>

when i use the command prompt :  
curl --cacert http\_ca.crt -u elastic [https://localhost:9200](https://localhost:9200)  
Enter host password for user 'elastic':  
curl: (60) schannel: CertGetCertificateChain trust error CERT\_TRUST\_REVOCATION\_STATUS\_UNKNOWN  
More details here: [curl - SSL CA Certificates](https://curl.se/docs/sslcerts.html)

curl failed to verify the legitimacy of the server and therefore could not  
establish a secure connection to it. To learn more about this situation and  
how to fix it, please visit the web page mentioned above.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 10, 2023, 12:05pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/6 "2023-04-10T12:05:37Z")

</div>

> [@Fatiha](#):
>
> curl --cacert http\_ca.crt

In the `--cacert` option you need to pass the CA used to create the certificate, not the certificate.

You can try using `-k` to ignore validation.

> [@Fatiha](#):
>
> when I go to my browser with this url `https://localhost:9200`  
> that what I have :  
> This page isn’t working
> 
> **localhost** didn’t send any data.
> 
> ERR\_EMPTY\_RESPONSE

So, this would mean that your Elasticsearch is not running or it is not using https, you need to check the logs in the container and share your `elasticsearch.yml`.

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 12:08pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/7 "2023-04-10T12:08:20Z")

</div>

that what I have when i try -k  
curl -k --cacert http\_ca.crt -u elastic [https://localhost:9200](https://localhost:9200)  
Enter host password for user 'elastic':  
{"error":{"root\_cause":[{"type":"security\_exception","reason":"unable to authenticate user [elastic] for REST request [/]","header":{"WWW-Authenticate":["Basic realm="security" charset="UTF-8"","Bearer realm="security"","ApiKey"]}}],"type":"security\_exception","reason":"unable to authenticate user [elastic] for REST request [/]","header":{"WWW-Authenticate":["Basic realm="security" charset="UTF-8"","Bearer realm="security"","ApiKey"]}},"status":401}

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 12:10pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/8 "2023-04-10T12:10:42Z")

</div>

the elasticsearch.yml

cluster.name: "docker-cluster"  
network.host: 0.0.0.0

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------

# 

# The following settings, TLS certificates, and keys have been automatically

# generated to configure Elasticsearch security features on 10-04-2023 12:03:09

# 

# --------------------------------------------------------------------------------

# Enable security features

xpack.security.enabled: true

xpack.security.enrollment.enabled: true

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents

xpack.security.http.ssl:  
enabled: true  
keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes

xpack.security.transport.ssl:  
enabled: true  
verification\_mode: certificate  
keystore.path: certs/transport.p12  
truststore.path: certs/transport.p12

# Create a new cluster with the current node only

# Additional nodes can still join the cluster later

cluster.initial\_master\_nodes: ["3af68865a2b2"]

#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 10, 2023, 12:10pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/9 "2023-04-10T12:10:54Z")

</div>

> [@Fatiha](#):
>
> status":401

You got an error 401, it is an authentication error, check the username or password, one of them is wrong.

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 12:18pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/10 "2023-04-10T12:18:11Z")

</div>

i copie the password that i have when i run elasticsearch

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 12:23pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/11 "2023-04-10T12:23:58Z")

</div>

i still have the some problem : C:\Windows\System32\>curl -k --cacert http\_ca.crt -u elastic [https://localhost:9200](https://localhost:9200)  
Enter host password for user 'elastic':  
{"error":{"root\_cause":[{"type":"security\_exception","reason":"unable to authenticate user [elastic] for REST request [/]","header":{"WWW-Authenticate":["Basic realm="security" charset="UTF-8"","Bearer realm="security"","ApiKey"]}}],"type":"security\_exception","reason":"unable to authenticate user [elastic] for REST request [/]","header":{"WWW-Authenticate":["Basic realm="security" charset="UTF-8"","Bearer realm="security"","ApiKey"]}},"status":401}

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 10, 2023, 12:28pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/12 "2023-04-10T12:28:06Z")

</div>

The error is still the same, an authentication error, the user or password is wrong.

The password is probably wrong, you can reset it following [these instructions](https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-password.html), you basically will need to run the following command from inside the elasticsearch container:

```auto
/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic

```

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 2:49pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/13 "2023-04-10T14:49:51Z")

</div>

yes i do that but i have the some error  
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic  
WARNING: Owner of file [/usr/share/elasticsearch/config/users] used to be [root], but now is [elasticsearch]  
WARNING: Owner of file [/usr/share/elasticsearch/config/users\_roles] used to be [root], but now is [elasticsearch]  
This tool will reset the password of the [elastic] user to an autogenerated value.  
The password will be printed in the console.  
Please confirm that you would like to continue [y/N]y

Password for the [elastic] user successfully reset.  
New value: gQSM18jqz\*0jgmyMajKF

C:\Windows\System32\>curl --cacert http\_ca.crt -u elastic [https://localhost:9200](https://localhost:9200)  
Enter host password for user 'elastic':  
curl: (60) schannel: CertGetCertificateChain trust error CERT\_TRUST\_REVOCATION\_STATUS\_UNKNOWN  
More details here: [curl - SSL CA Certificates](https://curl.se/docs/sslcerts.html)

curl failed to verify the legitimacy of the server and therefore could not  
establish a secure connection to it. To learn more about this situation and  
how to fix it, please visit the web page mentioned above.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 10, 2023, 2:52pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/14 "2023-04-10T14:52:16Z")

</div>

> [@Fatiha](#):
>
> curl failed to verify the legitimacy of the server and therefore could not  
> establish a secure connection to it. To learn more about this situation and  
> how to fix it, please visit the web page mentioned above.

This was explained before, you need to use the `-k` parameter.

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 3:41pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/15 "2023-04-10T15:41:43Z")

</div>

yes i add -k but nothing to change  
curl -k --cacert http\_ca.crt -u elastic [https://localhost:9200](https://localhost:9200)  
Enter host password for user 'elastic':  
{"error":{"root\_cause":[{"type":"security\_exception","reason":"unable to authenticate user [elastic] for REST request [/]","header":{"WWW-Authenticate":["Basic realm="security" charset="UTF-8"","Bearer realm="security"","ApiKey"]}}],"type":"security\_exception","reason":"unable to authenticate user [elastic] for REST request [/]","header":{"WWW-Authenticate":["Basic realm="security" charset="UTF-8"","Bearer realm="security"","ApiKey"]}},"status":401}

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 10, 2023, 3:49pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/16 "2023-04-10T15:49:08Z")

</div>

It is still the same authentication error, I'm not sure how I could help further, you need to check if the password is really correct.

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 3:55pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/17 "2023-04-10T15:55:42Z")

</div>

I am sure that i copie the correct password

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 10, 2023, 4:00pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/18 "2023-04-10T16:00:30Z")

</div>

> [@Fatiha](#):
>
> I am sure that i copie the correct password

The server is still not accepting it, so it is not the right password.

Try to reset it again but explicitly set a simple password using the parameter `-i` as described in the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/reset-password.html#_examples_8).

---

<div class="post-metadata">

**Author:** ![Fatiha](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@Fatiha](https://discuss.elastic.co/u/Fatiha)\
**Post date:** [April 10, 2023, 4:12pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/19 "2023-04-10T16:12:01Z")

</div>

i do that but i have problem

docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password --username user -i  
This tool will reset the password of the [user] user.  
You will be prompted to enter the password.  
Please confirm that you would like to continue [y/N]y

Enter password for [user]:  
passwords must be at least [6] characters long  
Try again.  
Enter password for [user]:  
Re-enter password for [user]:

ERROR: Failed to reset password for the [user] user

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [April 10, 2023, 4:16pm UTC](https://discuss.elastic.co/t/elasticsearch/329632/20 "2023-04-10T16:16:51Z")

</div>

Your command is wrong, you need to reset the password for the elastic user, not the `user` user.

You need to run this:

```auto
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password --username elastic -i

```

[Next page](https://discuss.elastic.co/t/elasticsearch/329632.md?page=2)
