# Help updating index for 6.\*

**URL:** <https://discuss.elastic.co/t/help-updating-index-for-6/129800>\
**Category:** Elasticsearch\
**Created:** [April 27, 2018, 9:31am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800 "2018-04-27T09:31:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [April 27, 2018, 9:31am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/1 "2018-04-27T09:31:24Z")

</div>

A silent upgrade from 5.3 to 6.2 has killed Elasticsearch in an application due to the new structure of indices.

The existing (now wrong) format has multiple types, which I'm told by the error messages is not supported. However, [the documentation states that multiple types are supported](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_index_management_operations.html). After umpteen attempts, I have no idea what Elasticsearch wants from the index and time is fast running out.

As I understand it, `_default_` is for the shared fields, while `my_type` is for type-specific fields.

Some advice here would be much appreciated.

---

<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 27, 2018, 9:56am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/2 "2018-04-27T09:56:05Z")

</div>

> A silent upgrade from 5.3 to 6.2

How this can happen? This is so bad.

At least you should have upgraded to latest 5.6 which would have tell you that you are using deprecated APIs.

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [April 27, 2018, 10:02am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/3 "2018-04-27T10:02:58Z")

</div>

Hi @dadoonet, this is the same problem [we've been discussing in another thread](https://discuss.elastic.co/t/as-the-final-mapping-would-have-more-than-1-type/129507/8?u=waynesmallman).

The application must have multiple types, or it won't work.

---

<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 27, 2018, 10:06am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/4 "2018-04-27T10:06:43Z")

</div>

I know. I'm asking how this happened? I mean there are 2 problems here:

- Something upgraded your elasticsearch cluster without following the guides like: [https://www.elastic.co/products/upgrade\_guide](https://www.elastic.co/products/upgrade_guide)

- You need now to fix the problem caused by the previous one.

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [April 27, 2018, 10:08am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/5 "2018-04-27T10:08:36Z")

</div>

Apologies for the length of the code, but I have an example of the settings and mappings for 5.3.

Using: `PUT localhost:9200/asset_en_v1`

```
{
	"settings": {
		"analysis": {
			"char_filter": {
				"&_to_and": {
					"type": "mapping",
					"mappings": ["&=> and "]
				}
			},
			"filter": {
				"asset_en_stopwords": {
					"type": "stop",
					"stopwords": ["_english_"]
				},
				"asset_en_stemmer": {
					"type": "stemmer",
					"name": "english"
				},
				"asset_en_shingle": {
					"type": "shingle",
					"max_shingle_size": 5,
					"min_shingle_size": 2,
					"output_unigrams": false,
					"output_unigrams_if_no_shingles": true
				}
			},
			"analyzer": {
				"asset_en_analyzer": {
					"type": "custom",
					"char_filter": ["html_strip", "&_to_and"],
					"tokenizer": "standard",
					"filter": ["asset_en_stopwords", "asset_en_stemmer", "lowercase", "asset_en_shingle", "asciifolding"]
				}
			}
		}
	},
	"mappings": {
		"note": {
			"_all": {
				"enabled": false
			},
			"properties": {
				"user_id": {
					"type": "long"
				},
				"creation": {
					"type": "date",
					"format": "date_hour_minute_second"
				},
				"deleted": {
					"type": "integer"
				},
				"favourite": {
					"type": "integer"
				},
				"modification": {
					"type": "date",
					"format": "date_hour_minute_second"
				},
				"note": {
					"type": "text",
					"analyzer": "english",
					"fields": {
						"std": {
							"type": "text",
							"analyzer": "asset_en_analyzer",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "standard"
								}
							}
						}
					}
				},
				"title": {
					"type": "text",
					"analyzer": "english",
					"fields": {
						"std": {
							"type": "text",
							"analyzer": "asset_en_analyzer",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "standard"
								}
							}
						}
					}
				},
				"links_to_asset": {
					"type": "nested",
					"properties": {
						"note_link_id": {
							"type": "long"
						},
						"user_id": {
							"type": "long"
						},
						"creation": {
							"type": "date",
							"format": "date_hour_minute_second"
						},
						"modification": {
							"type": "date",
							"format": "date_hour_minute_second"
						},
						"to_asset": {
							"type": "integer"
						},
						"from_asset": {
							"type": "integer"
						},
						"comment": {
							"type": "text",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "asset_en_analyzer",
									"fields": {
										"std": {
											"type": "text",
											"analyzer": "standard"
										}
									}
								}
							}
						}
					}
				}
			}
		},
		"folder": {
			"_all": {
				"enabled": false
			},
			"properties": {
				[DUPLICATE PROPERTIES FOUND IN "NOTE"],
				"in_folder_id": {
					"type": "long"
				},
				"label": {
					"type": "integer"
				}
			}
		},
		"bookmark": {
			"_all": {
				"enabled": false
			},
			"properties": {
				[DUPLICATE PROPERTIES FOUND IN "NOTE"],
				"url": {
					"type": "text",
					"index": "not_analyzed"
				},
				"publication_date": {
					"type": "date",
					"format": "date_hour_minute_second"
				}
			}
		},
		"message": {
			"_all": {
				"enabled": false
			},
			"properties": {
				[DUPLICATE PROPERTIES FOUND IN "NOTE"],
				"from": {
					"type": "text",
					"index": "not_analyzed"
				},
				"seen": {
					"type": "text",
					"index": "not_analyzed"
				}
			}
		}
	}
}
```

---

<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 27, 2018, 10:10am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/6 "2018-04-27T10:10:04Z")

