# Change path of data file

**URL:** <https://discuss.elastic.co/t/change-path-of-data-file/337633>\
**Category:** Elasticsearch\
**Created:** [July 5, 2023, 7:56am UTC](https://discuss.elastic.co/t/change-path-of-data-file/337633 "2023-07-05T07:56:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hi\_u\_Thu\_n](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hi_u_thu_n/32/123031_2.png) [@Hi\_u\_Thu\_n](https://discuss.elastic.co/u/Hi_u_Thu_n)\
**Post date:** [July 5, 2023, 7:56am UTC](https://discuss.elastic.co/t/change-path-of-data-file/337633/1 "2023-07-05T07:56:45Z")

</div>

I change path in file elasticsearch.yml but it not working!

```auto
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: "C:\\env_thuanhieu\\data\\elasticsearch"
#
# Path to log files:
#
#path.logs: /path/to/logs
#

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/3/d3545cbc39ff91c134a83274c38fe3aaa0283a59.png)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 5, 2023, 8:10am UTC](https://discuss.elastic.co/t/change-path-of-data-file/337633/2 "2023-07-05T08:10:05Z")

</div>

Welcome!

You need to uncomment the line I think. Instead of:

```
#path.data: "C:\\env_thuanhieu\\data\\elasticsearch"

```

Write:

```
path.data: "C:\\env_thuanhieu\\data\\elasticsearch"

```

---

<div class="post-metadata">

**Author:** ![Hi\_u\_Thu\_n](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hi_u_thu_n/32/123031_2.png) [@Hi\_u\_Thu\_n](https://discuss.elastic.co/u/Hi_u_Thu_n)\
**Post date:** [July 5, 2023, 8:37am UTC](https://discuss.elastic.co/t/change-path-of-data-file/337633/3 "2023-07-05T08:37:51Z")

</div>

@dadoonet

**Do i need move old file in data to the new data file**? (

because i have some trouble after that !  
I can't login into elasticsearch, I have error like

```auto
http client did not trust this server's certificate, closing connection Netty4HttpChannel{localAddress=/[0:0:0:0:0:0:0:1]:9200, remoteAddress=/[0:0:0:0:0:0:0:1]:51462}

```

```auto
Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]

```

)

---

<div class="post-metadata">

**Author:** ![Hi\_u\_Thu\_n](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hi_u_thu_n/32/123031_2.png) [@Hi\_u\_Thu\_n](https://discuss.elastic.co/u/Hi_u_Thu_n)\
**Post date:** [July 5, 2023, 8:56am UTC](https://discuss.elastic.co/t/change-path-of-data-file/337633/4 "2023-07-05T08:56:51Z")

</div>

I comment it again then it woking normal!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 5, 2023, 9:39am UTC](https://discuss.elastic.co/t/change-path-of-data-file/337633/5 "2023-07-05T09:39:22Z")

</div>

You did not say that you had existing data.

If you don't, I think you need to restart from scratch. If you did have existing data, Elasticsearch is not going to move that for you so yes I assume you need to do it first.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 2, 2023, 9:39am UTC](https://discuss.elastic.co/t/change-path-of-data-file/337633/6 "2023-08-02T09:39:42Z")

</div>

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