Skip to content

Move index management concerns into the saved object client#19762

Closed
chrisdavies wants to merge 18 commits intoelastic:masterfrom
chrisdavies:migrations/saved_objects
Closed

Move index management concerns into the saved object client#19762
chrisdavies wants to merge 18 commits intoelastic:masterfrom
chrisdavies:migrations/saved_objects

Conversation

@chrisdavies
Copy link
Copy Markdown
Contributor

This is one in a series of several PRs that will go towards resolving #15100.

This introduces the following changes:

  • Allows additive changes to existing mappings
  • Moves getKibanaIndexMappingsDsl and general mapping-building logic into the saved object client system
  • Initializes the Kibana index (patching its mappings and setting the index template) when the saved object client initializes
  • Removes the index patching logic from the elasticsearch health check
  • Removes the constant setting of the index template prior to saved object client writes

Testing this PR

  • Kibana should fail to start, and give a clear error
    • If starting 6.x with a 5.x index
    • If multiple plugins define the same mapping
    • If a mapping type starts with a leading underscore (e.g. _foo)
  • You should now be allowed to add properties to an existing mapping

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@chrisdavies chrisdavies changed the title [WIP] Move index management concerns into the saved object client Move index management concerns into the saved object client Jun 13, 2018
const scopedClientProvider = new ScopedSavedObjectsClientProvider({
index: server.config().get('kibana.index'),
mappings: server.getKibanaIndexMappingsDsl(),
onBeforeWrite,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We're no longer passing the onBeforeWrite to the ScopedSavedObjectsClientProvider constructor so when we set a custom client factory, we'll no longer have access to the onBeforeWrite.

Perhaps a sample usage makes this easier to follow: https://github.com/elastic/kibana/blob/security-app-privs/x-pack/plugins/security/index.js#L120

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm bad with words, so I threw up chrisdavies#1 to illustrate the changes that would make this possible.

@chrisdavies
Copy link
Copy Markdown
Contributor Author

@kobelb Thanks! Merged your PR and master and made some adjustments. Have a look to see if it passes muster.

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@rhoboat
Copy link
Copy Markdown

rhoboat commented Jun 20, 2018

Just dropping a note to say I'm backlogged on reviews, haven't forgotten, hope to get to it this week.

@chrisdavies
Copy link
Copy Markdown
Contributor Author

@archanid I'm canning this one, as we've decided to write migrations in such a way that breaking changes are allowable. So, that changes this PR a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants