# Restoring machine learning config from a snapshot

**URL:** <https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-machine-learning\
**Created:** [February 25, 2019, 2:13pm UTC](https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847 "2019-02-25T14:13:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [February 25, 2019, 2:13pm UTC](https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847/1 "2019-02-25T14:13:59Z")

</div>

I am migrating my on-premise ELK stack to elastic cloud as per [this article](https://www.elastic.co/blog/migrating-to-elastic-cloud)

I use the snapshot method and I did restored all the `.ml*` indices Unfortunately, I cannot retreive my ML job configurations. According to the doc, the config is in `.ml-config` index, which I cannot see when requesting:

```auto
GET /_cat/indices/.ml*

green open .ml-state nlE3yctYSYSHJgcN_SEuKQ 5 1 2943 31 513.5mb 256.7mb
green open .ml-anomalies-shared bpvA1bNnR_iWsKtrocb5dQ 5 1 354785 14 148.1mb 74mb
green open .ml-notifications Flwftz4USw2MZApxzG9rAA 1 1 965 0 412.5kb 195.8kb

```

How can I retreive my ML configuration?

regards

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [February 25, 2019, 8:09pm UTC](https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847/2 "2019-02-25T20:09:49Z")

</div>

The .ml-config indices are new to v6.6. Prior to that, ML job configs were stored in cluster state.

The best option is to export the job and datafeed config's via the API:

```auto
_xpack/ml/anomaly_detectors/${JOB_ID}?pretty
_xpack/ml/datafeeds/datafeed-${JOB_ID}?pretty

```

Then, refactor and "PUT" those configs on the new cluster. From there you'd need to rebuild the models and results on the raw data on the new cluster.

In the future, we'll have a better facility to move everything from one system to another. Moving the job configs out of cluster state to .ml-config was the first step!

---

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [February 26, 2019, 3:37pm UTC](https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847/3 "2019-02-26T15:37:34Z")

</div>

It means that a snapshot is not enough to recover? that is the same for the users and roles, right?

Especially, the [article to migrate to the cloud](https://www.elastic.co/blog/migrating-to-elastic-cloud) is not enough? can you give me the whole process, then?

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [February 26, 2019, 4:14pm UTC](https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847/4 "2019-02-26T16:14:44Z")

</div>

The article referenced above (migrating to cloud) was written in 2016, before ML was released - it therefore does not contain information on how to migrate ML configurations to another system.

Let me re-iterate - if you want to move ML job configurations from one system to another, you need to follow the process I mentioned above - you need to extract all existing configs with the API and you need to PUT those configs on the new cluster. From there you'd need to rebuild the models and results of the ML jobs from the raw data on the new cluster.

---

<div class="post-metadata">

**Author:** ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)\
**Post date:** [February 26, 2019, 4:28pm UTC](https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847/5 "2019-02-26T16:28:13Z")

</div>

OK, that's clear. what about the users and roles?

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [February 26, 2019, 6:56pm UTC](https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847/6 "2019-02-26T18:56:00Z")

</div>

Pretty sure those are stored in the `.security` index - so probably can re-index from remote to move those. But, I'm not an expert in that part of the product. Maybe head on over to [https://discuss.elastic.co/tags/c/elasticsearch/security](https://discuss.elastic.co/tags/c/elasticsearch/security)

---

<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:** [March 26, 2019, 7:06pm UTC](https://discuss.elastic.co/t/restoring-machine-learning-config-from-a-snapshot/169847/7 "2019-03-26T19:06:49Z")

</div>

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