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

[elasticsearch] patch mappings that are missing types #12783

Merged
merged 7 commits into from
Jul 12, 2017

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Jul 11, 2017

Because this pr is targetting compatibility with 5.6 I started in 5.x and will forward port it to 6.0

With the transition to using the SavedObjectClient for everything and maintaining compatibility with two index formats the front-end code that creates mapping types was brought into focus. Rather than port it to use the SavedObjectClient, or continuing to use some sort of proxy, this change adds a step to the health check that determines if the kibana index has all of the types defined by the 'mappings' uiExport type.

We will remove the type management from the front-end in another pr.

@spalger spalger added Team:Operations Team label for Operations Team review v5.6.0 v6.0.0 labels Jul 11, 2017
@spalger spalger requested a review from tylersmalley July 11, 2017 23:42
* @property {Function} options.log a method for writing log messages
* @property {string} options.indexName name of the index in elasticsearch
* @property {Function} options.callCluster a function for executing client requests
* @param {Array<Object>} options.types an array of objects with `name` and `mapping` properties
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be @property

@tylersmalley
Copy link
Contributor

Switching between v5 and v6 partial mappings types:

DELETE .kibana
PUT .kibana
{
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
     "_default_": {
      "dynamic": "strict"
    },
    "config": {
      "dynamic": true,
      "properties": {
        "buildNum": {
          "type": "keyword"
        }
      }
    }
  }
}

DELETE .kibana
PUT .kibana
{
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "_default_": {
      "dynamic": "strict"
    },
    "doc": {
      "properties": {
        "type": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "config": {
          "properties": {
            "buildNum": {
              "type": "long"
            }
          }
        }
      }
    }
  }
}
server    log   [00:46:31.756] [info][status][plugin:[email protected]] Status changed from green to yellow - No existing Kibana index found
server    log   [00:46:31.757] [info][status][ui settings] Status changed from green to yellow - Elasticsearch plugin is yellow
server    log   [00:46:31.787] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "index-pattern"
server    log   [00:46:31.796] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "visualization"
server    log   [00:46:31.805] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "search"
server    log   [00:46:31.825] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "dashboard"
server    log   [00:46:31.843] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "url"
server    log   [00:46:31.858] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "server"
server    log   [00:46:31.870] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "timelion-sheet"
server    log   [00:46:32.786] [info][status][plugin:[email protected]] Status changed from yellow to green - Kibana index ready
server    log   [00:46:32.789] [info][status][ui settings] Status changed from yellow to green - Ready
server    log   [00:47:02.850] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "config"
server    log   [00:47:02.858] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "index-pattern"
server    log   [00:47:02.865] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "visualization"
server    log   [00:47:02.877] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "search"
server    log   [00:47:02.885] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "dashboard"
server    log   [00:47:02.897] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "url"
server    log   [00:47:02.906] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "server"
server    log   [00:47:03.032] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "timelion-sheet"

@tylersmalley
Copy link
Contributor

Jenkins, test it

@tylersmalley
Copy link
Contributor

The failure might be legit - re-running as it was a timeout.

https://kibana-ci.elastic.co/job/elastic+kibana+pull-request+multijob-selenium/5950/console

@tylersmalley
Copy link
Contributor

tylersmalley commented Jul 12, 2017

Here is the issue:

log   [01:11:38.399] [info][elasticsearch] Adding mappings to kibana index for SavedObject type "visualization"
log   [01:11:38.425] [error][status][plugin:[email protected]] Status changed from green to red - [illegal_argument_exception] mapper [version] cannot be changed from type [long] to [integer]

@tylersmalley
Copy link
Contributor

Any ideas as to how it's becoming a long?

@epixa
Copy link
Contributor

epixa commented Jul 12, 2017

This is mostly a guess, but I think this issue with long -> integer is the result of our tests seeding the .kibana index before Kibana has been started up, so mappings haven't yet been created. Elasticsearch sees a numeric field and assumes long, and then it errors later when Kibana starts up and tries to set integer as the field type.

@spalger
Copy link
Contributor Author

spalger commented Jul 12, 2017

jenkins, test this

@epixa
Copy link
Contributor

epixa commented Jul 12, 2017

LGTM

@spalger spalger merged commit 929aa8e into elastic:5.x Jul 12, 2017
spalger added a commit to spalger/kibana that referenced this pull request Jul 12, 2017
* [elasticsearch] patch mappings that are missing types

* [elasticsearch/healthCheck] fix tests

* fix doc typo

* [tests/functional/dashboard] fix suite name

* [es/healthCheck/ensureTypesExist] limit randomness a bit

* [test/functional] update es archives with complete mappings

(cherry picked from commit 929aa8e)
@spalger spalger deleted the implement/mapping-patches branch July 13, 2017 00:11
spalger added a commit that referenced this pull request Jul 13, 2017
… (#12817)

* [elasticsearch] patch mappings that are missing types

* [elasticsearch/healthCheck] fix tests

* fix doc typo

* [tests/functional/dashboard] fix suite name

* [es/healthCheck/ensureTypesExist] limit randomness a bit

* [test/functional] update es archives with complete mappings

(cherry picked from commit 929aa8e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants