Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index Template editor should support mappings types #55645

Closed
cjcenizal opened this issue Jan 23, 2020 · 7 comments
Closed

Index Template editor should support mappings types #55645

cjcenizal opened this issue Jan 23, 2020 · 7 comments
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Index Management Index and index templates UI Feature:Mappings Editor Index mappings editor UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@cjcenizal
Copy link
Contributor

In 7.5, if you create an index template that uses a type in the mappings, you'll get an error. Here's an example of mappings with a type:

 {
    "mytype": {
      "properties": {
        "host_name": {
          "type": "keyword"
        },
        "otherfield": {
          "type":"keyword"
        }
      }
    }
  }

Here's the resulting error:

image

The solution to this is to detect when types are being used and add the include_type_name query parameter to the underlying ES API request. For example:

PUT _template/test2?include_type_name
{
  "index_patterns": [
    "test*"
  ],
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "mytype": {
      "properties": {
        "host_name": {
          "type": "keyword"
        },
        "otherfield": {
          "type":"keyword"
        }
      }
    }
  }
}

Response:

#! Deprecation: [types removal] Specifying include_type_name in put index template requests is deprecated. The parameter will be removed in the next major version.
{
  "acknowledged" : true
}
@cjcenizal cjcenizal added bug Fixes for quality problems that affect the customer experience Feature:Index Management Index and index templates UI Feature:Mappings Editor Index mappings editor UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Jan 23, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@cjcenizal
Copy link
Contributor Author

Note that this change should only target 7.x, since the include_type_name query param has been removed in 8.0.

@cjcenizal
Copy link
Contributor Author

cjcenizal commented Jan 23, 2020

After investigation, I think the bug is more severe than I originally outlined in the issue description. We'll need to fix this with the following:

  1. Load index templates with include_type_name.
  2. If the index template has a custom type or if the user specifies one manually, show a warning callout with a link to the types removal docs. Note that we're just adding the callout above the JSON editor. We're not hiding or removing any functionality.
  3. When the index template is saved, check if there is a custom type defined and set include_type_name if there is a custom type defined.

This will preserve an existing custom type and allow the user to specify a custom type, while notifying the user of the types deprecation.

To help users protect themselves against this in 7.4 and 7.5 we should add a warning banner to the docs for these versions, which outlines the problem and steps to avoid it (https://www.elastic.co/guide/en/kibana/current/managing-indices.html#manage-index-templates).

@cjcenizal
Copy link
Contributor Author

Fixed by #55804

@sebelga
Copy link
Contributor

sebelga commented Jan 30, 2020

@cjcenizal Do you know why Github doesn't close automatically the issue although the PR description says "Fix #xxx" ?

Maybe that line should be the last of the PR description for Github to close the related issue?

@cjcenizal
Copy link
Contributor Author

Not sure, it should still work per the docs.

Maybe that line should be the last of the PR description for Github to close the related issue?

I don't think the position of the line matters based on the above link.

@sebelga
Copy link
Contributor

sebelga commented Jan 31, 2020

It is strange. I realized that since a few weeks we had to manually close the issue behind the PR... I see in the doc that it is Fixes and not Fix. I'll use that word from now on 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Index Management Index and index templates UI Feature:Mappings Editor Index mappings editor UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

No branches or pull requests

3 participants