Skip to content

Commit

Permalink
[Upgrade Assistant] Batch reindex docs (#112960)
Browse files Browse the repository at this point in the history
* [UA] Added batch reindexing docs link to the ES deprecations page. Added a link from "batch reindexing" docs page to "start or resume reindex" docs page and from there to ES reindexing docs page. Also renamed "reindexing operation" to "reindexing task" for consistency.

* [Upgrade Assistant] Added docs build files

* Update x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.tsx

Co-authored-by: James Rodewig <[email protected]>

* Update x-pack/plugins/upgrade_assistant/public/application/components/es_deprecations/es_deprecations.tsx

Co-authored-by: James Rodewig <[email protected]>

* [Upgrade Assistant] Added review suggestions and fixed eslint issues

Co-authored-by: James Rodewig <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
3 people authored Sep 28, 2021
1 parent f911de0 commit a85f7a5
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 21 deletions.
4 changes: 2 additions & 2 deletions docs/api/upgrade-assistant/batch_reindexing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Start or resume multiple reindexing tasks in one request. Additionally, reindexing tasks started or resumed
Start or resume multiple <<start-resume-reindex, reindexing>> tasks in one request. Additionally, reindexing tasks started or resumed
via the batch endpoint will be placed on a queue and executed one-by-one, which ensures that minimal cluster resources
are consumed over time.

Expand Down Expand Up @@ -76,7 +76,7 @@ Similar to the <<start-resume-reindex, start or resume endpoint>>, the API retur
}
--------------------------------------------------

<1> A list of reindex operations created, the order in the array indicates the order in which tasks will be executed.
<1> A list of reindex tasks created, the order in the array indicates the order in which tasks will be executed.
<2> Presence of this key indicates that the reindex job will occur in the batch.
<3> A Unix timestamp of when the reindex task was placed in the queue.
<4> A list of errors that may have occurred preventing the reindex task from being created.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/upgrade-assistant/cancel_reindex.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<titleabbrev>Cancel reindex</titleabbrev>
++++

experimental[] Cancel reindexes that are waiting for the {es} reindex task to complete. For example, `lastCompletedStep` set to `40`.
experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Cancel reindexes that are waiting for the Elasticsearch reindex task to complete. For example, `lastCompletedStep` set to `40`.

Expand Down
8 changes: 5 additions & 3 deletions docs/api/upgrade-assistant/check_reindex_status.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<titleabbrev>Check reindex status</titleabbrev>
++++

experimental[] Check the status of the reindex operation.
experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Check the status of the reindex task.

