[Index management] Prepare support Index template V2 format#61588
[Index management] Prepare support Index template V2 format#61588sebelga merged 36 commits intoelastic:masterfrom
Conversation
d805d58 to
ac7efa0
Compare
c2f7104 to
ca0f0ec
Compare
|
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
|
@elasticmachine merge upstream |
There was a problem hiding this comment.
Great start with this @sebelga! Code LGTM. Tested locally and everything worked as expected. I did notice a test that was previously skipped failed on the latest run; there might be some more investigation needed there.
|
|
||
| /** | ||
| * Up until the end of the 8.x release cycle we need to support both | ||
| * V1 and V2 index template formats. This constant keeps track of wether |
There was a problem hiding this comment.
| * V1 and V2 index template formats. This constant keeps track of wether | |
| * V1 and V2 index template formats. This constant keeps track of whether |
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| // TODO: Move mappings type from Mappings editor here |
There was a problem hiding this comment.
Do you plan to address this as part of this PR?
There was a problem hiding this comment.
I didn't plan on touching the mappings editor in this PR. As I plan on adding test coverage to the mappings editor I will do it then.
| const value = isValid && content.trim() !== '' ? JSON.parse(content) : {}; | ||
| const data = { [prop]: value }; | ||
| return Promise.resolve({ isValid, data }); | ||
| // If no key has been added to the JSON object, we strip it out so an empty objecct is not sent in the request |
There was a problem hiding this comment.
| // If no key has been added to the JSON object, we strip it out so an empty objecct is not sent in the request | |
| // If no key has been added to the JSON object, we strip it out so an empty object is not sent in the request |
| import { Location } from 'history'; | ||
|
|
||
| export const getFormatVersionFromQueryparams = (location: Location): 1 | 2 | undefined => { | ||
| const { v } = parse(location.search.substring(1)); |
There was a problem hiding this comment.
nit: this might be more clear as const { v: version } = ...
|
|
||
| // TODO: Flakey test | ||
| describe.skip('form payload', () => { | ||
| describe('form payload', () => { |
There was a problem hiding this comment.
Looks like this failed on the latest run. Might be more work that needs to be done. Related issue: #57288.
|
Thanks for the review @alisonelizabeth! Indeed the flakiness was still there. I added a new helper in the Testbed utils: I will run the CI on this PR a few times to make sure. |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* master: Switch to embeddable factory interface with optional override (elastic#61165) fix text error in diagrams (elastic#62101) [Index management] Prepare support Index template V2 format (elastic#61588) Updates dashboard images (elastic#62011) [Maps] remove MapBounds type (elastic#62332) [Uptime] Convert anomaly Jobs name to lowercase to comply with… (elastic#62293) Make d3 place nicely with object values (elastic#62004) EMT-287: update schema with elastic agent id (elastic#62252) [Maps] fix replaceLayerList to handle case where map is not intialized (elastic#62202) Remove support for deprecated xpack.telemetry configurations (elastic#51142) [Uptime] Remove static constant for index name completely (elastic#62256) [APM] E2E: install dependencies for vanilla workspaces (elastic#62178) [backport] Bump to 5.1.3 (elastic#62286) Show server name in Remote Cluster detail panel (elastic#62250) Rename some alert types (elastic#61693) changing duration type to ms, s, m (elastic#62265) [ML] Clear Kibana index pattern cache on creation or form reset. (elastic#62184) Move `src/legacy/server/index_patterns` to data plugin (server) (Remove step) (elastic#61618) [NP] Remove IndexedArray usage in Schemas (elastic#61410)
|
@sebelga Can you confirm that I understand the changes introduced by this PR correctly?
|
|
@cjcenizal this is correct. Apart from the |
This PR prepares the
index_managementplugin to support the upcoming Index Template V2 (elastic/elasticsearch#53101).Context
In
v7.8Elasticsearch is going to release a new API to read/create/update/delete index templates. Those index templates will have a different format (V2) that the current index template (V1).The main difference being:
There will be 2 different APIs to manage index templates:
PUT _templatefor the V1 format (supported until the end of8.xcycle)PUT _index_templatefor the V2 format (supported from7.8)This means that 2 index templates can have the same name with a different version.
Changes in this PR
This PR is a preparation work to support both formats in the UI. The client code has been refactored to work only with V2 index template format (it expects V2 format to be thrown at it) as it will be the future of index template. A
_kbnMetaobject is added from the server to let the client know the format version of the template.Knowing the format version is important for the client as, when we will fetch or delete an index template, we need to tell our API server route the format version so we can proxy the call to the correct Elasticsearch API.
We will also, in a future PR, enhance the table view to clearly indicate to the user the format of the index template. And probably add a deprecation warning for
v1template and a button to convertV1index templates to theV2format.This PR still creates
V1index templates but our goal for7.8is to createV2index templates by default.How to review
V1formatFixes #57288