# IOException while reading synonyms\_path\_path: /etc/elasticsearch/C:/elasticsearch-6.2.2/config/synonym.txt

**URL:** <https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629>\
**Category:** Elasticsearch\
**Created:** [April 19, 2018, 5:48am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629 "2018-04-19T05:48:18Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhinaw](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Abhinaw](https://discuss.elastic.co/u/Abhinaw)\
**Post date:** [April 19, 2018, 5:48am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/1 "2018-04-19T05:48:18Z")

</div>

While trying to restore snapshot in Azure VM.  
I am facing this issue .

```
{
  "error": {
    "root_cause": [
      {
        "type": "exception",
        "reason": "Failed to verify index [articleinformation/2Sr5kjDzT7WmBtVl79HF4A]"
      }
    ],
    "type": "exception",
    "reason": "Failed to verify index [articleinformation/2Sr5kjDzT7WmBtVl79HF4A]",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "IOException while reading synonyms_path_path: /etc/elasticsearch/C:/elasticsearch-6.2.2/config/synonym.txt",
      "caused_by": {
        "type": "no_such_file_exception",
        "reason": "/etc/elasticsearch/C:/elasticsearch-6.2.2/config/synonym.txt"
      }
    }
  },
  "status": 500
}
```

---

<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:** [April 19, 2018, 6:17am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/2 "2018-04-19T06:17:33Z")

</div>

Interesting. You probably defined a synonym file in your index settings but snapshot/restore does not backup such a file.

So you need to provide the synonym list manually on all nodes.

cc @Igor_Motov

---

<div class="post-metadata">

**Author:** ![Abhinaw](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Abhinaw](https://discuss.elastic.co/u/Abhinaw)\
**Post date:** [April 19, 2018, 6:50am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/3 "2018-04-19T06:50:09Z")

</div>

Hi ,  
Thanks for help. I have only one node . I pasted my synonym file in

> /etc/elasticsearch$ ls  
> elasticsearch.yml jvm.options log4j2.properties synonym.txt

Now when i try to Open the index it gives same error. I am new to this so you may feel annoying with my stupid questions.

Many Thanks

Also i get no error while restoring ,  
POST /\_snapshot/backupazure/snapshot\_1/\_restore.  
but Shards remains UNASSIGNED.

After this closed index and when i try to reopen i get this error

```
{
  "error": {
    "root_cause": [
      {
        "type": "exception",
        "reason": "Failed to verify index [articleinformation/2Sr5kjDzT7WmBtVl79HF4A]"
      }
    ],
    "type": "exception",
    "reason": "Failed to verify index [articleinformation/2Sr5kjDzT7WmBtVl79HF4A]",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "IOException while reading synonyms_path_path: /etc/elasticsearch/C:/elasticsearch-6.2.2/config/synonym.txt",
      "caused_by": {
        "type": "no_such_file_exception",
        "reason": "/etc/elasticsearch/C:/elasticsearch-6.2.2/config/synonym.txt"
      }
    }
  },
  "status": 500
}

```

---

<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:** [April 19, 2018, 9:47am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/4 "2018-04-19T09:47:58Z")

</div>

Sounds like it was wrongly set in your index settings as `/etc/elasticsearch/C:/elasticsearch-6.2.2/config/synonym.txt`? Or are your trying to restore a old snapshot in a 6.2 cluster?

If so, what was the version you used?

---

<div class="post-metadata">

**Author:** ![Abhinaw](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Abhinaw](https://discuss.elastic.co/u/Abhinaw)\
**Post date:** [April 19, 2018, 10:29am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/5 "2018-04-19T10:29:29Z")

</div>

Hi,

I am trying to restore snapshot created in version 6.2.2 to 6.2.3

My synonyms setting .

```
PUT /articleinformation/_settings
{
    "analysis": {
      "filter": {
        "my_synonym_filter": {
          "type": "synonym",
          "synonyms_path": "synonym.txt"
        }
      },
      "analyzer": {
        "my_synonyms": {
          "tokenizer": "whitespace",
          "filter": [
            "lowercase",
            "my_synonym_filter"
          ]
        }
      }
    }
  }

```

if it is wrong how do i correct it

---

<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:** [April 19, 2018, 1:10pm UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/6 "2018-04-19T13:10:09Z")

</div>

Interesting.

So the synonym path seemed to have been translated from `"synonym.txt"` to `"/etc/elasticsearch/C:/elasticsearch-6.2.2/config/synonym.txt"` which does not make sense to me as it seems that one path is from Linux and the other from Windows.

Are you doing snapshot and restore from/to the same platform?

---

<div class="post-metadata">

**Author:** ![Abhinaw](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Abhinaw](https://discuss.elastic.co/u/Abhinaw)\
**Post date:** [April 19, 2018, 1:11pm UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/7 "2018-04-19T13:11:24Z")

</div>

I am trying to restore snapshot taken from windows to Linux

---

<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:** [April 19, 2018, 1:33pm UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/8 "2018-04-19T13:33:58Z")

</div>

I see. Looks like a bug to me. Could you open an issue, describe this scenario and add a link to this thread?

Cc @jpountz @Igor_Motov I'm case you have any idea.

---

<div class="post-metadata">

**Author:** ![Abhinaw](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Abhinaw](https://discuss.elastic.co/u/Abhinaw)\
**Post date:** [April 19, 2018, 2:22pm UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/9 "2018-04-19T14:22:27Z")

</div>

Hi raised issue .

> <https://github.com/elastic/elasticsearch/issues/29614>

please do comments if you find any thing wrong.

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [April 20, 2018, 9:16am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/10 "2018-04-20T09:16:54Z")

</div>

@Abhinaw On the cluster where you restored the index (and which has the restored shard as unassigned), can you do a `GET /articleinformation/_settings` and paste the output here?

---

<div class="post-metadata">

**Author:** ![Abhinaw](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Abhinaw](https://discuss.elastic.co/u/Abhinaw)\
**Post date:** [April 20, 2018, 10:41am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/11 "2018-04-20T10:41:38Z")

</div>

```
{
  "articleinformation": {
    "settings": {
      "index": {
        "refresh_interval": "300s",
        "number_of_shards": "30",
        "provided_name": "articleinformation",
        "max_result_window": "500000",
        "creation_date": "1523736717057",
        "analysis": {
          "filter": {
            "my_synonym_filter": {
              "type": "synonym",
              "synonyms_path": "synonym.txt"
            },
            "my_synonyms": {
              "type": "synonym",
              "synonyms_path": "synonym.txt"
            },
            "synonym": {
              "type": "synonym",
              "synonyms_path": "C:/elasticsearch-6.2.2/config/synonym.txt"
            }
          },
          "analyzer": {
            "my_synonyms": {
              "filter": [
                "lowercase",
                "my_synonym_filter"
              ],
              "tokenizer": "whitespace"
            },
            "synonym": {
              "filter": [
                "synonym"
              ],
              "tokenizer": "whitespace"
            }
          }
        },
        "number_of_replicas": "1",
        "uuid": "1iOz8JmhS66IA-FPdz0Txw",
        "version": {
          "created": "6020299",
          "upgraded": "6020499"
        }
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [April 20, 2018, 11:09am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/12 "2018-04-20T11:09:21Z")

</div>

Ok, it looks like you configured your synonym path on windows (where you took the snapshot) as an absolute path (not just `synonym.txt`).

Do you still have the Windows cluster around and try to run the same command there?

You can change the path while restoring (see [https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-snapshots.html#\_changing\_index\_settings\_during\_restore](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-snapshots.html#_changing_index_settings_during_restore) ) by setting

```auto
"index_settings": {
    "analysis.filter.my_synonym_filter.synonyms_path": "synonym.txt"
  }

```

on the restore request.

---

<div class="post-metadata">

**Author:** ![Abhinaw](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Abhinaw](https://discuss.elastic.co/u/Abhinaw)\
**Post date:** [April 20, 2018, 11:28am UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/13 "2018-04-20T11:28:55Z")

</div>

I am sorry I do not have it now I started reindexing without synonyms .  
But I remember I have tried this in Linux server and it didn't work there

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [April 20, 2018, 12:18pm UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/14 "2018-04-20T12:18:02Z")

</div>

Is there anything we can still investigate here or can we close this? As we take the index setting for the `synonyms_path` verbatim from the user, I suspect this to be a user error.

---

<div class="post-metadata">

**Author:** ![Abhinaw](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Abhinaw](https://discuss.elastic.co/u/Abhinaw)\
**Post date:** [April 24, 2018, 6:02pm UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/15 "2018-04-24T18:02:51Z")

</div>

Thanks for looking into this, Yes it works fine when synonyms absolute path is given while indexing.  
Still we have an issue, in case user gives exact path in windows and then try to restore in linux server then the snapshot restore doesn't work.

---

<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:** [May 22, 2018, 6:02pm UTC](https://discuss.elastic.co/t/ioexception-while-reading-synonyms-path-path-etc-elasticsearch-c-elasticsearch-6-2-2-config-synonym-txt/128629/16 "2018-05-22T18:02:51Z")

</div>

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