</div>

Did you see this blog post? [https://www.elastic.co/blog/removal-of-mapping-types-elasticsearch](https://www.elastic.co/blog/removal-of-mapping-types-elasticsearch)

It contains a lot of information about moving from multiple types to single type.

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [April 27, 2018, 10:17am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/7 "2018-04-27T10:17:59Z")

</div>

Yes, I have, and I can't get it to work.

Also, if I could get it to work I would end up with multiple `index` types, which would require a massive refactoring of code.

As an example, `PUT localhost:9200/asset_en_v1` creates a single index, which I then create an alias to, using that in the application.

If I use the example in the article, I would have an index per type, which — as I said — would require a massive refactoring of code.

Would I need a separate settings per each `type` that would now have become an `index`? I have no idea, and the documentation offers no guide I'm able to find.

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [April 27, 2018, 10:21am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/8 "2018-04-27T10:21:09Z")

</div>

Here's another example:

```
$document = $this->elasticsearch_model->getIndex([
	'index' => "asset",
	'type' => $this->get_type($note),
	'id' => $note->note_id
]);

```

If I made the `type` the `index`, what would the `type` become in the example above?

I would have to change each instance of that code, and there are thousands.

---

<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 27, 2018, 10:42am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/9 "2018-04-27T10:42:15Z")

</div>

I really think you need to change your code.  
Or you can setup a cluster with 5.6, reindex what you had to fix the short term issue.

Note that if you are not creating new indices in 6.x but just reading 5.x indices, multiple types are supported.  
If you are creating new indices, then you need to change your application I'm afraid.

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [May 5, 2018, 10:00am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/10 "2018-05-05T10:00:36Z")

</div>

Hi @dadoonet...

> Note that if you are not creating new indices in 6.x but just reading 5.x indices, multiple types are supported.

I first noticed there was a problem when I got the error:

`{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"}],"type":"cluster_block_exception","reason":"blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"},"status":403}`

I hadn't made changes to either the application, or to the schema of Elasticsearch. So no, multiple types are not supported, nor anything else in 5.x under 6.x.

I still don't understand the difference between an index and a type if multiple types aren't supported.

Also, more than anything else, I need some guidance on what changes I need to make to the schema, based on the existing example I've shared — I've been working on this for weeks and NOTHING works.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 5, 2018, 10:03am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/11 "2018-05-05T10:03:15Z")

</div>

That error message is often an indication that you are running out of disk space and have exceeded the [high disk usage watermarks](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/disk-allocator.html).

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [May 5, 2018, 10:04am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/12 "2018-05-05T10:04:19Z")

</div>

Hi @Christian_Dahlqvist, I have gigabytes of free space, and the cause wasn't that but the fact that Elasticsearch had upgraded to 6 without me knowing.

---

<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:** [May 5, 2018, 10:05am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/13 "2018-05-05T10:05:18Z")

</div>

The error you are seeing is unrelated to the multiple types per index problem.

> So no, multiple types are not supported, nor anything else in 5.x under 6.x.

Yes they are.

> I still don't understand the difference between an index and a type if multiple types aren't supported.

That's why we are removing the concept of types. Once this will be gone, you won't have to think about it anymore.  
It used to be there from the beginning of Elasticsearch but as explained in the article I linked to, it was not a so good idea at the end of the day.

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [May 5, 2018, 10:05am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/14 "2018-05-05T10:05:44Z")

</div>

Hi @dadoonet, please read the response to @Christian_Dahlqvist.

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [May 5, 2018, 10:07am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/15 "2018-05-05T10:07:38Z")

</div>

> That's why we are removing the concept of types. Once this will be gone, you won't have to think about it anymore.

So I don't have to use the types field?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 5, 2018, 10:07am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/16 "2018-05-05T10:07:40Z")

</div>

How large percentage of the disk is available? The flooding stage is set at 95% of capacity, so if you have large disks you could be exceeding this even if you have gigabytes of space left.

---

<div class="post-metadata">

**Author:** ![waynesmallman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waynesmallman/32/18596_2.png) [@waynesmallman](https://discuss.elastic.co/u/waynesmallman)\
**Post date:** [May 5, 2018, 10:08am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/17 "2018-05-05T10:08:49Z")

</div>

It's above the percentage stated in the documentation.

As I said, Elasticsearch had upgraded itself.

While attempting to migrate from 5.3 to 6.x I've since deleted the schema and the data, so there's no chance of returning to that, as I get errors from 6.x when attempting to add the previous schema.

Is it possible to downgrade?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 5, 2018, 10:11am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/18 "2018-05-05T10:11:06Z")

</div>

Then I believe that most likely is the cause of the error you listed.

---

<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:** [May 5, 2018, 10:13am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/19 "2018-05-05T10:13:20Z")

</div>

You must use the type field in the URL as it's still there. Use \_doc as the type name.

---

<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:** [June 2, 2018, 10:13am UTC](https://discuss.elastic.co/t/help-updating-index-for-6/129800/20 "2018-06-02T10:13:23Z")

</div>

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