# Unable to restore elasticsearch snapshot when using searchGuard

**URL:** <https://discuss.elastic.co/t/unable-to-restore-elasticsearch-snapshot-when-using-searchguard/104116>\
**Category:** Elasticsearch\
**Created:** [October 16, 2017, 4:05pm UTC](https://discuss.elastic.co/t/unable-to-restore-elasticsearch-snapshot-when-using-searchguard/104116 "2017-10-16T16:05:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Milan](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@Milan](https://discuss.elastic.co/u/Milan)\
**Post date:** [October 16, 2017, 4:05pm UTC](https://discuss.elastic.co/t/unable-to-restore-elasticsearch-snapshot-when-using-searchguard/104116/1 "2017-10-16T16:05:28Z")

</div>

Hello,  
I'm having a problem when trying to restore a snapshot.  
Elasticsearch communications are secured using SearchGuard plugin.  
I've successfully been able to snapshot indexes to FS repository (shared samba repo).  
After adding a new role to the sg\_role.yml and binding it to admin user to grant appropriated permissions ( - MANAGE\_SNAPSHOTS, - UNLIMITED...) and re-running the sgadmin I come through the following exception  
{"error":{"root\_cause":[{"type":"repository\_missing\_exception","reason":"[backup] missing"}],  
when trying to restore a snapshot with the command below:  
-XPOST "[https://50.50.1.2:9201/\_snapshot/my\_backup/snapshot\_1/\_restore?wait\_for\_completion=true](https://50.50.1.2:9201/_snapshot/my_backup/snapshot_1/_restore?wait_for_completion=true)" -H 'Content-Type: application/json' -d '{"indices": "testindex", "ignore\_unavailable": true, "include\_global\_state": false}'  
The repo is defined of course since I've been able to create snapshot.  
The same commands work successfully in an elasticsearch environment without using searchguard.  
any idea?

---

<div class="post-metadata">

**Author:** ![nkoothrappahli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nkoothrappahli/32/31959_2.png) [@nkoothrappahli](https://discuss.elastic.co/u/nkoothrappahli)\
**Post date:** [October 21, 2017, 11:07pm UTC](https://discuss.elastic.co/t/unable-to-restore-elasticsearch-snapshot-when-using-searchguard/104116/2 "2017-10-21T23:07:55Z")

</div>

See [http://floragunncom.github.io/search-guard-docs/snapshots.html](http://floragunncom.github.io/search-guard-docs/snapshots.html)

---

<div class="post-metadata">

**Author:** ![Milan](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@Milan](https://discuss.elastic.co/u/Milan)\
**Post date:** [October 23, 2017, 9:54am UTC](https://discuss.elastic.co/t/unable-to-restore-elasticsearch-snapshot-when-using-searchguard/104116/3 "2017-10-23T09:54:17Z")

</div>

Thanks for the reply Nanda,

I've already tried both of the two solutions but none of the two seems to  
work for me.

Sol1- When launching the \_restore command passing the chained cert and the  
private key as parameter i face the error: Unauthorized

Sol2- When affecting appropriated roles (sg\_snapshot\_restore) to the admin  
user I face the error below:

{  
"error" : {  
"root\_cause" : [  
{  
"type" : "repository\_missing\_exception",  
"reason" : "[backup] missing"  
}  
],  
"type" : "repository\_missing\_exception",  
"reason" : "[backup] missing"  
},  
"status" : 404  
}

wheter backup repository exists and contain the following snapshots as  
resulting form the query ( -XGET "  
[https://50.50.1.2:9201/\_snapshot/backup/\_all?pretty](https://50.50.1.2:9201/_snapshot/backup/_all?pretty)")  
{  
"snapshots" : [  
{  
"snapshot" : "snapshot\_1",  
"uuid" : "PK15sA8NRcSudfL87tGf2Q",  
"version\_id" : 5040299,  
"version" : "5.4.2",  
"indices" : [  
"testindex",  
"test"  
],  
"state" : "SUCCESS",  
"start\_time" : "2017-10-12T12:36:55.403Z",  
"start\_time\_in\_millis" : 1507811815403,  
"end\_time" : "2017-10-12T12:36:56.329Z",  
"end\_time\_in\_millis" : 1507811816329,  
"duration\_in\_millis" : 926,  
"failures" : [],  
"shards" : {  
"total" : 10,  
"failed" : 0,  
"successful" : 10  
}  
},  
...  
{  
"snapshot" : "snapshot\_6",  
"uuid" : "WwGOuy2LRIunzSrR3Qo0vQ",  
"version\_id" : 5040299,  
"version" : "5.4.2",  
"indices" : [  
"test"  
],  
"state" : "SUCCESS",  
"start\_time" : "2017-10-13T09:26:47.712Z",  
"start\_time\_in\_millis" : 1507886807712,  
"end\_time" : "2017-10-13T09:26:48.031Z",  
"end\_time\_in\_millis" : 1507886808031,  
"duration\_in\_millis" : 319,  
"failures" : [],  
"shards" : {  
"total" : 5,  
"failed" : 0,  
"successful" : 5  
}  
}  
]  
}

Any idea?

BR,

Milan

---

<div class="post-metadata">

**Author:** ![Milan](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@Milan](https://discuss.elastic.co/u/Milan)\
**Post date:** [October 24, 2017, 9:00am UTC](https://discuss.elastic.co/t/unable-to-restore-elasticsearch-snapshot-when-using-searchguard/104116/4 "2017-10-24T09:00:43Z")

</div>

Thank you Nanda,  
I've been finally able to make it work with Sol1.

I have updated the _elasticsearch.yml_ to include the following.

searchguard.ssl.http.clientauth\_mode: _OPTIONAL_

searchguard.authcz.admin\_dn:

- CN=sgadmin,OU=client,O=client,L=TEST,C=FR  
_- CN=kirk,OU=client,O=client,L=TEST,C=FR_

BR,

Milan

---

<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:** [November 21, 2017, 9:00am UTC](https://discuss.elastic.co/t/unable-to-restore-elasticsearch-snapshot-when-using-searchguard/104116/5 "2017-11-21T09:00:43Z")

</div>

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