/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { ChangeEvent, useContext, useEffect, useState } from "react"; import CustomFormRow, { OptionalLabel } from "../../../../components/CustomFormRow"; import { EuiCheckbox, EuiComboBox, EuiComboBoxOptionOption, EuiFieldNumber, EuiLink, EuiRadioGroup, EuiSpacer } from "@elastic/eui"; import { CoreServicesContext } from "../../../../components/core_services"; import { CoreStart } from "opensearch-dashboards/public"; interface ReindexOptionsProps { slices?: string; onSlicesChange: (val?: string) => void; sliceErr?: string; selectedPipelines?: EuiComboBoxOptionOption[]; onSelectedPipelinesChange: (options: EuiComboBoxOptionOption[]) => void; getAllPipelines: () => Promise; ignoreConflicts: boolean; onIgnoreConflictsChange: (val: ChangeEvent) => void; reindexUniqueDocuments: boolean; onReindexUniqueDocumentsChange: (val: ChangeEvent) => void; } const ReindexAdvancedOptions = (props: ReindexOptionsProps) => { let pipelinesInit: EuiComboBoxOptionOption[] = []; const [pipelines, SetPipelines] = useState(pipelinesInit); const coreServices = useContext(CoreServicesContext) as CoreStart; const { slices, sliceErr, onSlicesChange, selectedPipelines, onSelectedPipelinesChange, getAllPipelines, ignoreConflicts, onIgnoreConflictsChange, reindexUniqueDocuments, onReindexUniqueDocumentsChange, } = props; const sliceEnabled = slices !== undefined; const sliceOption = slices === "auto" ? "auto" : "manual"; const showSliceInput = sliceEnabled && sliceOption === "manual"; useEffect(() => { getAllPipelines() .then((pipelines) => { SetPipelines(pipelines); }) .catch((err) => { coreServices.notifications.toasts.addDanger(`fetch pipelines error ${err}`); }); }, [coreServices, getAllPipelines]); return (
You can choose to copy only the documents that do not exist in the destination index. By default, OpenSearch will copy all documents from the source index.{" "} Learn more } > Instead of failing the reindexing operation, ignore any version conflicts during reindexing.{" "} Learn more } > <> { onSlicesChange(e.target.checked ? "auto" : undefined); }} /> {sliceEnabled ? ( <> { onSlicesChange(id === "auto" ? "auto" : ""); }} name="sliceOption" data-test-subj="sliceOption" /> ) : null} {showSliceInput ? ( <> onSlicesChange(e.target.value)} /> ) : null} Transform with ingest pipeline } helpText={ <> Select an ingest pipeline to transform documents before writing data to the destination.{" "} Learn more } >
); }; export default ReindexAdvancedOptions;