Skip to content

Commit

Permalink
[8.x] [Index Management] Add support for index mode (#197874) (#198481)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Index Management] Add support for index mode
(#197874)](#197874)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-31T09:25:16Z","message":"[Index
Management] Add support for index mode (#197874)\n\nCloses
https://github.com/elastic/kibana/issues/195772\r\n\r\n##
Summary\r\n\r\nThis PR displays the index mode setting in Index
templates (at Review\r\nstep in creation flow and at template details
flyout) and Data streams\r\n(in ds table and ds details
flyout).\r\n\r\n<img width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 39
18\"\r\nsrc=\"https://github.com/user-attachments/assets/9d40c1cd-d08a-4950-a679-29d9910ee845\">\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 19 05
29\"\r\nsrc=\"https://github.com/user-attachments/assets/463e549d-68cd-4ddf-ae0a-cfe43e47af10\">\r\n\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 41
01\"\r\nsrc=\"https://github.com/user-attachments/assets/4ccf8727-5913-4857-9dc2-48c40da3a356\">\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 41
09\"\r\nsrc=\"https://github.com/user-attachments/assets/a6b6a0a9-7ae2-4201-8ff9-3bead915fb2a\">\r\n\r\n###
How to test:\r\n**Creating a Logsdb index template and data
stream:**\r\n1. Go to Index Managament -> Index templates and start
creating a new\r\ntemplate\r\n2. Add a name and an index pattern
`test-logsdb` and then go to the\r\nSettings step\r\n3. Add the setting
`\"index.mode\": \"logsdb`.\r\n4. Go to last step (review) and verify
that the index mode is correctly\r\ndisplayed in Summary. Save the
template.\r\n5. In the template flyout, verify that the index mode
displays the\r\ncorrect label.\r\n6. Go to Console and create a data
stream that mathes the index pattern\r\nof the created index template:
`PUT _data_stream/test-logsdb`\r\n7. Go to Index Management -> Data
streams\r\n8. In the data streams table, verify that the index mode
column is\r\ncorrect for the new data stream.\r\n9. Open the new data
stream and verify that the details flyout displays\r\nthe correct index
mode.\r\n\r\n**Creating a Time series index template and data
stream:**\r\n1. Go to Index Managament -> Index templates and start
creating a new\r\ntemplate\r\n2. Add a name and an index pattern
`test-tsds` and then go to the\r\nSettings step\r\n3. Add the setting
`\"index.mode\": \"time_series`.\r\n4. For time series index template,
we also need to add a mapping with a\r\n`time_series_dimension`
property. Go to the Mappings step, click on\r\n\"Load JSON\" and add the
following mappings object:\r\n```\r\n{\r\n \"properties\": {\r\n \"id\":
{\r\n \"type\": \"keyword\",\r\n \"time_series_dimension\": true\r\n
}\r\n }\r\n}\r\n```\r\n6. Go to last step (review) and verify that the
index mode is correctly\r\ndisplayed in Summary. Save the
template.\r\n7. In the template flyout, verify that the index mode
displays the\r\ncorrect label.\r\n8. Go to Console and create a data
stream that mathes the index pattern\r\nof the created index template:
`PUT _data_stream/test-tsds`\r\n9. Go to Index Management -> Data
streams\r\n10. In the data streams table, verify that the index mode
column is\r\ncorrect for the new data stream.\r\n11. Open the new data
stream and verify that the details flyout displays\r\nthe correct index
mode.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7288\r\n-
[x] Any UI touched in this PR is usable by keyboard only (learn
more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[x] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"40ddfbc044c7f9fed5cc39b57ecc7d0c479ea36d","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Index
Management","Team:Kibana
Management","release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management","v8.17.0"],"title":"[Index
Management] Add support for index
mode","number":197874,"url":"https://github.com/elastic/kibana/pull/197874","mergeCommit":{"message":"[Index
Management] Add support for index mode (#197874)\n\nCloses
https://github.com/elastic/kibana/issues/195772\r\n\r\n##
Summary\r\n\r\nThis PR displays the index mode setting in Index
templates (at Review\r\nstep in creation flow and at template details
flyout) and Data streams\r\n(in ds table and ds details
flyout).\r\n\r\n<img width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 39
18\"\r\nsrc=\"https://github.com/user-attachments/assets/9d40c1cd-d08a-4950-a679-29d9910ee845\">\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 19 05
29\"\r\nsrc=\"https://github.com/user-attachments/assets/463e549d-68cd-4ddf-ae0a-cfe43e47af10\">\r\n\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 41
01\"\r\nsrc=\"https://github.com/user-attachments/assets/4ccf8727-5913-4857-9dc2-48c40da3a356\">\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 41
09\"\r\nsrc=\"https://github.com/user-attachments/assets/a6b6a0a9-7ae2-4201-8ff9-3bead915fb2a\">\r\n\r\n###
How to test:\r\n**Creating a Logsdb index template and data
stream:**\r\n1. Go to Index Managament -> Index templates and start
creating a new\r\ntemplate\r\n2. Add a name and an index pattern
`test-logsdb` and then go to the\r\nSettings step\r\n3. Add the setting
`\"index.mode\": \"logsdb`.\r\n4. Go to last step (review) and verify
that the index mode is correctly\r\ndisplayed in Summary. Save the
template.\r\n5. In the template flyout, verify that the index mode
displays the\r\ncorrect label.\r\n6. Go to Console and create a data
stream that mathes the index pattern\r\nof the created index template:
`PUT _data_stream/test-logsdb`\r\n7. Go to Index Management -> Data
streams\r\n8. In the data streams table, verify that the index mode
column is\r\ncorrect for the new data stream.\r\n9. Open the new data
stream and verify that the details flyout displays\r\nthe correct index
mode.\r\n\r\n**Creating a Time series index template and data
stream:**\r\n1. Go to Index Managament -> Index templates and start
creating a new\r\ntemplate\r\n2. Add a name and an index pattern
`test-tsds` and then go to the\r\nSettings step\r\n3. Add the setting
`\"index.mode\": \"time_series`.\r\n4. For time series index template,
we also need to add a mapping with a\r\n`time_series_dimension`
property. Go to the Mappings step, click on\r\n\"Load JSON\" and add the
following mappings object:\r\n```\r\n{\r\n \"properties\": {\r\n \"id\":
{\r\n \"type\": \"keyword\",\r\n \"time_series_dimension\": true\r\n
}\r\n }\r\n}\r\n```\r\n6. Go to last step (review) and verify that the
index mode is correctly\r\ndisplayed in Summary. Save the
template.\r\n7. In the template flyout, verify that the index mode
displays the\r\ncorrect label.\r\n8. Go to Console and create a data
stream that mathes the index pattern\r\nof the created index template:
`PUT _data_stream/test-tsds`\r\n9. Go to Index Management -> Data
streams\r\n10. In the data streams table, verify that the index mode
column is\r\ncorrect for the new data stream.\r\n11. Open the new data
stream and verify that the details flyout displays\r\nthe correct index
mode.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7288\r\n-
[x] Any UI touched in this PR is usable by keyboard only (learn
more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[x] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"40ddfbc044c7f9fed5cc39b57ecc7d0c479ea36d"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197874","number":197874,"mergeCommit":{"message":"[Index
Management] Add support for index mode (#197874)\n\nCloses
https://github.com/elastic/kibana/issues/195772\r\n\r\n##
Summary\r\n\r\nThis PR displays the index mode setting in Index
templates (at Review\r\nstep in creation flow and at template details
flyout) and Data streams\r\n(in ds table and ds details
flyout).\r\n\r\n<img width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 39
18\"\r\nsrc=\"https://github.com/user-attachments/assets/9d40c1cd-d08a-4950-a679-29d9910ee845\">\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 19 05
29\"\r\nsrc=\"https://github.com/user-attachments/assets/463e549d-68cd-4ddf-ae0a-cfe43e47af10\">\r\n\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 41
01\"\r\nsrc=\"https://github.com/user-attachments/assets/4ccf8727-5913-4857-9dc2-48c40da3a356\">\r\n<img
width=\"1523\" alt=\"Screenshot 2024-10-28 at 14 41
09\"\r\nsrc=\"https://github.com/user-attachments/assets/a6b6a0a9-7ae2-4201-8ff9-3bead915fb2a\">\r\n\r\n###
How to test:\r\n**Creating a Logsdb index template and data
stream:**\r\n1. Go to Index Managament -> Index templates and start
creating a new\r\ntemplate\r\n2. Add a name and an index pattern
`test-logsdb` and then go to the\r\nSettings step\r\n3. Add the setting
`\"index.mode\": \"logsdb`.\r\n4. Go to last step (review) and verify
that the index mode is correctly\r\ndisplayed in Summary. Save the
template.\r\n5. In the template flyout, verify that the index mode
displays the\r\ncorrect label.\r\n6. Go to Console and create a data
stream that mathes the index pattern\r\nof the created index template:
`PUT _data_stream/test-logsdb`\r\n7. Go to Index Management -> Data
streams\r\n8. In the data streams table, verify that the index mode
column is\r\ncorrect for the new data stream.\r\n9. Open the new data
stream and verify that the details flyout displays\r\nthe correct index
mode.\r\n\r\n**Creating a Time series index template and data
stream:**\r\n1. Go to Index Managament -> Index templates and start
creating a new\r\ntemplate\r\n2. Add a name and an index pattern
`test-tsds` and then go to the\r\nSettings step\r\n3. Add the setting
`\"index.mode\": \"time_series`.\r\n4. For time series index template,
we also need to add a mapping with a\r\n`time_series_dimension`
property. Go to the Mappings step, click on\r\n\"Load JSON\" and add the
following mappings object:\r\n```\r\n{\r\n \"properties\": {\r\n \"id\":
{\r\n \"type\": \"keyword\",\r\n \"time_series_dimension\": true\r\n
}\r\n }\r\n}\r\n```\r\n6. Go to last step (review) and verify that the
index mode is correctly\r\ndisplayed in Summary. Save the
template.\r\n7. In the template flyout, verify that the index mode
displays the\r\ncorrect label.\r\n8. Go to Console and create a data
stream that mathes the index pattern\r\nof the created index template:
`PUT _data_stream/test-tsds`\r\n9. Go to Index Management -> Data
streams\r\n10. In the data streams table, verify that the index mode
column is\r\ncorrect for the new data stream.\r\n11. Open the new data
stream and verify that the details flyout displays\r\nthe correct index
mode.\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] Any text added follows
[EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests
changed:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7288\r\n-
[x] Any UI touched in this PR is usable by keyboard only (learn
more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [x] Any UI
touched in this PR does not create any new axe failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))\r\n-
[x] This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))\r\n-
[x] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"40ddfbc044c7f9fed5cc39b57ecc7d0c479ea36d"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elena Stoeva <[email protected]>
  • Loading branch information
kibanamachine and ElenaStoeva authored Oct 31, 2024
1 parent 44df1bb commit 35113f8
Show file tree
Hide file tree
Showing 20 changed files with 246 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export const createDataStreamPayload = (dataStream: Partial<DataStream>): DataSt
enabled: true,
data_retention: '7d',
},
indexMode: 'standard',
...dataStream,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ describe('Data Streams tab', () => {
const { tableCellsValues } = table.getMetaData('dataStreamTable');

expect(tableCellsValues).toEqual([
['', 'dataStream1', 'green', '1', '7 days', 'Delete'],
['', 'dataStream2', 'green', '1', '5 days ', 'Delete'],
['', 'dataStream1', 'green', '1', 'Standard', '7 days', 'Delete'],
['', 'dataStream2', 'green', '1', 'Standard', '5 days ', 'Delete'],
]);
});

Expand Down Expand Up @@ -254,6 +254,7 @@ describe('Data Streams tab', () => {
'December 31st, 1969 7:00:00 PM',
'5b',
'1',
'Standard',
'7 days',
'Delete',
],
Expand All @@ -264,6 +265,7 @@ describe('Data Streams tab', () => {
'December 31st, 1969 7:00:00 PM',
'1kb',
'1',
'Standard',
'5 days ',
'Delete',
],
Expand All @@ -289,6 +291,7 @@ describe('Data Streams tab', () => {
'December 31st, 1969 7:00:00 PM',
'5b',
'1',
'Standard',
'7 days',
'Delete',
],
Expand All @@ -299,6 +302,7 @@ describe('Data Streams tab', () => {
'December 31st, 1969 7:00:00 PM',
'1kb',
'1',
'Standard',
'5 days ',
'Delete',
],
Expand Down Expand Up @@ -346,8 +350,8 @@ describe('Data Streams tab', () => {

const { tableCellsValues } = table.getMetaData('dataStreamTable');
expect(tableCellsValues).toEqual([
['', 'dataStream1', 'green', '156kb', '10000', '1', '7 days', 'Delete'],
['', 'dataStream2', 'green', '156kb', '10000', '1', '5 days ', 'Delete'],
['', 'dataStream1', 'green', '156kb', '10000', '1', 'Standard', '7 days', 'Delete'],
['', 'dataStream2', 'green', '156kb', '10000', '1', 'Standard', '5 days ', 'Delete'],
]);
});

Expand Down Expand Up @@ -378,6 +382,7 @@ describe('Data Streams tab', () => {
'December 31st, 1969 7:00:00 PM',
'5b',
'1',
'Standard',
'7 days',
'Delete',
],
Expand All @@ -388,6 +393,7 @@ describe('Data Streams tab', () => {
'December 31st, 1969 7:00:00 PM',
'1kb',
'1',
'Standard',
'5 days ',
'Delete',
],
Expand Down Expand Up @@ -509,8 +515,8 @@ describe('Data Streams tab', () => {
const { tableCellsValues } = table.getMetaData('dataStreamTable');

expect(tableCellsValues).toEqual([
['', 'dataStream1', 'green', '1', 'Disabled', 'Delete'],
['', 'dataStream2', 'green', '1', '', 'Delete'],
['', 'dataStream1', 'green', '1', 'Standard', 'Disabled', 'Delete'],
['', 'dataStream2', 'green', '1', 'Standard', '', 'Delete'],
]);

await actions.clickNameAt(0);
Expand Down Expand Up @@ -892,8 +898,16 @@ describe('Data Streams tab', () => {
const { tableCellsValues } = table.getMetaData('dataStreamTable');

expect(tableCellsValues).toEqual([
['', `managed-data-stream${nonBreakingSpace}Managed`, 'green', '1', '7 days', 'Delete'],
['', 'non-managed-data-stream', 'green', '1', '7 days', 'Delete'],
[
'',
`managed-data-stream${nonBreakingSpace}Managed`,
'green',
'1',
'Standard',
'7 days',
'Delete',
],
['', 'non-managed-data-stream', 'green', '1', 'Standard', '7 days', 'Delete'],
]);
});

Expand All @@ -902,15 +916,23 @@ describe('Data Streams tab', () => {
let { tableCellsValues } = table.getMetaData('dataStreamTable');

expect(tableCellsValues).toEqual([
['', `managed-data-stream${nonBreakingSpace}Managed`, 'green', '1', '7 days', 'Delete'],
['', 'non-managed-data-stream', 'green', '1', '7 days', 'Delete'],
[
'',
`managed-data-stream${nonBreakingSpace}Managed`,
'green',
'1',
'Standard',
'7 days',
'Delete',
],
['', 'non-managed-data-stream', 'green', '1', 'Standard', '7 days', 'Delete'],
]);

actions.toggleViewFilterAt(0);

({ tableCellsValues } = table.getMetaData('dataStreamTable'));
expect(tableCellsValues).toEqual([
['', 'non-managed-data-stream', 'green', '1', '7 days', 'Delete'],
['', 'non-managed-data-stream', 'green', '1', 'Standard', '7 days', 'Delete'],
]);
});
});
Expand Down Expand Up @@ -942,7 +964,15 @@ describe('Data Streams tab', () => {
const { tableCellsValues } = table.getMetaData('dataStreamTable');

expect(tableCellsValues).toEqual([
['', `hidden-data-stream${nonBreakingSpace}Hidden`, 'green', '1', '7 days', 'Delete'],
[
'',
`hidden-data-stream${nonBreakingSpace}Hidden`,
'green',
'1',
'Standard',
'7 days',
'Delete',
],
]);
});
});
Expand Down Expand Up @@ -989,10 +1019,10 @@ describe('Data Streams tab', () => {
const { tableCellsValues } = table.getMetaData('dataStreamTable');

expect(tableCellsValues).toEqual([
['', 'dataStreamNoDelete', 'green', '1', '7 days', ''],
['', 'dataStreamNoEditRetention', 'green', '1', '7 days', 'Delete'],
['', 'dataStreamNoPermissions', 'green', '1', '7 days', ''],
['', 'dataStreamWithDelete', 'green', '1', '7 days', 'Delete'],
['', 'dataStreamNoDelete', 'green', '1', 'Standard', '7 days', ''],
['', 'dataStreamNoEditRetention', 'green', '1', 'Standard', '7 days', 'Delete'],
['', 'dataStreamNoPermissions', 'green', '1', 'Standard', '7 days', ''],
['', 'dataStreamWithDelete', 'green', '1', 'Standard', '7 days', 'Delete'],
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,16 @@ export function deserializeTemplate(
type = 'managed';
}

const ilmPolicyName = settings?.index?.lifecycle?.name;

const deserializedTemplate: TemplateDeserialized = {
name,
version,
priority,
...(template.lifecycle ? { lifecycle: deserializeESLifecycle(template.lifecycle) } : {}),
indexPatterns: indexPatterns.sort(),
template,
ilmPolicy: settings?.index?.lifecycle,
ilmPolicy: ilmPolicyName ? { name: ilmPolicyName } : undefined,
composedOf: composedOf ?? [],
ignoreMissingComponentTemplates: ignoreMissingComponentTemplates ?? [],
dataStream,
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/index_management/common/types/data_streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export type DataStreamIndexFromEs = IndicesDataStreamIndex;

export type Health = 'green' | 'yellow' | 'red';

export type IndexMode = 'standard' | 'logsdb' | 'time_series';

export interface EnhancedDataStreamFromEs extends IndicesDataStream {
global_max_retention?: string;
store_size?: IndicesDataStreamsStatsDataStreamsStatsItem['store_size'];
Expand All @@ -45,6 +47,7 @@ export interface EnhancedDataStreamFromEs extends IndicesDataStream {
delete_index: boolean;
manage_data_stream_lifecycle: boolean;
};
index_mode?: string | null;
}

export interface DataStream {
Expand All @@ -71,6 +74,7 @@ export interface DataStream {
retention_determined_by?: string;
globalMaxRetention?: string;
};
indexMode: IndexMode;
}

export interface DataStreamIndex {
Expand Down
33 changes: 3 additions & 30 deletions x-pack/plugins/index_management/common/types/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,9 @@
* 2.0.
*/

export type { Index } from '@kbn/index-management-shared-types';
import { IndicesIndexSettingsKeys } from '@elastic/elasticsearch/lib/api/types';

export interface IndexModule {
number_of_shards: number | string;
codec: string;
routing_partition_size: number;
refresh_interval: string;
load_fixed_bitset_filters_eagerly: boolean;
shard: {
check_on_startup: boolean | 'checksum';
};
number_of_replicas: number;
auto_expand_replicas: false | string;
lifecycle: LifecycleModule;
routing: {
allocation: {
enable: 'all' | 'primaries' | 'new_primaries' | 'none';
};
rebalance: {
enable: 'all' | 'primaries' | 'replicas' | 'none';
};
};
}
export type { Index } from '@kbn/index-management-shared-types';

interface AnalysisModule {
analyzer: {
Expand All @@ -41,15 +21,8 @@ interface AnalysisModule {
};
}

interface LifecycleModule {
name: string;
rollover_alias?: string;
parse_origination_date?: boolean;
origination_date?: number;
}

export interface IndexSettings {
index?: Partial<IndexModule>;
index?: IndicesIndexSettingsKeys;
analysis?: AnalysisModule;
[key: string]: any;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
EuiCodeBlock,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { getIndexModeLabel } from '../../../lib/index_mode_labels';
import { allowAutoCreateRadioIds } from '../../../../../common/constants';
import { serializers } from '../../../../shared_imports';

Expand Down Expand Up @@ -268,6 +269,19 @@ export const StepReview: React.FunctionComponent<Props> = React.memo(
{getDescriptionText(serializedSettings)}
</EuiDescriptionListDescription>

{/* Index mode */}
<EuiDescriptionListTitle data-test-subj="indexModeTitle">
<FormattedMessage
id="xpack.idxMgmt.templateForm.stepReview.summaryTab.indexModeLabel"
defaultMessage="Index mode"
/>
</EuiDescriptionListTitle>
<EuiDescriptionListDescription data-test-subj="indexModeValue">
{getIndexModeLabel(
serializedSettings?.['index.mode'] ?? serializedSettings?.index?.mode
)}
</EuiDescriptionListDescription>

{/* Mappings */}
<EuiDescriptionListTitle>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { i18n } from '@kbn/i18n';

export const getIndexModeLabel = (mode?: string | null) => {
switch (mode) {
case 'standard':
case null:
case undefined:
return i18n.translate('xpack.idxMgmt.indexModeLabels.standardModeLabel', {
defaultMessage: 'Standard',
});
case 'logsdb':
return i18n.translate('xpack.idxMgmt.indexModeLabels.logsdbModeLabel', {
defaultMessage: 'LogsDB',
});
case 'time_series':
return i18n.translate('xpack.idxMgmt.indexModeLabels.tsdbModeLabel', {
defaultMessage: 'Time series',
});
default:
return mode;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
EuiSpacer,
} from '@elastic/eui';

import { getIndexModeLabel } from '../../../../lib/index_mode_labels';
import { DiscoverLink } from '../../../../lib/discover_link';
import { getLifecycleValue } from '../../../../lib/data_streams';
import { SectionLoading, reactRouterNavigate } from '../../../../../shared_imports';
Expand Down Expand Up @@ -166,6 +167,7 @@ export const DataStreamDetailPanel: React.FunctionComponent<Props> = ({
meteringStorageSize,
meteringDocsCount,
lifecycle,
indexMode,
} = dataStream;

const getManagementDetails = () => {
Expand Down Expand Up @@ -345,6 +347,17 @@ export const DataStreamDetailPanel: React.FunctionComponent<Props> = ({
),
dataTestSubj: 'indexTemplateDetail',
},
{
name: i18n.translate('xpack.idxMgmt.dataStreamDetailPanel.indexModeTitle', {
defaultMessage: 'Index mode',
}),
toolTip: i18n.translate('xpack.idxMgmt.dataStreamDetailPanel.indexModeToolTip', {
defaultMessage:
"The index mode applied to the data stream's backing indices, as defined in its associated index template.",
}),
content: getIndexModeLabel(indexMode),
dataTestSubj: 'indexModeDetail',
},
{
name: i18n.translate('xpack.idxMgmt.dataStreamDetailPanel.dataRetentionTitle', {
defaultMessage: 'Effective data retention',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { humanizeTimeStamp } from '../humanize_time_stamp';
import { DataStreamsBadges } from '../data_stream_badges';
import { ConditionalWrap } from '../data_stream_detail_panel';
import { isDataStreamFullyManagedByILM } from '../../../../lib/data_streams';
import { getIndexModeLabel } from '../../../../lib/index_mode_labels';
import { FilterListButton, Filters } from '../../components';
import { type DataStreamFilterName } from '../data_stream_list';

Expand Down Expand Up @@ -184,6 +185,16 @@ export const DataStreamTable: React.FunctionComponent<Props> = ({
),
});

columns.push({
field: 'indexMode',
name: i18n.translate('xpack.idxMgmt.dataStreamList.table.indexModeColumnTitle', {
defaultMessage: 'Index mode',
}),
truncateText: true,
sortable: true,
render: (indexMode: DataStream['indexMode']) => getIndexModeLabel(indexMode),
});

columns.push({
field: 'lifecycle',
name: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { EuiTablePagination } from '@elastic/eui';
import { useEuiTablePersist } from '@kbn/shared-ux-table-persist';
import { IndexModule } from '../../../../../../common';
import { Index } from '../../../../../../common';

interface IndexTablePaginationProps {
pager: any;
Expand All @@ -27,7 +27,7 @@ export const IndexTablePagination = ({
readURLParams,
setURLParam,
}: IndexTablePaginationProps) => {
const { pageSize, onTableChange } = useEuiTablePersist<IndexModule>({
const { pageSize, onTableChange } = useEuiTablePersist<Index>({
tableId: 'indices',
initialPageSize: pager.itemsPerPage,
pageSizeOptions: PAGE_SIZE_OPTIONS,
Expand Down
Loading

0 comments on commit 35113f8

Please sign in to comment.