[[check-reindex-status-request]]
==== Request
Expand Down Expand Up @@ -43,7 +45,7 @@ The API returns the following:
<2> Current status of the reindex. For details, see <<status-code,Status codes>>.
<3> Last successfully completed step of the reindex. For details, see <<step-code,Step codes>> table.
<4> Task ID of the reindex task in Elasticsearch. Only present if reindexing has started.
<5> Percentage of how far the reindexing task in Elasticsearch has progressed, in decimal from from 0 to 1.
<5> Percentage of how far the reindexing task in Elasticsearch has progressed, in decimal form from 0 to 1.
<6> Error that caused the reindex to fail, if it failed.
<7> An array of any warning codes explaining what changes are required for this reindex. For details, see <<warning-code,Warning codes>>.
<8> Specifies if the user has sufficient privileges to reindex this index. When security is unavailable or disables, returns `true`.
Expand Down Expand Up @@ -73,7 +75,7 @@ To resume the reindex, you must submit a new POST request to the `/api/upgrade_a
==== Step codes

`0`::
The reindex operation has been created in Kibana.
The reindex task has been created in Kibana.

`10`::
The index group services stopped. Only applies to some system indices.
Expand Down
17 changes: 13 additions & 4 deletions docs/api/upgrade-assistant/reindexing.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
<titleabbrev>Start or resume reindex</titleabbrev>
++++

experimental[] Start a new reindex or resume a paused reindex.
experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Start a new reindex or resume a paused reindex. Following steps are performed during
a reindex task:

. Setting the index to read-only
. Creating a new index
. {ref}/docs-reindex.html[Reindexing] documents into the new index
. Creating an index alias for the new index
. Deleting the old index


Start a new reindex or resume a paused reindex.

[[start-resume-reindex-request]]
==== Request
Expand Down Expand Up @@ -40,6 +49,6 @@ The API returns the following:
<1> The name of the new index.
<2> The reindex status. For more information, refer to <<status-code,Status codes>>.
<3> The last successfully completed step of the reindex. For more information, refer to <<step-code,Step codes>>.
<4> The task ID of the reindex task in {es}. Appears when the reindexing starts.
<5> The progress of the reindexing task in {es}. Appears in decimal form, from 0 to 1.
<4> The task ID of the {ref}/docs-reindex.html[reindex] task in {es}. Appears when the reindexing starts.
<5> The progress of the {ref}/docs-reindex.html[reindexing] task in {es}. Appears in decimal form, from 0 to 1.
<6> The error that caused the reindex to fail, if it failed.
2 changes: 1 addition & 1 deletion docs/api/upgrade-assistant/status.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<titleabbrev>Upgrade readiness status</titleabbrev>
++++

experimental[] Check the status of your cluster.
experimental["The underlying Upgrade Assistant concepts are stable, but the APIs for managing Upgrade Assistant are experimental."]

Check the status of your cluster.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ readonly links: {
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly upgradeAssistant: {
readonly overview: string;
readonly batchReindex: string;
};
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
Expand Down

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ export class DocLinksService {
},
addData: `${KIBANA_DOCS}connect-to-elasticsearch.html`,
kibana: `${KIBANA_DOCS}index.html`,
upgradeAssistant: `${KIBANA_DOCS}upgrade-assistant.html`,
upgradeAssistant: {
overview: `${KIBANA_DOCS}upgrade-assistant.html`,
batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`,
},
rollupJobs: `${KIBANA_DOCS}data-rollups.html`,
elasticsearch: {
docsBase: `${ELASTICSEARCH_DOCS}`,
Expand Down Expand Up @@ -607,7 +610,10 @@ export interface DocLinksStart {
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly upgradeAssistant: {
readonly overview: string;
readonly batchReindex: string;
};
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
Expand Down
5 changes: 4 additions & 1 deletion src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,10 @@ export interface DocLinksStart {
};
readonly addData: string;
readonly kibana: string;
readonly upgradeAssistant: string;
readonly upgradeAssistant: {
readonly overview: string;
readonly batchReindex: string;
};
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
readonly siem: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import React, { useEffect, useMemo } from 'react';
import { withRouter, RouteComponentProps } from 'react-router-dom';

import { EuiPageHeader, EuiSpacer, EuiPageContent } from '@elastic/eui';
import { EuiPageHeader, EuiSpacer, EuiPageContent, EuiLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { DocLinksStart } from 'kibana/public';
import { METRIC_TYPE } from '@kbn/analytics';

import { EnrichedDeprecationInfo } from '../../../../common/types';
Expand Down Expand Up @@ -44,16 +46,42 @@ const i18nTexts = {
}),
pageDescription: i18n.translate('xpack.upgradeAssistant.esDeprecations.pageDescription', {
defaultMessage:
'You must resolve all critical issues before upgrading. Back up recommended. Make sure you have a current snapshot before modifying your configuration or reindexing.',
'Resolve all critical issues before upgrading. Before making changes, ensure you have a current snapshot of your cluster. Some issues may require reindexing to resolve. ',
}),
isLoading: i18n.translate('xpack.upgradeAssistant.esDeprecations.loadingText', {
defaultMessage: 'Loading deprecation issues…',
}),
};

const getBatchReindexLink = (docLinks: DocLinksStart) => {
return (
<FormattedMessage
id="xpack.upgradeAssistant.esDeprecations.batchReindexingDocsDescription"
defaultMessage="To start multiple reindexing tasks in a single request, use the Kibana {docsLink}."
values={{
docsLink: (
<EuiLink
href={docLinks.links.upgradeAssistant.batchReindex}
target="_blank"
external={true}
>
{i18n.translate('xpack.upgradeAssistant.esDeprecations.batchReindexingDocsLink', {
defaultMessage: 'batch reindexing API',
})}
</EuiLink>
),
}}
/>
);
};

export const EsDeprecations = withRouter(({ history }: RouteComponentProps) => {
const {
services: { api, breadcrumbs },
services: {
api,
breadcrumbs,
core: { docLinks },
},
} = useAppContext();

const { data: esDeprecations, isLoading, error, resendRequest } = api.useLoadEsDeprecations();
Expand Down Expand Up @@ -104,7 +132,15 @@ export const EsDeprecations = withRouter(({ history }: RouteComponentProps) => {

return (
<div data-test-subj="esDeprecationsContent">
<EuiPageHeader pageTitle={i18nTexts.pageTitle} description={i18nTexts.pageDescription}>
<EuiPageHeader
pageTitle={i18nTexts.pageTitle}
description={
<>
{i18nTexts.pageDescription}
{getBatchReindexLink(docLinks)}
</>
}
>
<DeprecationCount
totalCriticalDeprecations={deprecationsCountByLevel.criticalDeprecations}
totalWarningDeprecations={deprecationsCountByLevel.warningDeprecations}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const Overview: FunctionComponent = () => {
})}
rightSideItems={[
<EuiButtonEmpty
href={docLinks.links.upgradeAssistant}
href={docLinks.links.upgradeAssistant.overview}
target="_blank"
iconType="help"
data-test-subj="documentationLink"
Expand Down

0 comments on commit a85f7a5

Please sign in to comment.