# Upgrading ES from 1.7.1 to 2.x Issue

**URL:** <https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997>\
**Category:** Elasticsearch\
**Created:** [December 1, 2015, 7:57am UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997 "2015-12-01T07:57:30Z")\
**Posts on this page:** 16\
**Page:** 2

<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:** [December 2, 2015, 9:52am UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/22 "2015-12-02T09:52:48Z")

</div>

It seems that some files are missing.

You should have something in:

```
/data/elasticsearch/adviqo-restore/nodes/0/indices/index_31/_state

```

But apparently it's not there.

The only reason we can imagine is that you were using dedicated master nodes. In that case, the `_state` dir does not live within data nodes but in master nodes.  
Can you confirm you are using dedicated master nodes?

---

<div class="post-metadata">

**Author:** ![adviqosupport](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@adviqosupport](https://discuss.elastic.co/u/adviqosupport)\
**Post date:** [December 2, 2015, 10:37am UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/23 "2015-12-02T10:37:56Z")

</div>

Hi,

All nodes where able to become master by config and in every index directory there is a filled \_state directory

> <https://gist.github.com/anonymous/ac7074fd009053450913>

It's like all data is there but corrupt or else.

---

<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:** [December 2, 2015, 10:57am UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/24 "2015-12-02T10:57:07Z")

</div>

Can you list one of the `_state` dir (ls -l)?

---

<div class="post-metadata">

**Author:** ![adviqosupport](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@adviqosupport](https://discuss.elastic.co/u/adviqosupport)\
**Post date:** [December 2, 2015, 3:34pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/25 "2015-12-02T15:34:36Z")

</div>

in every directory exists one state-34.st file (didget differs)

---

<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:** [December 2, 2015, 3:42pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/26 "2015-12-02T15:42:23Z")

</div>

Can you change `gateway: TRACE` in `logging.yml`?  
And check in logs if you have something like `found state file:`

---

<div class="post-metadata">

**Author:** ![adviqosupport](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@adviqosupport](https://discuss.elastic.co/u/adviqosupport)\
**Post date:** [December 7, 2015, 11:11am UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/27 "2015-12-07T11:11:55Z")

</div>

There are some state files found, unfortunately none of my needed indices.

---

<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:** [December 7, 2015, 3:29pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/28 "2015-12-07T15:29:02Z")

</div>

Can you paste here some of those lines?

I'm reading the [source code](https://github.com/elastic/elasticsearch/blob/2.x/core/src/main/java/org/elasticsearch/gateway/MetaDataStateFormat.java#L252-L272) again and I don't understand how this could happen.

```auto
                final Path stateDir = dataLocation.resolve(STATE_DIR_NAME);
                // now, iterate over the current versions, and find latest one
                // we don't check if the stateDir is present since it could be deleted
                // after the check. Also if there is a _state file and it's not a dir something is really wrong
                try (DirectoryStream<Path> paths = Files.newDirectoryStream(stateDir)) { // we don't pass a glob since we need the group part for parsing
                    for (Path stateFile : paths) {
                        final Matcher matcher = stateFilePattern.matcher(stateFile.getFileName().toString());
                        if (matcher.matches()) {
                            final long stateId = Long.parseLong(matcher.group(1));
                            maxStateId = Math.max(maxStateId, stateId);
                            final boolean legacy = MetaDataStateFormat.STATE_FILE_EXTENSION.equals(matcher.group(2)) == false;
                            maxStateIdIsLegacy &= legacy; // on purpose, see NOTE below
                            PathAndStateId pav = new PathAndStateId(stateFile, stateId, legacy);
                            logger.trace("found state file: {}", pav);
                            files.add(pav);
                        }
                    }
                } catch (NoSuchFileException | FileNotFoundException ex) {
                    // no _state directory -- move on
                }

```

stateDir here is `_state`. We check for files like `state-XX.st` which sounds to exist here. So `logger.trace("found state file: {}", pav);` should print it...

Are those files readable by the elasticsearch user which is running the elasticsearch process?

What gives `ls -l /index_53/1/_state` for example? And what gives the same command for an index which is loaded correctly by elasticsearch?

---

<div class="post-metadata">

**Author:** ![adviqosupport](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@adviqosupport](https://discuss.elastic.co/u/adviqosupport)\
**Post date:** [December 7, 2015, 4:02pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/29 "2015-12-07T16:02:12Z")

</div>

an ls -l at

/data/elasticsearch/adviqo-restore/nodes/0/indices/index\_53/0/\_state

prints

-rw-r--r-- 1 elasticsearch elasticsearch 85 30. Nov 13:41 state-29290.st

an working index like .../.marvel-es-2015.12.07/\_state

looks like

-rw-r--r-- 1 elasticsearch elasticsearch 6013 7. Dez 12:07 state-4.st

the difference i find is like in the working ste file is way more (barely readable) information than in the not working indices.

for the working indices it's just says :

found state file: [id:3, legacy:false, file:/data/elasticsearch/adviqo-restore/nodes/0/indices/.marvel-es-2015.12.07/\_state/state-3.st]

other not working indices are not even mentioned, or just like:

][DEBUG][gateway] [Krakkan] [index\_68] failed to find metadata for existing index location

and :

][DEBUG][gateway] [Krakkan] [index\_68] dangling index directory detected, but no state found

---

<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:** [December 7, 2015, 4:39pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/30 "2015-12-07T16:39:03Z")

</div>

`state-29290.st` file seems to be super small indeed.

Also I can see that you first post happened in Dec 1st. The date of this latest `.st` file is `30. Nov 13:41`.  
Any chance you recall what you did before this date?

I think you tried to rollback to 1.7 at this period, right?

---

<div class="post-metadata">

**Author:** ![adviqosupport](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@adviqosupport](https://discuss.elastic.co/u/adviqosupport)\
**Post date:** [December 7, 2015, 5:05pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/31 "2015-12-07T17:05:54Z")

</div>

Yes, as mentioned in the first posts i updated, got some errors referring to the mapping change.  
after witing for a while (one or two hours) and no change happened it shut down everything again and deployed the old ES 1.7.1 and started up again, and finding all data lost.

---

<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:** [December 7, 2015, 5:20pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/32 "2015-12-07T17:20:16Z")

</div>

So here is what I suspect.

When restarting in 1.7, it was impossible to read newer st files. It might have created empty ones.  
That is why we say that you can not downgrade.

I think you are in a bad position here.

I'm not sure if you can do anything than reindexing your data.

---

<div class="post-metadata">

**Author:** ![adviqosupport](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@adviqosupport](https://discuss.elastic.co/u/adviqosupport)\
**Post date:** [December 8, 2015, 7:09am UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/33 "2015-12-08T07:09:52Z")

</div>

Ok now the dummy question,

how do i reindex those data?

---

<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:** [December 8, 2015, 8:51am UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/34 "2015-12-08T08:51:00Z")

</div>

How did you index them the first time?

---

<div class="post-metadata">

**Author:** ![adviqosupport](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@adviqosupport](https://discuss.elastic.co/u/adviqosupport)\
**Post date:** [December 8, 2015, 11:30am UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/35 "2015-12-08T11:30:29Z")

</div>

So basically i can downgrade and integrate the data i just need to reindex everything.

---

<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:** [December 8, 2015, 1:55pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/36 "2015-12-08T13:55:32Z")

</div>

You can reindex all in Es 2.1 as well if I understand you correctly ...

---

<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:** [July 5, 2017, 11:32pm UTC](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997/37 "2017-07-05T23:32:37Z")

</div>

Closed on July 5, 2017, 11:32pm UTC



[Previous page](https://discuss.elastic.co/t/upgrading-es-from-1-7-1-to-2-x-issue/35997.md?page=1)
