From b335c3abbcd776a5d9d6b4e042e2165478cc42ae Mon Sep 17 00:00:00 2001 From: Sander Philipse <94373878+sphilipse@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:33:05 +0200 Subject: [PATCH] [Search] Extract connectors to package (#165590) ## Summary This moves connectors functions to a shared package so Serverless Search and Enterprise Search can both use it. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .github/CODEOWNERS | 1 + .i18nrc.json | 34 ++- config/serverless.es.yml | 7 +- package.json | 1 + packages/kbn-search-connectors/README.md | 3 + .../kbn-search-connectors}/connectors.ts | 53 ++-- packages/kbn-search-connectors/index.ts | 19 ++ packages/kbn-search-connectors/jest.config.js | 13 + packages/kbn-search-connectors/kibana.jsonc | 5 + .../lib/cancel_syncs.test.ts | 34 ++- .../kbn-search-connectors/lib/cancel_syncs.ts | 19 +- .../lib/create_connector.ts | 40 +++ .../lib}/create_connector_document.test.ts | 111 +------- .../lib}/create_connector_document.ts | 45 +--- .../lib}/delete_connector.test.ts | 24 +- .../lib/delete_connector.ts | 21 ++ .../lib/fetch_connector_index_names.ts | 29 ++ .../lib}/fetch_connectors.test.ts | 62 ++--- .../lib}/fetch_connectors.ts | 48 ++-- .../lib}/fetch_sync_jobs.test.ts | 26 +- .../lib}/fetch_sync_jobs.ts | 23 +- packages/kbn-search-connectors/lib/index.ts | 23 ++ .../lib/start_sync.test.ts | 242 +++++++++++++++++ .../kbn-search-connectors/lib/start_sync.ts | 91 +++++++ .../update_connector_configuration.test.ts | 26 +- .../lib}/update_connector_configuration.ts | 26 +- .../update_connector_name_and_description.ts | 21 +- .../lib}/update_connector_scheduling.test.ts | 36 ++- .../lib}/update_connector_scheduling.ts | 21 +- .../lib}/update_connector_service_type.ts | 21 +- .../lib/update_connector_status.ts | 41 +++ .../lib/update_filtering.ts | 18 +- .../lib/update_filtering_draft.ts | 18 +- .../lib/update_native.ts | 28 ++ packages/kbn-search-connectors/package.json | 6 + packages/kbn-search-connectors/tsconfig.json | 23 ++ .../types/connectors.ts | 5 +- packages/kbn-search-connectors/types/index.ts | 12 + .../types}/native_connectors.ts | 248 ++++++++---------- .../types/optimistic_concurrency.ts | 13 + .../kbn-search-connectors/types/pagination.ts | 22 ++ .../utils/fetch_with_pagination.test.ts | 125 +++++++++ .../utils/fetch_with_pagination.ts | 61 +++++ .../utils/identify_exceptions.test.ts | 82 ++++++ .../utils/identify_exceptions.ts | 50 ++++ packages/kbn-search-connectors/utils/index.ts | 9 + .../utils/is_category_entry.ts | 29 ++ .../utils/is_not_nullish.ts | 11 + tsconfig.base.json | 2 + .../common/connectors/is_category_entry.ts | 5 +- .../enterprise_search/common/constants.ts | 3 +- .../enterprise_search/common/types/crawler.ts | 2 +- .../enterprise_search/common/types/indices.ts | 3 +- .../__mocks__/pipeline.mock.ts | 2 +- .../__mocks__/search_indices.mock.ts | 7 +- .../__mocks__/sync_job.mock.ts | 8 +- .../__mocks__/view_index.mock.ts | 6 +- .../connector/fetch_sync_jobs_api_logic.ts | 3 +- .../get_default_pipeline_api_logic.ts | 2 +- ...pdate_connector_configuration_api_logic.ts | 3 +- .../update_connector_filtering_api_logic.ts | 3 +- ...ate_connector_filtering_draft_api_logic.ts | 3 +- ...onnector_name_and_description_api_logic.ts | 3 +- .../update_connector_scheduling_api_logic.ts | 3 +- .../update_default_pipeline_api_logic.ts | 2 +- .../connector/update_pipeline_api_logic.ts | 3 +- .../fetch_index_pipeline_parameters.ts | 3 +- .../components/curl_request/curl_request.tsx | 3 +- .../connector/connector_configuration.tsx | 3 +- .../connector_configuration_field.tsx | 3 +- .../connector_configuration_form_items.tsx | 2 +- .../connector_configuration_logic.test.ts | 2 +- .../connector_configuration_logic.ts | 5 +- .../connector_name_and_description_logic.ts | 3 +- .../connector/connector_scheduling.tsx | 2 +- .../connector_cron_editor.tsx | 3 +- .../connector_scheduling/full_content.tsx | 2 +- .../connector_scheduling_logic.test.ts | 2 +- .../connector/connector_scheduling_logic.ts | 3 +- .../search_index/connector/constants.ts | 2 +- .../native_connector_configuration_config.tsx | 2 +- .../sync_rules/connector_filtering_logic.tsx | 7 +- .../sync_rules/edit_sync_rules_flyout.tsx | 3 +- .../sync_rules/editable_basic_rules_table.tsx | 7 +- .../sync_rules/sync_rules_callouts.tsx | 2 +- .../search_index/connector/types.ts | 2 +- .../automatic_crawl_scheduler_logic.ts | 2 +- ...custom_settings_flyout_crawl_scheduler.tsx | 3 +- ...ustom_settings_flyout_multi_crawl_logic.ts | 3 +- .../crawler_configuration_logic.ts | 3 +- .../search_index/index_view_logic.test.ts | 2 +- .../search_index/index_view_logic.ts | 8 +- .../components/search_index/overview.logic.ts | 3 +- .../default_pipeline_item.tsx | 3 +- .../ingest_pipeline_flyout.tsx | 3 +- .../pipelines/pipeline_settings_form.tsx | 3 +- .../search_index/pipelines/pipelines_logic.ts | 3 +- .../sync_jobs/events_panel.test.tsx | 2 +- .../search_index/sync_jobs/events_panel.tsx | 3 +- .../sync_jobs/filtering_panel.test.tsx | 6 +- .../sync_jobs/filtering_panel.tsx | 2 +- .../search_index/sync_jobs/pipeline_panel.tsx | 2 +- .../sync_jobs/sync_callouts.test.tsx | 2 +- .../search_index/sync_jobs/sync_callouts.tsx | 3 +- .../sync_jobs/sync_jobs_history_table.tsx | 3 +- .../sync_jobs/sync_jobs_view_logic.test.ts | 7 +- .../sync_jobs/sync_jobs_view_logic.ts | 3 +- .../search_indices/indices_logic.test.ts | 3 +- .../search_indices/indices_table.tsx | 2 +- .../components/settings/settings_logic.ts | 3 +- .../filtering_rules_table.tsx | 6 +- .../utils/filtering_rule_helpers.ts | 2 +- .../utils/has_configured_configuration.ts | 3 +- .../utils/indices.test.ts | 3 +- .../utils/indices.ts | 3 +- .../utils/sync_status_to_text.test.ts | 2 +- .../utils/sync_status_to_text.ts | 2 +- .../enterprise_search_cron_editor.tsx | 2 +- .../server/api/connectors_service.ts | 54 ---- .../plugins/enterprise_search/server/index.ts | 6 +- .../lib/connectors/add_connector.test.ts | 234 ++++------------- .../server/lib/connectors/add_connector.ts | 87 +++--- .../server/lib/connectors/delete_connector.ts | 22 -- .../connectors/fetch_connector_index_names.ts | 28 -- .../lib/connectors/put_update_native.ts | 27 -- .../server/lib/connectors/start_sync.test.ts | 52 ++-- .../server/lib/connectors/start_sync.ts | 59 ++--- .../lib/connectors/update_connector_status.ts | 40 --- .../fetch_crawler_multiple_schedules.ts | 3 +- .../server/lib/crawler/fetch_crawlers.ts | 3 +- .../server/lib/crawler/post_connector.test.ts | 3 +- .../server/lib/crawler/post_connector.ts | 7 +- .../lib/crawler/put_html_extraction.test.ts | 3 +- .../server/lib/crawler/put_html_extraction.ts | 3 +- .../server/lib/indices/fetch_index.test.ts | 30 +-- .../server/lib/indices/fetch_index.ts | 13 +- .../lib/indices/generate_api_key.test.ts | 2 +- .../server/lib/indices/generate_api_key.ts | 4 +- .../lib/pipelines/get_default_pipeline.ts | 4 +- .../lib/pipelines/get_index_pipeline.ts | 12 +- .../lib/pipelines/revert_custom_pipeline.ts | 6 +- .../lib/pipelines/update_default_pipeline.ts | 3 +- .../server/lib/pipelines/update_pipeline.ts | 4 +- .../server/lib/stats/get_sync_jobs.ts | 9 +- .../enterprise_search/server/plugin.ts | 33 +-- .../routes/enterprise_search/connectors.ts | 67 +++-- .../enterprise_search/crawler/crawler.ts | 26 +- .../routes/enterprise_search/indices.ts | 20 +- .../server/utils/search_result_provider.ts | 6 +- .../plugins/enterprise_search/tsconfig.json | 3 +- x-pack/plugins/serverless_search/kibana.jsonc | 11 +- .../components/connectors_overview.tsx | 3 +- .../application/components/overview.tsx | 2 +- .../serverless_search/server/plugin.ts | 9 +- .../server/routes/connectors_routes.ts | 15 +- .../plugins/serverless_search/server/types.ts | 2 - .../plugins/serverless_search/tsconfig.json | 2 +- .../translations/translations/fr-FR.json | 205 +++++---------- .../translations/translations/ja-JP.json | 205 +++++---------- .../translations/translations/zh-CN.json | 205 +++++---------- yarn.lock | 4 + 161 files changed, 2016 insertions(+), 1670 deletions(-) create mode 100644 packages/kbn-search-connectors/README.md rename {x-pack/plugins/enterprise_search/common/connectors => packages/kbn-search-connectors}/connectors.ts (70%) create mode 100644 packages/kbn-search-connectors/index.ts create mode 100644 packages/kbn-search-connectors/jest.config.js create mode 100644 packages/kbn-search-connectors/kibana.jsonc rename x-pack/plugins/enterprise_search/server/lib/connectors/post_cancel_syncs.test.ts => packages/kbn-search-connectors/lib/cancel_syncs.test.ts (67%) rename x-pack/plugins/enterprise_search/server/lib/connectors/post_cancel_syncs.ts => packages/kbn-search-connectors/lib/cancel_syncs.ts (76%) create mode 100644 packages/kbn-search-connectors/lib/create_connector.ts rename {x-pack/plugins/enterprise_search/server/utils => packages/kbn-search-connectors/lib}/create_connector_document.test.ts (50%) rename {x-pack/plugins/enterprise_search/server/utils => packages/kbn-search-connectors/lib}/create_connector_document.ts (71%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/delete_connector.test.ts (54%) create mode 100644 packages/kbn-search-connectors/lib/delete_connector.ts create mode 100644 packages/kbn-search-connectors/lib/fetch_connector_index_names.ts rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/fetch_connectors.test.ts (70%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/fetch_connectors.ts (55%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/fetch_sync_jobs.test.ts (82%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/fetch_sync_jobs.ts (71%) create mode 100644 packages/kbn-search-connectors/lib/index.ts create mode 100644 packages/kbn-search-connectors/lib/start_sync.test.ts create mode 100644 packages/kbn-search-connectors/lib/start_sync.ts rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/update_connector_configuration.test.ts (69%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/update_connector_configuration.ts (71%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/update_connector_name_and_description.ts (52%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/update_connector_scheduling.test.ts (76%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/update_connector_scheduling.ts (50%) rename {x-pack/plugins/enterprise_search/server/lib/connectors => packages/kbn-search-connectors/lib}/update_connector_service_type.ts (51%) create mode 100644 packages/kbn-search-connectors/lib/update_connector_status.ts rename x-pack/plugins/enterprise_search/server/lib/connectors/put_update_filtering.ts => packages/kbn-search-connectors/lib/update_filtering.ts (80%) rename x-pack/plugins/enterprise_search/server/lib/connectors/put_update_filtering_draft.ts => packages/kbn-search-connectors/lib/update_filtering_draft.ts (80%) create mode 100644 packages/kbn-search-connectors/lib/update_native.ts create mode 100644 packages/kbn-search-connectors/package.json create mode 100644 packages/kbn-search-connectors/tsconfig.json rename {x-pack/plugins/enterprise_search/common => packages/kbn-search-connectors}/types/connectors.ts (97%) create mode 100644 packages/kbn-search-connectors/types/index.ts rename {x-pack/plugins/enterprise_search/common/connectors => packages/kbn-search-connectors/types}/native_connectors.ts (83%) create mode 100644 packages/kbn-search-connectors/types/optimistic_concurrency.ts create mode 100644 packages/kbn-search-connectors/types/pagination.ts create mode 100644 packages/kbn-search-connectors/utils/fetch_with_pagination.test.ts create mode 100644 packages/kbn-search-connectors/utils/fetch_with_pagination.ts create mode 100644 packages/kbn-search-connectors/utils/identify_exceptions.test.ts create mode 100644 packages/kbn-search-connectors/utils/identify_exceptions.ts create mode 100644 packages/kbn-search-connectors/utils/index.ts create mode 100644 packages/kbn-search-connectors/utils/is_category_entry.ts create mode 100644 packages/kbn-search-connectors/utils/is_not_nullish.ts delete mode 100644 x-pack/plugins/enterprise_search/server/api/connectors_service.ts delete mode 100644 x-pack/plugins/enterprise_search/server/lib/connectors/delete_connector.ts delete mode 100644 x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connector_index_names.ts delete mode 100644 x-pack/plugins/enterprise_search/server/lib/connectors/put_update_native.ts delete mode 100644 x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_status.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cd4fe15e8827c..b88935d43b3c1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -596,6 +596,7 @@ src/plugins/screenshot_mode @elastic/appex-sharedux x-pack/examples/screenshotting_example @elastic/appex-sharedux x-pack/plugins/screenshotting @elastic/kibana-reporting-services packages/kbn-search-api-panels @elastic/enterprise-search-frontend +packages/kbn-search-connectors @elastic/enterprise-search-frontend examples/search_examples @elastic/kibana-data-discovery packages/kbn-search-response-warnings @elastic/kibana-data-discovery x-pack/plugins/searchprofiler @elastic/platform-deployment-management diff --git a/.i18nrc.json b/.i18nrc.json index eb098a7011a15..373f28219a8cb 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -6,12 +6,17 @@ "apmOss": "src/plugins/apm_oss", "autocomplete": "packages/kbn-securitysolution-autocomplete/src", "bfetch": "src/plugins/bfetch", - "cases": ["packages/kbn-cases-components"], + "cases": [ + "packages/kbn-cases-components" + ], "cellActions": "packages/kbn-cell-actions", "charts": "src/plugins/charts", "console": "src/plugins/console", "contentManagement": "packages/content-management", - "core": ["src/core", "packages/core"], + "core": [ + "src/core", + "packages/core" + ], "customIntegrations": "src/plugins/custom_integrations", "dashboard": "src/plugins/dashboard", "domDragDrop": "packages/kbn-dom-drag-drop", @@ -21,7 +26,10 @@ "dataViews": "src/plugins/data_views", "defaultNavigation": "packages/default-nav", "devTools": "src/plugins/dev_tools", - "discover": ["src/plugins/discover", "packages/kbn-discover-utils"], + "discover": [ + "src/plugins/discover", + "packages/kbn-discover-utils" + ], "savedSearch": "src/plugins/saved_search", "embeddableApi": "src/plugins/embeddable", "embeddableExamples": "examples/embeddable_examples", @@ -89,6 +97,7 @@ "savedObjects": "src/plugins/saved_objects", "savedObjectsFinder": "src/plugins/saved_objects_finder", "savedObjectsManagement": "src/plugins/saved_objects_management", + "searchConnectors": "packages/kbn-search-connectors", "server": "src/legacy/server", "share": "src/plugins/share", "sharedUXPackages": "packages/shared-ux", @@ -100,9 +109,17 @@ "languageDocumentationPopover": "packages/kbn-language-documentation-popover/src", "textBasedLanguages": "src/plugins/text_based_languages", "statusPage": "src/legacy/core_plugins/status_page", - "telemetry": ["src/plugins/telemetry", "src/plugins/telemetry_management_section"], - "timelion": ["src/plugins/vis_types/timelion"], - "uiActions": ["src/plugins/ui_actions", "packages/kbn-ui-actions-browser"], + "telemetry": [ + "src/plugins/telemetry", + "src/plugins/telemetry_management_section" + ], + "timelion": [ + "src/plugins/vis_types/timelion" + ], + "uiActions": [ + "src/plugins/ui_actions", + "packages/kbn-ui-actions-browser" + ], "uiActionsEnhanced": "src/plugins/ui_actions_enhanced", "uiActionsExamples": "examples/ui_action_examples", "usageCollection": "src/plugins/usage_collection", @@ -122,7 +139,10 @@ "visTypeXy": "src/plugins/vis_types/xy", "visualizations": "src/plugins/visualizations", "visualizationUiComponents": "packages/kbn-visualization-ui-components", - "unifiedDocViewer": ["src/plugins/unified_doc_viewer", "packages/kbn-unified-doc-viewer"], + "unifiedDocViewer": [ + "src/plugins/unified_doc_viewer", + "packages/kbn-unified-doc-viewer" + ], "unifiedSearch": "src/plugins/unified_search", "unifiedFieldList": "packages/kbn-unified-field-list", "unifiedHistogram": "src/plugins/unified_histogram", diff --git a/config/serverless.es.yml b/config/serverless.es.yml index 7a1da782855bd..fe5575c5fee1e 100644 --- a/config/serverless.es.yml +++ b/config/serverless.es.yml @@ -9,12 +9,7 @@ xpack.observability.enabled: false xpack.securitySolution.enabled: false xpack.serverless.observability.enabled: false xpack.uptime.enabled: false -enterpriseSearch.enabled: true -enterpriseSearch.canDeployEntSearch: false -enterpriseSearch.hasConnectors: true -enterpriseSearch.hasNativeConnectors: false -enterpriseSearch.hasWebCrawler: false -enterpriseSearch.ui.enabled: false +enterpriseSearch.enabled: false monitoring.ui.enabled: false xpack.fleet.enabled: false diff --git a/package.json b/package.json index 80d1b5b6faf59..20507f57e6134 100644 --- a/package.json +++ b/package.json @@ -602,6 +602,7 @@ "@kbn/screenshotting-example-plugin": "link:x-pack/examples/screenshotting_example", "@kbn/screenshotting-plugin": "link:x-pack/plugins/screenshotting", "@kbn/search-api-panels": "link:packages/kbn-search-api-panels", + "@kbn/search-connectors": "link:packages/kbn-search-connectors", "@kbn/search-examples-plugin": "link:examples/search_examples", "@kbn/search-response-warnings": "link:packages/kbn-search-response-warnings", "@kbn/searchprofiler-plugin": "link:x-pack/plugins/searchprofiler", diff --git a/packages/kbn-search-connectors/README.md b/packages/kbn-search-connectors/README.md new file mode 100644 index 0000000000000..5233a782a964f --- /dev/null +++ b/packages/kbn-search-connectors/README.md @@ -0,0 +1,3 @@ +# @kbn/search-connectors + +Empty package generated by @kbn/generate diff --git a/x-pack/plugins/enterprise_search/common/connectors/connectors.ts b/packages/kbn-search-connectors/connectors.ts similarity index 70% rename from x-pack/plugins/enterprise_search/common/connectors/connectors.ts rename to packages/kbn-search-connectors/connectors.ts index 1fc6c6e7f5c77..119de69a0c5c0 100644 --- a/x-pack/plugins/enterprise_search/common/connectors/connectors.ts +++ b/packages/kbn-search-connectors/connectors.ts @@ -1,8 +1,9 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { i18n } from '@kbn/i18n'; @@ -17,13 +18,17 @@ export interface ConnectorServerSideDefinition { serviceType: string; } +/* The consumer should host these icons and transform the iconPath into something usable + * Enterprise Search and Serverless Search do this right now + */ + export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ { iconPath: 'azure_blob_storage.svg', isBeta: true, isNative: true, keywords: ['cloud', 'azure', 'blob', 's3', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.azureBlob.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.azureBlob.name', { defaultMessage: 'Azure Blob Storage', }), serviceType: 'azure_blob_storage', @@ -33,7 +38,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: false, isNative: true, keywords: ['confluence', 'cloud', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.confluence.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.confluence.name', { defaultMessage: 'Confluence Cloud & Server', }), serviceType: 'confluence', @@ -44,7 +49,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isNative: true, isTechPreview: false, keywords: ['dropbox', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.dropbox.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.dropbox.name', { defaultMessage: 'Dropbox', }), serviceType: 'dropbox', @@ -54,7 +59,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: false, isNative: true, keywords: ['jira', 'cloud', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.jira.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.jira.name', { defaultMessage: 'Jira Cloud & Server', }), serviceType: 'jira', @@ -64,7 +69,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: false, keywords: ['github', 'cloud', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.github.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.github.name', { defaultMessage: 'GitHub & GitHub Enterprise Server', }), serviceType: 'github', @@ -74,7 +79,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: false, keywords: ['google', 'cloud', 'blob', 's3', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.googleCloud.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.googleCloud.name', { defaultMessage: 'Google Cloud Storage', }), serviceType: 'google_cloud_storage', @@ -84,7 +89,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: false, keywords: ['google', 'drive', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.googleDrive.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.googleDrive.name', { defaultMessage: 'Google Drive', }), serviceType: 'google_drive', @@ -94,7 +99,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: false, isNative: true, keywords: ['mongo', 'mongodb', 'database', 'nosql', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.mongodb.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.mongodb.name', { defaultMessage: 'MongoDB', }), serviceType: 'mongodb', @@ -104,7 +109,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: false, isNative: true, keywords: ['mysql', 'sql', 'database', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.mysql.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.mysql.name', { defaultMessage: 'MySQL', }), serviceType: 'mysql', @@ -114,7 +119,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: true, keywords: ['mssql', 'microsoft', 'sql', 'database', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.microsoftSQL.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.microsoftSQL.name', { defaultMessage: 'Microsoft SQL', }), serviceType: 'mssql', @@ -124,7 +129,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: false, isNative: true, keywords: ['network', 'drive', 'file', 'directory', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.networkDrive.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.networkDrive.name', { defaultMessage: 'Network drive', }), serviceType: 'network_drive', @@ -134,7 +139,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: true, keywords: ['postgresql', 'sql', 'database', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.postgresql.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.postgresql.name', { defaultMessage: 'PostgreSQL', }), serviceType: 'postgresql', @@ -145,7 +150,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isNative: false, isTechPreview: false, keywords: ['salesforce', 'cloud', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.salesforce.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.salesforce.name', { defaultMessage: 'Salesforce', }), serviceType: 'salesforce', @@ -156,7 +161,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isNative: true, isTechPreview: false, keywords: ['servicenow', 'cloud', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.serviceNow.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.serviceNow.name', { defaultMessage: 'ServiceNow', }), serviceType: 'servicenow', @@ -167,7 +172,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isNative: true, isTechPreview: false, keywords: ['sharepoint', 'office365', 'cloud', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.sharepoint_online.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.sharepoint_online.name', { defaultMessage: 'Sharepoint Online', }), serviceType: 'sharepoint_online', @@ -178,7 +183,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isNative: false, isTechPreview: true, keywords: ['google', 'gmail', 'connector', 'mail'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.gmail.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.gmail.name', { defaultMessage: 'Gmail', }), serviceType: 'gmail', @@ -188,7 +193,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: false, keywords: ['oracle', 'sql', 'database', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.oracle.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.oracle.name', { defaultMessage: 'Oracle', }), serviceType: 'oracle', @@ -198,7 +203,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: false, keywords: ['network', 'drive', 'file', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.oneDrive.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.oneDrive.name', { defaultMessage: 'OneDrive', }), serviceType: 'onedrive', @@ -208,7 +213,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: false, keywords: ['s3', 'cloud', 'amazon', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.s3.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.s3.name', { defaultMessage: 'S3', }), serviceType: 's3', @@ -219,7 +224,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isNative: false, isTechPreview: true, keywords: ['slack', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.slack.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.slack.name', { defaultMessage: 'Slack', }), serviceType: 'slack', @@ -230,7 +235,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isNative: false, isTechPreview: false, keywords: ['sharepoint', 'cloud', 'connector'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.sharepointServer.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.sharepointServer.name', { defaultMessage: 'Sharepoint Server', }), serviceType: 'sharepoint_server', @@ -240,7 +245,7 @@ export const CONNECTOR_DEFINITIONS: ConnectorServerSideDefinition[] = [ isBeta: true, isNative: false, keywords: ['custom', 'connector', 'code'], - name: i18n.translate('xpack.enterpriseSearch.content.nativeConnectors.customConnector.name', { + name: i18n.translate('searchConnectors.content.nativeConnectors.customConnector.name', { defaultMessage: 'Customized connector', }), serviceType: '', diff --git a/packages/kbn-search-connectors/index.ts b/packages/kbn-search-connectors/index.ts new file mode 100644 index 0000000000000..f232081031fb6 --- /dev/null +++ b/packages/kbn-search-connectors/index.ts @@ -0,0 +1,19 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export const CONNECTORS_INDEX = '.elastic-connectors'; +export const CURRENT_CONNECTORS_INDEX = '.elastic-connectors-v1'; +export const CONNECTORS_JOBS_INDEX = '.elastic-connectors-sync-jobs'; +export const CURRENT_CONNECTORS_JOB_INDEX = '.elastic-connectors-sync-jobs-v1'; +export const CONNECTORS_VERSION = 1; +export const CONNECTORS_ACCESS_CONTROL_INDEX_PREFIX = '.search-acl-filter-'; + +export * from './connectors'; +export * from './lib'; +export * from './types'; +export * from './utils'; diff --git a/packages/kbn-search-connectors/jest.config.js b/packages/kbn-search-connectors/jest.config.js new file mode 100644 index 0000000000000..99c132b768bfe --- /dev/null +++ b/packages/kbn-search-connectors/jest.config.js @@ -0,0 +1,13 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-search-connectors'], +}; diff --git a/packages/kbn-search-connectors/kibana.jsonc b/packages/kbn-search-connectors/kibana.jsonc new file mode 100644 index 0000000000000..4c1162ed0300b --- /dev/null +++ b/packages/kbn-search-connectors/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-common", + "id": "@kbn/search-connectors", + "owner": "@elastic/enterprise-search-frontend" +} diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/post_cancel_syncs.test.ts b/packages/kbn-search-connectors/lib/cancel_syncs.test.ts similarity index 67% rename from x-pack/plugins/enterprise_search/server/lib/connectors/post_cancel_syncs.test.ts rename to packages/kbn-search-connectors/lib/cancel_syncs.test.ts index 0c528b6b8290e..05c2f5fcd529d 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/post_cancel_syncs.test.ts +++ b/packages/kbn-search-connectors/lib/cancel_syncs.test.ts @@ -1,24 +1,22 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core/server'; +import { ElasticsearchClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX, CONNECTORS_JOBS_INDEX } from '../..'; -import { SyncStatus } from '../../../common/types/connectors'; +import { CONNECTORS_INDEX, CONNECTORS_JOBS_INDEX } from '..'; +import { SyncStatus } from '../types/connectors'; -import { cancelSyncs } from './post_cancel_syncs'; +import { cancelSyncs } from './cancel_syncs'; -describe('addConnector lib function', () => { +describe('cancelSync lib function', () => { const mockClient = { - asCurrentUser: { - update: jest.fn(), - updateByQuery: jest.fn(), - }, - asInternalUser: {}, + update: jest.fn(), + updateByQuery: jest.fn(), }; beforeEach(() => { @@ -28,13 +26,13 @@ describe('addConnector lib function', () => { }); it('should call updateByQuery to cancel syncs', async () => { - mockClient.asCurrentUser.updateByQuery.mockImplementation(() => ({ _id: 'fakeId' })); + mockClient.updateByQuery.mockImplementation(() => ({ _id: 'fakeId' })); await expect( - cancelSyncs(mockClient as unknown as IScopedClusterClient, 'connectorId') + cancelSyncs(mockClient as unknown as ElasticsearchClient, 'connectorId') ).resolves.toEqual(undefined); - expect(mockClient.asCurrentUser.updateByQuery).toHaveBeenCalledTimes(2); - expect(mockClient.asCurrentUser.updateByQuery).toHaveBeenCalledWith({ + expect(mockClient.updateByQuery).toHaveBeenCalledTimes(2); + expect(mockClient.updateByQuery).toHaveBeenCalledWith({ index: CONNECTORS_JOBS_INDEX, query: { bool: { @@ -60,7 +58,7 @@ ctx._source['canceled_at'] = '${new Date(Date.now()).toISOString()}'; ctx._source['completed_at'] = '${new Date(Date.now()).toISOString()}';`, }, }); - expect(mockClient.asCurrentUser.updateByQuery).toHaveBeenCalledWith({ + expect(mockClient.updateByQuery).toHaveBeenCalledWith({ index: CONNECTORS_JOBS_INDEX, query: { bool: { @@ -84,7 +82,7 @@ ctx._source['completed_at'] = '${new Date(Date.now()).toISOString()}';`, ctx._source['cancelation_requested_at'] = '${new Date(Date.now()).toISOString()}';`, }, }); - await expect(mockClient.asCurrentUser.update).toHaveBeenCalledWith({ + await expect(mockClient.update).toHaveBeenCalledWith({ doc: { last_sync_status: SyncStatus.CANCELED, sync_now: false }, id: 'connectorId', index: CONNECTORS_INDEX, diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/post_cancel_syncs.ts b/packages/kbn-search-connectors/lib/cancel_syncs.ts similarity index 76% rename from x-pack/plugins/enterprise_search/server/lib/connectors/post_cancel_syncs.ts rename to packages/kbn-search-connectors/lib/cancel_syncs.ts index ef5327d4db374..2a331e19d4cb7 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/post_cancel_syncs.ts +++ b/packages/kbn-search-connectors/lib/cancel_syncs.ts @@ -1,20 +1,21 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; +import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; -import { CONNECTORS_INDEX, CONNECTORS_JOBS_INDEX } from '../..'; -import { SyncStatus } from '../../../common/types/connectors'; +import { CONNECTORS_INDEX, CONNECTORS_JOBS_INDEX } from '..'; +import { SyncStatus } from '../types/connectors'; export const cancelSyncs = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string ): Promise => { - await client.asCurrentUser.updateByQuery({ + await client.updateByQuery({ index: CONNECTORS_JOBS_INDEX, query: { bool: { @@ -40,7 +41,7 @@ ctx._source['canceled_at'] = '${new Date(Date.now()).toISOString()}'; ctx._source['completed_at'] = '${new Date(Date.now()).toISOString()}';`, }, }); - await client.asCurrentUser.updateByQuery({ + await client.updateByQuery({ index: CONNECTORS_JOBS_INDEX, query: { bool: { @@ -64,7 +65,7 @@ ctx._source['completed_at'] = '${new Date(Date.now()).toISOString()}';`, ctx._source['cancelation_requested_at'] = '${new Date(Date.now()).toISOString()}';`, }, }); - await client.asCurrentUser.update({ + await client.update({ doc: { last_sync_status: SyncStatus.CANCELED, sync_now: false }, id: connectorId, index: CONNECTORS_INDEX, diff --git a/packages/kbn-search-connectors/lib/create_connector.ts b/packages/kbn-search-connectors/lib/create_connector.ts new file mode 100644 index 0000000000000..d4ff1230727c8 --- /dev/null +++ b/packages/kbn-search-connectors/lib/create_connector.ts @@ -0,0 +1,40 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ElasticsearchClient } from '@kbn/core/server'; +import { CURRENT_CONNECTORS_INDEX } from '..'; + +import { Connector, ConnectorConfiguration, IngestPipelineParams } from '../types/connectors'; +import { createConnectorDocument } from './create_connector_document'; + +export const createConnector = async ( + client: ElasticsearchClient, + input: { + configuration?: ConnectorConfiguration; + features?: Connector['features']; + indexName: string | null; + isNative: boolean; + language: string | null; + name?: string; + pipeline: IngestPipelineParams; + serviceType?: string | null; + } +): Promise => { + const document = createConnectorDocument({ + ...input, + serviceType: input.serviceType || null, + }); + + const result = await client.index({ + document, + index: CURRENT_CONNECTORS_INDEX, + refresh: 'wait_for', + }); + + return { ...document, id: result._id }; +}; diff --git a/x-pack/plugins/enterprise_search/server/utils/create_connector_document.test.ts b/packages/kbn-search-connectors/lib/create_connector_document.test.ts similarity index 50% rename from x-pack/plugins/enterprise_search/server/utils/create_connector_document.test.ts rename to packages/kbn-search-connectors/lib/create_connector_document.test.ts index 458d223ce24b4..aa1c54c3c90ea 100644 --- a/x-pack/plugins/enterprise_search/server/utils/create_connector_document.test.ts +++ b/packages/kbn-search-connectors/lib/create_connector_document.test.ts @@ -1,11 +1,12 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { ConnectorStatus } from '../../common/types/connectors'; +import { ConnectorStatus } from '../types/connectors'; import { createConnectorDocument } from './create_connector_document'; @@ -16,6 +17,7 @@ describe('createConnectorDocument', () => { indexName: 'indexName', isNative: false, language: 'fr', + name: 'indexName-name', pipeline: { extract_binary_content: true, name: 'ent-search-generic-ingestion', @@ -94,108 +96,7 @@ describe('createConnectorDocument', () => { last_sync_scheduled_at: null, last_sync_status: null, last_synced: null, - name: 'indexName', - pipeline: { - extract_binary_content: true, - name: 'ent-search-generic-ingestion', - reduce_whitespace: true, - run_ml_inference: false, - }, - scheduling: { - access_control: { enabled: false, interval: '0 0 0 * * ?' }, - full: { enabled: false, interval: '0 0 0 * * ?' }, - incremental: { enabled: false, interval: '0 0 0 * * ?' }, - }, - service_type: null, - status: ConnectorStatus.CREATED, - sync_now: false, - }); - }); - it('should remove search- from name', () => { - expect( - createConnectorDocument({ - indexName: 'search-indexName', - isNative: false, - language: 'fr', - pipeline: { - extract_binary_content: true, - name: 'ent-search-generic-ingestion', - reduce_whitespace: true, - run_ml_inference: false, - }, - serviceType: null, - }) - ).toEqual({ - api_key_id: null, - configuration: {}, - custom_scheduling: {}, - description: null, - error: null, - features: null, - filtering: [ - { - active: { - advanced_snippet: { - created_at: expect.any(String), - updated_at: expect.any(String), - value: {}, - }, - rules: [ - { - created_at: expect.any(String), - field: '_', - id: 'DEFAULT', - order: 0, - policy: 'include', - rule: 'regex', - updated_at: expect.any(String), - value: '.*', - }, - ], - validation: { - errors: [], - state: 'valid', - }, - }, - domain: 'DEFAULT', - draft: { - advanced_snippet: { - created_at: expect.any(String), - updated_at: expect.any(String), - value: {}, - }, - rules: [ - { - created_at: expect.any(String), - field: '_', - id: 'DEFAULT', - order: 0, - policy: 'include', - rule: 'regex', - updated_at: expect.any(String), - value: '.*', - }, - ], - validation: { - errors: [], - state: 'valid', - }, - }, - }, - ], - index_name: 'search-indexName', - is_native: false, - language: 'fr', - last_access_control_sync_error: null, - last_access_control_sync_scheduled_at: null, - last_access_control_sync_status: null, - last_incremental_sync_scheduled_at: null, - last_seen: null, - last_sync_error: null, - last_sync_scheduled_at: null, - last_sync_status: null, - last_synced: null, - name: 'indexName', + name: 'indexName-name', pipeline: { extract_binary_content: true, name: 'ent-search-generic-ingestion', diff --git a/x-pack/plugins/enterprise_search/server/utils/create_connector_document.ts b/packages/kbn-search-connectors/lib/create_connector_document.ts similarity index 71% rename from x-pack/plugins/enterprise_search/server/utils/create_connector_document.ts rename to packages/kbn-search-connectors/lib/create_connector_document.ts index 8b3883eac5be9..c5654e9a2436a 100644 --- a/x-pack/plugins/enterprise_search/server/utils/create_connector_document.ts +++ b/packages/kbn-search-connectors/lib/create_connector_document.ts @@ -1,24 +1,25 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { NATIVE_CONNECTOR_DEFINITIONS } from '../../common/connectors/native_connectors'; -import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../common/constants'; - import { + Connector, + ConnectorConfiguration, ConnectorDocument, ConnectorStatus, FilteringPolicy, FilteringRuleRule, FilteringValidationState, IngestPipelineParams, -} from '../../common/types/connectors'; -import { stripSearchPrefix } from '../../common/utils/strip_search_prefix'; +} from '../types/connectors'; export function createConnectorDocument({ + configuration, + features, indexName, isNative, name, @@ -26,6 +27,8 @@ export function createConnectorDocument({ serviceType, language, }: { + configuration?: ConnectorConfiguration; + features?: Connector['features']; indexName: string | null; isNative: boolean; language: string | null; @@ -34,35 +37,14 @@ export function createConnectorDocument({ serviceType: string | null; }): ConnectorDocument { const currentTimestamp = new Date().toISOString(); - const nativeConnector = - isNative && serviceType ? NATIVE_CONNECTOR_DEFINITIONS[serviceType] : undefined; - - if ( - isNative && - serviceType && - !nativeConnector && - serviceType !== ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE - ) { - throw new Error(`Could not find connector definition for service type ${serviceType}`); - } - - const nativeFields = nativeConnector - ? { - configuration: nativeConnector.configuration, - features: nativeConnector.features, - name: nativeConnector.name, - service_type: serviceType, - status: ConnectorStatus.NEEDS_CONFIGURATION, - } - : {}; return { api_key_id: null, - configuration: {}, + configuration: configuration || {}, custom_scheduling: {}, description: null, error: null, - features: null, + features: features || null, filtering: [ { active: { @@ -126,7 +108,7 @@ export function createConnectorDocument({ last_sync_scheduled_at: null, last_sync_status: null, last_synced: null, - name: name || stripSearchPrefix(indexName ?? ''), + name: name ?? '', pipeline, scheduling: { access_control: { enabled: false, interval: '0 0 0 * * ?' }, @@ -136,6 +118,5 @@ export function createConnectorDocument({ service_type: serviceType || null, status: ConnectorStatus.CREATED, sync_now: false, - ...nativeFields, }; } diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/delete_connector.test.ts b/packages/kbn-search-connectors/lib/delete_connector.test.ts similarity index 54% rename from x-pack/plugins/enterprise_search/server/lib/connectors/delete_connector.test.ts rename to packages/kbn-search-connectors/lib/delete_connector.test.ts index 0ce9e53632835..55dfdcbeae92b 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/delete_connector.test.ts +++ b/packages/kbn-search-connectors/lib/delete_connector.test.ts @@ -1,27 +1,25 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core/server'; +import { ElasticsearchClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '..'; import { deleteConnectorById } from './delete_connector'; -jest.mock('./post_cancel_syncs', () => ({ +jest.mock('./cancel_syncs', () => ({ cancelSyncs: jest.fn(), })); -import { cancelSyncs } from './post_cancel_syncs'; +import { cancelSyncs } from './cancel_syncs'; describe('deleteConnector lib function', () => { const mockClient = { - asCurrentUser: { - delete: jest.fn(), - }, - asInternalUser: {}, + delete: jest.fn(), }; beforeEach(() => { @@ -30,11 +28,11 @@ describe('deleteConnector lib function', () => { }); it('should delete connector and cancel syncs', async () => { - mockClient.asCurrentUser.delete.mockImplementation(() => true); + mockClient.delete.mockImplementation(() => true); - await deleteConnectorById(mockClient as unknown as IScopedClusterClient, 'connectorId'); + await deleteConnectorById(mockClient as unknown as ElasticsearchClient, 'connectorId'); expect(cancelSyncs as jest.Mock).toHaveBeenCalledWith(mockClient, 'connectorId'); - expect(mockClient.asCurrentUser.delete).toHaveBeenCalledWith({ + expect(mockClient.delete).toHaveBeenCalledWith({ id: 'connectorId', index: CONNECTORS_INDEX, refresh: 'wait_for', diff --git a/packages/kbn-search-connectors/lib/delete_connector.ts b/packages/kbn-search-connectors/lib/delete_connector.ts new file mode 100644 index 0000000000000..c64edfd3d906a --- /dev/null +++ b/packages/kbn-search-connectors/lib/delete_connector.ts @@ -0,0 +1,21 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; +import { CONNECTORS_INDEX } from '..'; +import { cancelSyncs } from './cancel_syncs'; + +export const deleteConnectorById = async (client: ElasticsearchClient, id: string) => { + // timeout function to mitigate race condition with external connector running job and recreating index + const timeout = async () => { + const promise = new Promise((resolve) => setTimeout(resolve, 500)); + return promise; + }; + await Promise.all([cancelSyncs(client, id), timeout]); + return await client.delete({ id, index: CONNECTORS_INDEX, refresh: 'wait_for' }); +}; diff --git a/packages/kbn-search-connectors/lib/fetch_connector_index_names.ts b/packages/kbn-search-connectors/lib/fetch_connector_index_names.ts new file mode 100644 index 0000000000000..bed99173c859b --- /dev/null +++ b/packages/kbn-search-connectors/lib/fetch_connector_index_names.ts @@ -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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ElasticsearchClient } from '@kbn/core/server'; + +import { CONNECTORS_INDEX } from '..'; +import { isIndexNotFoundException } from '../utils/identify_exceptions'; + +export async function fetchConnectorIndexNames(client: ElasticsearchClient): Promise { + try { + const result = await client.search({ + _source: false, + fields: [{ field: 'index_name' }], + index: CONNECTORS_INDEX, + size: 10000, + }); + return (result?.hits.hits ?? []).map((field) => field.fields?.index_name[0] ?? ''); + } catch (error) { + if (isIndexNotFoundException(error)) { + return []; + } + throw error; + } +} diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connectors.test.ts b/packages/kbn-search-connectors/lib/fetch_connectors.test.ts similarity index 70% rename from x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connectors.test.ts rename to packages/kbn-search-connectors/lib/fetch_connectors.test.ts index 4196aad469d65..e1bb872710594 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connectors.test.ts +++ b/packages/kbn-search-connectors/lib/fetch_connectors.test.ts @@ -1,11 +1,12 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '..'; import { fetchConnectorById, fetchConnectorByIndexName, fetchConnectors } from './fetch_connectors'; @@ -31,11 +32,8 @@ const otherError = { describe('fetchConnectors lib', () => { const mockClient = { - asCurrentUser: { - get: jest.fn(), - search: jest.fn(), - }, - asInternalUser: {}, + get: jest.fn(), + search: jest.fn(), }; beforeEach(() => { @@ -43,7 +41,7 @@ describe('fetchConnectors lib', () => { }); describe('fetch connector by id', () => { it('should fetch connector by id', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => + mockClient.get.mockImplementationOnce(() => Promise.resolve({ _id: 'connectorId', _primary_term: 'primaryTerm', @@ -56,23 +54,23 @@ describe('fetchConnectors lib', () => { seqNo: 5, value: { id: 'connectorId', source: 'source' }, }); - expect(mockClient.asCurrentUser.get).toHaveBeenCalledWith({ + expect(mockClient.get).toHaveBeenCalledWith({ id: 'id', index: CONNECTORS_INDEX, }); }); it('should return undefined on index not found error', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => Promise.reject(indexNotFoundError)); + mockClient.get.mockImplementationOnce(() => Promise.reject(indexNotFoundError)); await expect(fetchConnectorById(mockClient as any, 'id')).resolves.toEqual(undefined); - expect(mockClient.asCurrentUser.get).toHaveBeenCalledWith({ + expect(mockClient.get).toHaveBeenCalledWith({ id: 'id', index: CONNECTORS_INDEX, }); }); it('should throw on other errors', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => Promise.reject(otherError)); + mockClient.get.mockImplementationOnce(() => Promise.reject(otherError)); await expect(fetchConnectorById(mockClient as any, 'id')).rejects.toEqual(otherError); - expect(mockClient.asCurrentUser.get).toHaveBeenCalledWith({ + expect(mockClient.get).toHaveBeenCalledWith({ id: 'id', index: CONNECTORS_INDEX, }); @@ -80,17 +78,17 @@ describe('fetchConnectors lib', () => { }); describe('fetch connector by name', () => { it('should fetch connector by index name', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => + mockClient.search.mockImplementationOnce(() => Promise.resolve({ hits: { hits: [{ _id: 'connectorId', _source: { source: 'source' } }] } }) ); - mockClient.asCurrentUser.get.mockImplementationOnce(() => + mockClient.get.mockImplementationOnce(() => Promise.resolve({ _id: 'connectorId', _source: { source: 'source' } }) ); await expect(fetchConnectorByIndexName(mockClient as any, 'id')).resolves.toEqual({ id: 'connectorId', source: 'source', }); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ index: CONNECTORS_INDEX, query: { term: { @@ -100,11 +98,9 @@ describe('fetchConnectors lib', () => { }); }); it('should return undefined on index not found error', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => - Promise.reject(indexNotFoundError) - ); + mockClient.search.mockImplementationOnce(() => Promise.reject(indexNotFoundError)); await expect(fetchConnectorByIndexName(mockClient as any, 'id')).resolves.toEqual(undefined); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ index: CONNECTORS_INDEX, query: { term: { @@ -114,9 +110,9 @@ describe('fetchConnectors lib', () => { }); }); it('should throw on other errors', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => Promise.reject(otherError)); + mockClient.search.mockImplementationOnce(() => Promise.reject(otherError)); await expect(fetchConnectorByIndexName(mockClient as any, 'id')).rejects.toEqual(otherError); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ index: CONNECTORS_INDEX, query: { term: { @@ -128,7 +124,7 @@ describe('fetchConnectors lib', () => { }); describe('fetch connectors', () => { it('should fetch connectors', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => + mockClient.search.mockImplementationOnce(() => Promise.resolve({ hits: { hits: [{ _id: 'connectorId', _source: { source: 'source' } }] } }) ); await expect(fetchConnectors(mockClient as any)).resolves.toEqual([ @@ -137,7 +133,7 @@ describe('fetchConnectors lib', () => { source: 'source', }, ]); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ from: 0, index: CONNECTORS_INDEX, query: { match_all: {} }, @@ -153,7 +149,7 @@ describe('fetchConnectors lib', () => { let count = 0; - mockClient.asCurrentUser.search.mockImplementation(() => { + mockClient.search.mockImplementation(() => { count += 1; if (count === 3) { return Promise.resolve({ hits: { hits: [] } }); @@ -164,20 +160,18 @@ describe('fetchConnectors lib', () => { ...resultHits, ...resultHits, ]); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ from: 0, index: CONNECTORS_INDEX, query: { match_all: {} }, size: 1000, }); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledTimes(3); + expect(mockClient.search).toHaveBeenCalledTimes(3); }); it('should return empty array on index not found error', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => - Promise.reject(indexNotFoundError) - ); + mockClient.search.mockImplementationOnce(() => Promise.reject(indexNotFoundError)); await expect(fetchConnectors(mockClient as any)).resolves.toEqual([]); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ from: 0, index: CONNECTORS_INDEX, query: { match_all: {} }, @@ -185,9 +179,9 @@ describe('fetchConnectors lib', () => { }); }); it('should throw on other errors', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => Promise.reject(otherError)); + mockClient.search.mockImplementationOnce(() => Promise.reject(otherError)); await expect(fetchConnectors(mockClient as any)).rejects.toEqual(otherError); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ from: 0, index: CONNECTORS_INDEX, query: { match_all: {} }, diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connectors.ts b/packages/kbn-search-connectors/lib/fetch_connectors.ts similarity index 55% rename from x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connectors.ts rename to packages/kbn-search-connectors/lib/fetch_connectors.ts index c1d8b834d0e15..7d9463228c0a9 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connectors.ts +++ b/packages/kbn-search-connectors/lib/fetch_connectors.ts @@ -1,25 +1,27 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; -import { IScopedClusterClient } from '@kbn/core/server'; +import { QueryDslQueryContainer, SearchHit } from '@elastic/elasticsearch/lib/api/types'; +import { ElasticsearchClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; -import { Connector, ConnectorDocument } from '../../../common/types/connectors'; -import { OptimisticConcurrency } from '../../../common/types/util_types'; -import { isIndexNotFoundException } from '../../utils/identify_exceptions'; -import { fetchAll } from '../fetch_all'; +import { OptimisticConcurrency } from '../types/optimistic_concurrency'; +import { Connector, ConnectorDocument } from '../types/connectors'; + +import { isIndexNotFoundException } from '../utils/identify_exceptions'; +import { CONNECTORS_INDEX } from '..'; +import { isNotNullish } from '../utils/is_not_nullish'; export const fetchConnectorById = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string ): Promise | undefined> => { try { - const connectorResult = await client.asCurrentUser.get({ + const connectorResult = await client.get({ id: connectorId, index: CONNECTORS_INDEX, }); @@ -39,11 +41,11 @@ export const fetchConnectorById = async ( }; export const fetchConnectorByIndexName = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, indexName: string ): Promise => { try { - const connectorResult = await client.asCurrentUser.search({ + const connectorResult = await client.search({ index: CONNECTORS_INDEX, query: { term: { index_name: indexName } }, }); @@ -62,7 +64,7 @@ export const fetchConnectorByIndexName = async ( }; export const fetchConnectors = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, indexNames?: string[] ): Promise => { const query: QueryDslQueryContainer = indexNames @@ -70,7 +72,23 @@ export const fetchConnectors = async ( : { match_all: {} }; try { - return await fetchAll(client, CONNECTORS_INDEX, query); + let hits: Array> = []; + let accumulator: Array> = []; + + do { + const connectorResult = await client.search({ + from: accumulator.length, + index: CONNECTORS_INDEX, + query, + size: 1000, + }); + hits = connectorResult.hits.hits; + accumulator = accumulator.concat(hits); + } while (hits.length >= 1000); + + return accumulator + .map(({ _source, _id }) => (_source ? { ..._source, id: _id } : undefined)) + .filter(isNotNullish); } catch (error) { if (isIndexNotFoundException(error)) { return []; diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_sync_jobs.test.ts b/packages/kbn-search-connectors/lib/fetch_sync_jobs.test.ts similarity index 82% rename from x-pack/plugins/enterprise_search/server/lib/connectors/fetch_sync_jobs.test.ts rename to packages/kbn-search-connectors/lib/fetch_sync_jobs.test.ts index 651849e803c41..debfedbcfeb67 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_sync_jobs.test.ts +++ b/packages/kbn-search-connectors/lib/fetch_sync_jobs.test.ts @@ -1,19 +1,17 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { fetchSyncJobsByConnectorId } from './fetch_sync_jobs'; describe('fetchSyncJobs lib', () => { const mockClient = { - asCurrentUser: { - get: jest.fn(), - search: jest.fn(), - }, - asInternalUser: {}, + get: jest.fn(), + search: jest.fn(), }; beforeEach(() => { @@ -21,7 +19,7 @@ describe('fetchSyncJobs lib', () => { }); describe('fetch sync jobs by connector id', () => { it('should fetch sync jobs by connector id', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => + mockClient.search.mockImplementationOnce(() => Promise.resolve({ hits: { hits: ['result1', 'result2'] }, total: 2 }) ); await expect(fetchSyncJobsByConnectorId(mockClient as any, 'id', 0, 10)).resolves.toEqual({ @@ -35,7 +33,7 @@ describe('fetchSyncJobs lib', () => { }, data: [], }); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ from: 0, index: '.elastic-connectors-sync-jobs', query: { @@ -63,10 +61,10 @@ describe('fetchSyncJobs lib', () => { }, data: [], }); - expect(mockClient.asCurrentUser.search).not.toHaveBeenCalled(); + expect(mockClient.search).not.toHaveBeenCalled(); }); it('should return empty array on index not found error', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => + mockClient.search.mockImplementationOnce(() => Promise.reject({ meta: { body: { @@ -88,7 +86,7 @@ describe('fetchSyncJobs lib', () => { }, data: [], }); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ from: 0, index: '.elastic-connectors-sync-jobs', query: { @@ -105,7 +103,7 @@ describe('fetchSyncJobs lib', () => { }); }); it('should throw on other errors', async () => { - mockClient.asCurrentUser.search.mockImplementationOnce(() => + mockClient.search.mockImplementationOnce(() => Promise.reject({ meta: { body: { @@ -125,7 +123,7 @@ describe('fetchSyncJobs lib', () => { }, }, }); - expect(mockClient.asCurrentUser.search).toHaveBeenCalledWith({ + expect(mockClient.search).toHaveBeenCalledWith({ from: 0, index: '.elastic-connectors-sync-jobs', query: { diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_sync_jobs.ts b/packages/kbn-search-connectors/lib/fetch_sync_jobs.ts similarity index 71% rename from x-pack/plugins/enterprise_search/server/lib/connectors/fetch_sync_jobs.ts rename to packages/kbn-search-connectors/lib/fetch_sync_jobs.ts index 43f373712f753..1a56103702d83 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_sync_jobs.ts +++ b/packages/kbn-search-connectors/lib/fetch_sync_jobs.ts @@ -1,19 +1,20 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; +import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; -import { CONNECTORS_JOBS_INDEX } from '../..'; -import { ConnectorSyncJob, SyncJobType } from '../../../common/types/connectors'; -import { Paginate } from '../../../common/types/pagination'; -import { isNotNullish } from '../../../common/utils/is_not_nullish'; +import { CONNECTORS_JOBS_INDEX } from '..'; +import { ConnectorSyncJob, SyncJobType } from '../types/connectors'; +import { Paginate } from '../types/pagination'; +import { isNotNullish } from '../utils/is_not_nullish'; -import { fetchWithPagination } from '../../utils/fetch_with_pagination'; -import { isIndexNotFoundException } from '../../utils/identify_exceptions'; +import { fetchWithPagination } from '../utils/fetch_with_pagination'; +import { isIndexNotFoundException } from '../utils/identify_exceptions'; const defaultResult: Paginate = { _meta: { @@ -28,7 +29,7 @@ const defaultResult: Paginate = { }; export const fetchSyncJobsByConnectorId = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string, from: number, size: number, @@ -63,7 +64,7 @@ export const fetchSyncJobsByConnectorId = async ( }; const result = await fetchWithPagination( async () => - await client.asCurrentUser.search({ + await client.search({ from, index: CONNECTORS_JOBS_INDEX, query, diff --git a/packages/kbn-search-connectors/lib/index.ts b/packages/kbn-search-connectors/lib/index.ts new file mode 100644 index 0000000000000..4fd4706268327 --- /dev/null +++ b/packages/kbn-search-connectors/lib/index.ts @@ -0,0 +1,23 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './cancel_syncs'; +export * from './create_connector'; +export * from './create_connector_document'; +export * from './delete_connector'; +export * from './fetch_connectors'; +export * from './fetch_sync_jobs'; +export * from './update_filtering'; +export * from './update_filtering_draft'; +export * from './update_native'; +export * from './start_sync'; +export * from './update_connector_configuration'; +export * from './update_connector_name_and_description'; +export * from './update_connector_scheduling'; +export * from './update_connector_service_type'; +export * from './update_connector_status'; diff --git a/packages/kbn-search-connectors/lib/start_sync.test.ts b/packages/kbn-search-connectors/lib/start_sync.test.ts new file mode 100644 index 0000000000000..c32b82bc7ba7f --- /dev/null +++ b/packages/kbn-search-connectors/lib/start_sync.test.ts @@ -0,0 +1,242 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ElasticsearchClient } from '@kbn/core/server'; + +import { CONNECTORS_INDEX, CURRENT_CONNECTORS_JOB_INDEX } from '..'; +import { SyncJobType, SyncStatus, TriggerMethod } from '../types/connectors'; +import { CONNECTORS_ACCESS_CONTROL_INDEX_PREFIX } from '..'; + +import { startConnectorSync } from './start_sync'; + +describe('startSync lib function', () => { + const mockClient = { + get: jest.fn(), + index: jest.fn(), + update: jest.fn(), + }; + + beforeEach(() => { + jest.clearAllMocks(); + }); + + it('should start a full sync', async () => { + mockClient.get.mockImplementation(() => { + return Promise.resolve({ + _id: 'connectorId', + _source: { + api_key_id: null, + configuration: {}, + created_at: null, + custom_scheduling: {}, + error: null, + index_name: 'index_name', + language: null, + last_access_control_sync_error: null, + last_access_control_sync_scheduled_at: null, + last_access_control_sync_status: null, + last_seen: null, + last_sync_error: null, + last_sync_scheduled_at: null, + last_sync_status: null, + last_synced: null, + scheduling: { enabled: true, interval: '1 2 3 4 5' }, + service_type: null, + status: 'not connected', + sync_now: false, + }, + index: CONNECTORS_INDEX, + }); + }); + mockClient.index.mockImplementation(() => ({ _id: 'fakeId' })); + + await expect( + startConnectorSync(mockClient as unknown as ElasticsearchClient, { + connectorId: 'connectorId', + jobType: SyncJobType.FULL, + }) + ).resolves.toEqual({ _id: 'fakeId' }); + expect(mockClient.index).toHaveBeenCalledWith({ + document: { + cancelation_requested_at: null, + canceled_at: null, + completed_at: null, + connector: { + configuration: {}, + filtering: null, + id: 'connectorId', + index_name: 'index_name', + language: null, + pipeline: null, + service_type: null, + }, + created_at: expect.any(String), + deleted_document_count: 0, + error: null, + indexed_document_count: 0, + indexed_document_volume: 0, + job_type: SyncJobType.FULL, + last_seen: null, + metadata: {}, + started_at: null, + status: SyncStatus.PENDING, + total_document_count: null, + trigger_method: TriggerMethod.ON_DEMAND, + worker_hostname: null, + }, + index: CURRENT_CONNECTORS_JOB_INDEX, + }); + }); + + it('should not create index if there is no connector', async () => { + mockClient.get.mockImplementation(() => { + return Promise.resolve({}); + }); + await expect( + startConnectorSync(mockClient as unknown as ElasticsearchClient, { + connectorId: 'connectorId', + jobType: SyncJobType.FULL, + }) + ).rejects.toEqual(new Error('resource_not_found')); + expect(mockClient.index).not.toHaveBeenCalled(); + }); + + it('should start an incremental sync', async () => { + mockClient.get.mockImplementation(() => { + return Promise.resolve({ + _id: 'connectorId', + _source: { + api_key_id: null, + configuration: {}, + created_at: null, + custom_scheduling: {}, + error: null, + filtering: [], + index_name: 'index_name', + language: null, + last_access_control_sync_status: null, + last_seen: null, + last_sync_error: null, + last_sync_scheduled_at: null, + last_sync_status: null, + last_synced: null, + scheduling: { enabled: true, interval: '1 2 3 4 5' }, + service_type: null, + status: 'not connected', + sync_now: false, + }, + index: CONNECTORS_INDEX, + }); + }); + mockClient.index.mockImplementation(() => ({ _id: 'fakeId' })); + + await expect( + startConnectorSync(mockClient as unknown as ElasticsearchClient, { + connectorId: 'connectorId', + jobType: SyncJobType.INCREMENTAL, + }) + ).resolves.toEqual({ _id: 'fakeId' }); + expect(mockClient.index).toHaveBeenCalledWith({ + document: { + cancelation_requested_at: null, + canceled_at: null, + completed_at: null, + connector: { + configuration: {}, + filtering: null, + id: 'connectorId', + index_name: 'index_name', + language: null, + pipeline: null, + service_type: null, + }, + created_at: expect.any(String), + deleted_document_count: 0, + error: null, + indexed_document_count: 0, + indexed_document_volume: 0, + job_type: SyncJobType.INCREMENTAL, + last_seen: null, + metadata: {}, + started_at: null, + status: SyncStatus.PENDING, + total_document_count: null, + trigger_method: TriggerMethod.ON_DEMAND, + worker_hostname: null, + }, + index: CURRENT_CONNECTORS_JOB_INDEX, + }); + }); + + it('should start an access control sync', async () => { + mockClient.get.mockImplementation(() => { + return Promise.resolve({ + _id: 'connectorId', + _source: { + api_key_id: null, + configuration: {}, + created_at: null, + custom_scheduling: {}, + error: null, + index_name: 'search-index_name', + language: null, + last_access_control_sync_status: null, + last_seen: null, + last_sync_error: null, + last_sync_scheduled_at: null, + last_sync_status: null, + last_synced: null, + scheduling: { enabled: true, interval: '1 2 3 4 5' }, + service_type: null, + status: 'not connected', + sync_now: false, + }, + index: CONNECTORS_INDEX, + }); + }); + mockClient.index.mockImplementation(() => ({ _id: 'fakeId' })); + + await expect( + startConnectorSync(mockClient as unknown as ElasticsearchClient, { + connectorId: 'connectorId', + targetIndexName: '.search-acl-filter-index_name', + jobType: SyncJobType.ACCESS_CONTROL, + }) + ).resolves.toEqual({ _id: 'fakeId' }); + expect(mockClient.index).toHaveBeenCalledWith({ + document: { + cancelation_requested_at: null, + canceled_at: null, + completed_at: null, + connector: { + configuration: {}, + filtering: null, + id: 'connectorId', + index_name: `${CONNECTORS_ACCESS_CONTROL_INDEX_PREFIX}index_name`, + language: null, + pipeline: null, + service_type: null, + }, + created_at: expect.any(String), + deleted_document_count: 0, + error: null, + indexed_document_count: 0, + indexed_document_volume: 0, + job_type: SyncJobType.ACCESS_CONTROL, + last_seen: null, + metadata: {}, + started_at: null, + status: SyncStatus.PENDING, + total_document_count: null, + trigger_method: TriggerMethod.ON_DEMAND, + worker_hostname: null, + }, + index: CURRENT_CONNECTORS_JOB_INDEX, + }); + }); +}); diff --git a/packages/kbn-search-connectors/lib/start_sync.ts b/packages/kbn-search-connectors/lib/start_sync.ts new file mode 100644 index 0000000000000..878901953e6a1 --- /dev/null +++ b/packages/kbn-search-connectors/lib/start_sync.ts @@ -0,0 +1,91 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ElasticsearchClient } from '@kbn/core/server'; + +import { CONNECTORS_INDEX, CURRENT_CONNECTORS_JOB_INDEX } from '..'; +import { + ConnectorConfiguration, + ConnectorDocument, + SyncJobType, + SyncStatus, + TriggerMethod, +} from '../types/connectors'; +import { isConfigEntry } from '../utils/is_category_entry'; + +export const startConnectorSync = async ( + client: ElasticsearchClient, + { + connectorId, + jobType, + targetIndexName, + }: { + connectorId: string; + jobType?: SyncJobType; + targetIndexName?: string; + } +) => { + const connectorResult = await client.get({ + id: connectorId, + index: CONNECTORS_INDEX, + }); + const connector = connectorResult._source; + if (connector) { + const configuration = Object.entries(connector.configuration).reduce( + (acc, [key, configEntry]) => { + if (isConfigEntry(configEntry)) { + acc[key] = configEntry; + } + return acc; + }, + {} as ConnectorConfiguration + ); + const { + filtering, + index_name: connectorIndexName, + language, + pipeline, + service_type: serviceType, + } = connector; + + const now = new Date().toISOString(); + + return await client.index({ + document: { + cancelation_requested_at: null, + canceled_at: null, + completed_at: null, + connector: { + configuration, + filtering: filtering ? filtering[0]?.active ?? null : null, + id: connectorId, + index_name: targetIndexName || connectorIndexName, + language, + pipeline: pipeline ?? null, + service_type: serviceType, + }, + created_at: now, + deleted_document_count: 0, + error: null, + indexed_document_count: 0, + indexed_document_volume: 0, + job_type: jobType, + last_seen: null, + metadata: {}, + started_at: null, + status: SyncStatus.PENDING, + total_document_count: null, + trigger_method: TriggerMethod.ON_DEMAND, + worker_hostname: null, + }, + index: CURRENT_CONNECTORS_JOB_INDEX, + }); + } else { + throw new Error('resource_not_found'); + } +}; diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_configuration.test.ts b/packages/kbn-search-connectors/lib/update_connector_configuration.test.ts similarity index 69% rename from x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_configuration.test.ts rename to packages/kbn-search-connectors/lib/update_connector_configuration.test.ts index 0b7e328e9ebb4..fd1e014037863 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_configuration.test.ts +++ b/packages/kbn-search-connectors/lib/update_connector_configuration.test.ts @@ -1,26 +1,24 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core/server'; - -import { CONNECTORS_INDEX } from '../..'; -import { ConnectorStatus } from '../../../common/types/connectors'; +import { ElasticsearchClient } from '@kbn/core/server'; +import { CONNECTORS_INDEX } from '..'; import { fetchConnectorById } from './fetch_connectors'; +import { ConnectorStatus } from '../types/connectors'; + import { updateConnectorConfiguration } from './update_connector_configuration'; jest.mock('./fetch_connectors', () => ({ fetchConnectorById: jest.fn() })); describe('updateConnectorConfiguration lib function', () => { const mockClient = { - asCurrentUser: { - update: jest.fn(), - }, - asInternalUser: {}, + update: jest.fn(), }; beforeEach(() => { @@ -38,11 +36,11 @@ describe('updateConnectorConfiguration lib function', () => { it('should update configuration', async () => { await expect( - updateConnectorConfiguration(mockClient as unknown as IScopedClusterClient, 'connectorId', { + updateConnectorConfiguration(mockClient as unknown as ElasticsearchClient, 'connectorId', { test: 'newValue', }) ).resolves.toEqual({ test: { label: 'haha', value: 'newValue' } }); - expect(mockClient.asCurrentUser.update).toHaveBeenCalledWith({ + expect(mockClient.update).toHaveBeenCalledWith({ doc: { configuration: { test: { label: 'haha', value: 'newValue' } }, status: ConnectorStatus.CONFIGURED, @@ -58,10 +56,10 @@ describe('updateConnectorConfiguration lib function', () => { (fetchConnectorById as jest.Mock).mockImplementation(() => undefined); await expect( - updateConnectorConfiguration(mockClient as unknown as IScopedClusterClient, 'connectorId', { + updateConnectorConfiguration(mockClient as unknown as ElasticsearchClient, 'connectorId', { test: 'newValue', }) ).rejects.toEqual(new Error('Could not find connector')); - expect(mockClient.asCurrentUser.update).not.toHaveBeenCalled(); + expect(mockClient.update).not.toHaveBeenCalled(); }); }); diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_configuration.ts b/packages/kbn-search-connectors/lib/update_connector_configuration.ts similarity index 71% rename from x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_configuration.ts rename to packages/kbn-search-connectors/lib/update_connector_configuration.ts index 7c68a0a08dee7..dfb43af53db44 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_configuration.ts +++ b/packages/kbn-search-connectors/lib/update_connector_configuration.ts @@ -1,28 +1,24 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core/server'; +import { ElasticsearchClient } from '@kbn/core/server'; import { i18n } from '@kbn/i18n'; -import { CONNECTORS_INDEX } from '../..'; - -import { isConfigEntry } from '../../../common/connectors/is_category_entry'; -import { - ConnectorConfiguration, - ConnectorDocument, - ConnectorStatus, -} from '../../../common/types/connectors'; -import { isNotNullish } from '../../../common/utils/is_not_nullish'; +import { CONNECTORS_INDEX } from '..'; import { fetchConnectorById } from './fetch_connectors'; +import { ConnectorConfiguration, ConnectorDocument, ConnectorStatus } from '../types/connectors'; +import { isConfigEntry } from '../utils/is_category_entry'; +import { isNotNullish } from '../utils/is_not_nullish'; export const updateConnectorConfiguration = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string, configuration: Record ) => { @@ -49,7 +45,7 @@ export const updateConnectorConfiguration = async ( const { key, ...config } = curr; return { ...prev, [curr.key]: config }; }, {}); - await client.asCurrentUser.update({ + await client.update({ doc: { configuration: updatedConfig, status }, id: connectorId, if_primary_term: connectorResult?.primaryTerm, @@ -59,7 +55,7 @@ export const updateConnectorConfiguration = async ( return updatedConfig; } else { throw new Error( - i18n.translate('xpack.enterpriseSearch.server.connectors.configuration.error', { + i18n.translate('searchConnectors.server.connectors.configuration.error', { defaultMessage: 'Could not find connector', }) ); diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_name_and_description.ts b/packages/kbn-search-connectors/lib/update_connector_name_and_description.ts similarity index 52% rename from x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_name_and_description.ts rename to packages/kbn-search-connectors/lib/update_connector_name_and_description.ts index caca94ee2713a..6323387c4259f 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_name_and_description.ts +++ b/packages/kbn-search-connectors/lib/update_connector_name_and_description.ts @@ -1,38 +1,39 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core/server'; +import { ElasticsearchClient } from '@kbn/core/server'; import { i18n } from '@kbn/i18n'; -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '..'; -import { Connector, ConnectorDocument } from '../../../common/types/connectors'; +import { Connector, ConnectorDocument } from '../types/connectors'; export const updateConnectorNameAndDescription = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string, connectorUpdates: Partial> ) => { - const connectorResult = await client.asCurrentUser.get({ + const connectorResult = await client.get({ id: connectorId, index: CONNECTORS_INDEX, }); const connector = connectorResult._source; if (connector) { - const result = await client.asCurrentUser.index({ + const result = await client.index({ document: { ...connector, ...connectorUpdates }, id: connectorId, index: CONNECTORS_INDEX, }); - await client.asCurrentUser.indices.refresh({ index: CONNECTORS_INDEX }); + await client.indices.refresh({ index: CONNECTORS_INDEX }); return result; } else { throw new Error( - i18n.translate('xpack.enterpriseSearch.server.connectors.serviceType.error', { + i18n.translate('searchConnectors.server.connectors.serviceType.error', { defaultMessage: 'Could not find document', }) ); diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_scheduling.test.ts b/packages/kbn-search-connectors/lib/update_connector_scheduling.test.ts similarity index 76% rename from x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_scheduling.test.ts rename to packages/kbn-search-connectors/lib/update_connector_scheduling.test.ts index c314e101624fb..618522831118d 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_scheduling.test.ts +++ b/packages/kbn-search-connectors/lib/update_connector_scheduling.test.ts @@ -1,26 +1,24 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core/server'; +import { ElasticsearchClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '..'; import { updateConnectorScheduling } from './update_connector_scheduling'; describe('addConnector lib function', () => { const mockClient = { - asCurrentUser: { - get: jest.fn(), - index: jest.fn(), - indices: { - refresh: jest.fn(), - }, + get: jest.fn(), + index: jest.fn(), + indices: { + refresh: jest.fn(), }, - asInternalUser: {}, }; beforeEach(() => { @@ -28,7 +26,7 @@ describe('addConnector lib function', () => { }); it('should update connector scheduling', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => { + mockClient.get.mockImplementationOnce(() => { return Promise.resolve({ _source: { api_key_id: null, @@ -57,10 +55,10 @@ describe('addConnector lib function', () => { index: CONNECTORS_INDEX, }); }); - mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); + mockClient.index.mockImplementation(() => ({ _id: 'fakeId' })); await expect( - updateConnectorScheduling(mockClient as unknown as IScopedClusterClient, 'connectorId', { + updateConnectorScheduling(mockClient as unknown as ElasticsearchClient, 'connectorId', { access_control: { enabled: false, interval: '* * * * *' }, full: { enabled: true, @@ -69,7 +67,7 @@ describe('addConnector lib function', () => { incremental: { enabled: false, interval: '* * * * *' }, }) ).resolves.toEqual({ _id: 'fakeId' }); - expect(mockClient.asCurrentUser.index).toHaveBeenCalledWith({ + expect(mockClient.index).toHaveBeenCalledWith({ document: { api_key_id: null, configuration: {}, @@ -97,17 +95,17 @@ describe('addConnector lib function', () => { id: 'connectorId', index: CONNECTORS_INDEX, }); - expect(mockClient.asCurrentUser.indices.refresh).toHaveBeenCalledWith({ + expect(mockClient.indices.refresh).toHaveBeenCalledWith({ index: CONNECTORS_INDEX, }); }); it('should not index document if there is no connector', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => { + mockClient.get.mockImplementationOnce(() => { return Promise.resolve({}); }); await expect( - updateConnectorScheduling(mockClient as unknown as IScopedClusterClient, 'connectorId', { + updateConnectorScheduling(mockClient as unknown as ElasticsearchClient, 'connectorId', { access_control: { enabled: false, interval: '* * * * *' }, full: { enabled: true, @@ -116,6 +114,6 @@ describe('addConnector lib function', () => { incremental: { enabled: false, interval: '* * * * *' }, }) ).rejects.toEqual(new Error('Could not find document')); - expect(mockClient.asCurrentUser.index).not.toHaveBeenCalled(); + expect(mockClient.index).not.toHaveBeenCalled(); }); }); diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_scheduling.ts b/packages/kbn-search-connectors/lib/update_connector_scheduling.ts similarity index 50% rename from x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_scheduling.ts rename to packages/kbn-search-connectors/lib/update_connector_scheduling.ts index b6da7f138421d..a0693dc3cd6f6 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_scheduling.ts +++ b/packages/kbn-search-connectors/lib/update_connector_scheduling.ts @@ -1,38 +1,39 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core/server'; +import { ElasticsearchClient } from '@kbn/core/server'; import { i18n } from '@kbn/i18n'; -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '..'; -import { ConnectorDocument, SchedulingConfiguraton } from '../../../common/types/connectors'; +import { ConnectorDocument, SchedulingConfiguraton } from '../types/connectors'; export const updateConnectorScheduling = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string, scheduling: SchedulingConfiguraton ) => { - const connectorResult = await client.asCurrentUser.get({ + const connectorResult = await client.get({ id: connectorId, index: CONNECTORS_INDEX, }); const connector = connectorResult._source; if (connector) { - const result = await client.asCurrentUser.index({ + const result = await client.index({ document: { ...connector, scheduling }, id: connectorId, index: CONNECTORS_INDEX, }); - await client.asCurrentUser.indices.refresh({ index: CONNECTORS_INDEX }); + await client.indices.refresh({ index: CONNECTORS_INDEX }); return result; } else { throw new Error( - i18n.translate('xpack.enterpriseSearch.server.connectors.scheduling.error', { + i18n.translate('searchConnectors.server.connectors.scheduling.error', { defaultMessage: 'Could not find document', }) ); diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_service_type.ts b/packages/kbn-search-connectors/lib/update_connector_service_type.ts similarity index 51% rename from x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_service_type.ts rename to packages/kbn-search-connectors/lib/update_connector_service_type.ts index a88950c48e99f..27732e17c8c2a 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_service_type.ts +++ b/packages/kbn-search-connectors/lib/update_connector_service_type.ts @@ -1,38 +1,39 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core/server'; +import { ElasticsearchClient } from '@kbn/core/server'; import { i18n } from '@kbn/i18n'; -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '..'; -import { ConnectorDocument } from '../../../common/types/connectors'; +import { ConnectorDocument } from '../types/connectors'; export const updateConnectorServiceType = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string, serviceType: string ) => { - const connectorResult = await client.asCurrentUser.get({ + const connectorResult = await client.get({ id: connectorId, index: CONNECTORS_INDEX, }); const connector = connectorResult._source; if (connector) { - const result = await client.asCurrentUser.index({ + const result = await client.index({ document: { ...connector, service_type: serviceType }, id: connectorId, index: CONNECTORS_INDEX, }); - await client.asCurrentUser.indices.refresh({ index: CONNECTORS_INDEX }); + await client.indices.refresh({ index: CONNECTORS_INDEX }); return result; } else { throw new Error( - i18n.translate('xpack.enterpriseSearch.server.connectors.serviceType.error', { + i18n.translate('searchConnectors.server.connectors.serviceType.error', { defaultMessage: 'Could not find document', }) ); diff --git a/packages/kbn-search-connectors/lib/update_connector_status.ts b/packages/kbn-search-connectors/lib/update_connector_status.ts new file mode 100644 index 0000000000000..42ba9adb4f9e0 --- /dev/null +++ b/packages/kbn-search-connectors/lib/update_connector_status.ts @@ -0,0 +1,41 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ElasticsearchClient } from '@kbn/core/server'; +import { i18n } from '@kbn/i18n'; + +import { CONNECTORS_INDEX } from '..'; + +import { ConnectorDocument, ConnectorStatus } from '../types/connectors'; + +export const updateConnectorStatus = async ( + client: ElasticsearchClient, + connectorId: string, + status: ConnectorStatus +) => { + const connectorResult = await client.get({ + id: connectorId, + index: CONNECTORS_INDEX, + }); + const connector = connectorResult._source; + if (connector) { + const result = await client.index({ + document: { ...connector, status }, + id: connectorId, + index: CONNECTORS_INDEX, + }); + await client.indices.refresh({ index: CONNECTORS_INDEX }); + return result; + } else { + throw new Error( + i18n.translate('searchConnectors.server.connectors.serviceType.error', { + defaultMessage: 'Could not find document', + }) + ); + } +}; diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/put_update_filtering.ts b/packages/kbn-search-connectors/lib/update_filtering.ts similarity index 80% rename from x-pack/plugins/enterprise_search/server/lib/connectors/put_update_filtering.ts rename to packages/kbn-search-connectors/lib/update_filtering.ts index 4c0e3c2b2e541..5d32639f23396 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/put_update_filtering.ts +++ b/packages/kbn-search-connectors/lib/update_filtering.ts @@ -1,24 +1,24 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; +import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '..'; +import { fetchConnectorById } from './fetch_connectors'; import { Connector, FilteringRule, FilteringRules, FilteringValidationState, -} from '../../../common/types/connectors'; - -import { fetchConnectorById } from './fetch_connectors'; +} from '../types/connectors'; export const updateFiltering = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string, { advancedSnippet, @@ -55,7 +55,7 @@ export const updateFiltering = async ( }, }; - const result = await client.asCurrentUser.update({ + const result = await client.update({ doc: { ...connector, filtering: [{ ...connector.filtering[0], active, draft: active }] }, id: connectorId, if_primary_term: primaryTerm, diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/put_update_filtering_draft.ts b/packages/kbn-search-connectors/lib/update_filtering_draft.ts similarity index 80% rename from x-pack/plugins/enterprise_search/server/lib/connectors/put_update_filtering_draft.ts rename to packages/kbn-search-connectors/lib/update_filtering_draft.ts index cf82d79008d09..deb6eabd66e23 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/put_update_filtering_draft.ts +++ b/packages/kbn-search-connectors/lib/update_filtering_draft.ts @@ -1,24 +1,24 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ -import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; +import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '..'; +import { fetchConnectorById } from './fetch_connectors'; import { Connector, FilteringRule, FilteringRules, FilteringValidationState, -} from '../../../common/types/connectors'; - -import { fetchConnectorById } from './fetch_connectors'; +} from '../types/connectors'; export const updateFilteringDraft = async ( - client: IScopedClusterClient, + client: ElasticsearchClient, connectorId: string, { advancedSnippet, @@ -55,7 +55,7 @@ export const updateFilteringDraft = async ( } const { value: connector, seqNo, primaryTerm } = connectorResult; - const result = await client.asCurrentUser.update({ + const result = await client.update({ doc: { ...connector, filtering: [{ ...connector.filtering[0], draft }] }, id: connectorId, if_primary_term: primaryTerm, diff --git a/packages/kbn-search-connectors/lib/update_native.ts b/packages/kbn-search-connectors/lib/update_native.ts new file mode 100644 index 0000000000000..dff5042961088 --- /dev/null +++ b/packages/kbn-search-connectors/lib/update_native.ts @@ -0,0 +1,28 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; + +import { CONNECTORS_INDEX } from '..'; +import { Connector } from '../types/connectors'; + +export const putUpdateNative = async ( + client: ElasticsearchClient, + connectorId: string, + isNative: boolean +) => { + const result = await client.update({ + doc: { + is_native: isNative, + }, + id: connectorId, + index: CONNECTORS_INDEX, + }); + + return result; +}; diff --git a/packages/kbn-search-connectors/package.json b/packages/kbn-search-connectors/package.json new file mode 100644 index 0000000000000..d2fb29822e269 --- /dev/null +++ b/packages/kbn-search-connectors/package.json @@ -0,0 +1,6 @@ +{ + "name": "@kbn/search-connectors", + "private": true, + "version": "1.0.0", + "license": "SSPL-1.0 OR Elastic License 2.0" +} \ No newline at end of file diff --git a/packages/kbn-search-connectors/tsconfig.json b/packages/kbn-search-connectors/tsconfig.json new file mode 100644 index 0000000000000..a8c8d3c9840a6 --- /dev/null +++ b/packages/kbn-search-connectors/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node", + "react" + ] + }, + "include": [ + "**/*.ts", + "**/*.tsx", + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/i18n", + "@kbn/core", + "@kbn/core-elasticsearch-server", + ] +} diff --git a/x-pack/plugins/enterprise_search/common/types/connectors.ts b/packages/kbn-search-connectors/types/connectors.ts similarity index 97% rename from x-pack/plugins/enterprise_search/common/types/connectors.ts rename to packages/kbn-search-connectors/types/connectors.ts index 6354c058b222f..8f649c15f348f 100644 --- a/x-pack/plugins/enterprise_search/common/types/connectors.ts +++ b/packages/kbn-search-connectors/types/connectors.ts @@ -1,8 +1,9 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ export interface SelectOption { diff --git a/packages/kbn-search-connectors/types/index.ts b/packages/kbn-search-connectors/types/index.ts new file mode 100644 index 0000000000000..f7ef8e3b4d941 --- /dev/null +++ b/packages/kbn-search-connectors/types/index.ts @@ -0,0 +1,12 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './connectors'; +export * from './native_connectors'; +export * from './optimistic_concurrency'; +export * from './pagination'; diff --git a/x-pack/plugins/enterprise_search/common/connectors/native_connectors.ts b/packages/kbn-search-connectors/types/native_connectors.ts similarity index 83% rename from x-pack/plugins/enterprise_search/common/connectors/native_connectors.ts rename to packages/kbn-search-connectors/types/native_connectors.ts index b12c23e26351a..0e767b4bdd345 100644 --- a/x-pack/plugins/enterprise_search/common/connectors/native_connectors.ts +++ b/packages/kbn-search-connectors/types/native_connectors.ts @@ -1,59 +1,60 @@ /* * 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. + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. */ import { i18n } from '@kbn/i18n'; -import { DisplayType, FeatureName, FieldType, NativeConnector } from '../types/connectors'; +import { DisplayType, FeatureName, FieldType, NativeConnector } from './connectors'; -const USERNAME_LABEL = i18n.translate('xpack.enterpriseSearch.nativeConnectors.usernameLabel', { +const USERNAME_LABEL = i18n.translate('searchConnectors.nativeConnectors.usernameLabel', { defaultMessage: 'Username', }); -const PASSWORD_LABEL = i18n.translate('xpack.enterpriseSearch.nativeConnectors.passwordLabel', { +const PASSWORD_LABEL = i18n.translate('searchConnectors.nativeConnectors.passwordLabel', { defaultMessage: 'Password', }); -const ENABLE_SSL_LABEL = i18n.translate('xpack.enterpriseSearch.nativeConnectors.enableSSL.label', { +const ENABLE_SSL_LABEL = i18n.translate('searchConnectors.nativeConnectors.enableSSL.label', { defaultMessage: 'Enable SSL', }); const SSL_CERTIFICATE_LABEL = i18n.translate( - 'xpack.enterpriseSearch.nativeConnectors.sslCertificate.label', + 'searchConnectors.nativeConnectors.sslCertificate.label', { defaultMessage: 'SSL certificate', } ); const RETRIES_PER_REQUEST_LABEL = i18n.translate( - 'xpack.enterpriseSearch.nativeConnectors.retriesPerRequest.label', + 'searchConnectors.nativeConnectors.retriesPerRequest.label', { defaultMessage: 'Retries per request', } ); const ADVANCED_RULES_IGNORED_LABEL = i18n.translate( - 'xpack.enterpriseSearch.nativeConnectors.advancedRulesIgnored.label', + 'searchConnectors.nativeConnectors.advancedRulesIgnored.label', { defaultMessage: 'This configurable field is ignored when Advanced Sync Rules are used.', } ); const MAX_CONCURRENT_DOWNLOADS_LABEL = i18n.translate( - 'xpack.enterpriseSearch.nativeConnectors.nativeConnectors.maximumConcurrentLabel', + 'searchConnectors.nativeConnectors.nativeConnectors.maximumConcurrentLabel', { defaultMessage: 'Maximum concurrent downloads', } ); -const DATABASE_LABEL = i18n.translate('xpack.enterpriseSearch.nativeConnectors.databaseLabel', { +const DATABASE_LABEL = i18n.translate('searchConnectors.nativeConnectors.databaseLabel', { defaultMessage: 'Database', }); -const PORT_LABEL = i18n.translate('xpack.enterpriseSearch.nativeConnectors.portLabel', { +const PORT_LABEL = i18n.translate('searchConnectors.nativeConnectors.portLabel', { defaultMessage: 'Port', }); @@ -65,7 +66,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record { + primaryTerm: number | undefined; + seqNo: number | undefined; + value: T; +} diff --git a/packages/kbn-search-connectors/types/pagination.ts b/packages/kbn-search-connectors/types/pagination.ts new file mode 100644 index 0000000000000..65f397105013b --- /dev/null +++ b/packages/kbn-search-connectors/types/pagination.ts @@ -0,0 +1,22 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface Page { + from: number; // current page index, 0-based + has_more_hits_than_total?: boolean; + size: number; // size per page + total: number; // total number of hits +} +export interface Meta { + page: Page; +} + +export interface Paginate { + _meta: Meta; + data: T[]; +} diff --git a/packages/kbn-search-connectors/utils/fetch_with_pagination.test.ts b/packages/kbn-search-connectors/utils/fetch_with_pagination.test.ts new file mode 100644 index 0000000000000..9fa0831955840 --- /dev/null +++ b/packages/kbn-search-connectors/utils/fetch_with_pagination.test.ts @@ -0,0 +1,125 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { SearchResponse } from '@elastic/elasticsearch/lib/api/types'; + +import { fetchWithPagination } from './fetch_with_pagination'; + +describe('fetchWithPagination util', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + describe('fetchWithPagination', () => { + it('should fetch mock data with pagination', async () => { + const mockFn = jest.fn(); + mockFn.mockImplementation(() => + Promise.resolve({ + hits: { hits: ['result1', 'result2'], total: 2 }, + } as any as SearchResponse) + ); + await expect(fetchWithPagination(mockFn, 0, 10)).resolves.toEqual({ + _meta: { + page: { + from: 0, + has_more_hits_than_total: false, + size: 10, + total: 2, + }, + }, + data: ['result1', 'result2'], + }); + }); + it('should return empty result if size is 0', async () => { + const mockFn = jest.fn(); + mockFn.mockImplementation(() => + Promise.resolve({ + hits: { hits: [], total: 0 }, + } as any as SearchResponse) + ); + await expect(fetchWithPagination(mockFn, 0, 0)).resolves.toEqual({ + _meta: { + page: { + from: 0, + has_more_hits_than_total: false, + size: 10, + total: 0, + }, + }, + data: [], + }); + }); + it('should handle total as an object correctly', async () => { + const mockFn = jest.fn(); + mockFn.mockImplementation(() => + Promise.resolve({ + hits: { + hits: [], + total: { + relation: 'lte', + value: 555, + }, + }, + } as any as SearchResponse) + ); + await expect(fetchWithPagination(mockFn, 0, 10)).resolves.toEqual({ + _meta: { + page: { + from: 0, + has_more_hits_than_total: false, + size: 10, + total: 555, + }, + }, + data: [], + }); + }); + + it('should handle undefined total correctly', async () => { + const mockFn = jest.fn(); + mockFn.mockImplementation(() => + Promise.resolve({ + hits: { + hits: [], + total: undefined, + }, + } as any as SearchResponse) + ); + await expect(fetchWithPagination(mockFn, 0, 10)).resolves.toEqual({ + _meta: { + page: { + from: 0, + has_more_hits_than_total: false, + size: 10, + total: 0, + }, + }, + data: [], + }); + }); + + it('should handle has_more_hits_than_total correctly', async () => { + const mockFn = jest.fn(); + mockFn.mockImplementation(() => + Promise.resolve({ + hits: { hits: ['result1', 'result2'], total: { relation: 'gte', value: 10000 } }, + } as any as SearchResponse) + ); + await expect(fetchWithPagination(mockFn, 50, 10)).resolves.toEqual({ + _meta: { + page: { + from: 50, + has_more_hits_than_total: true, + size: 10, + total: 10000, + }, + }, + data: ['result1', 'result2'], + }); + }); + }); +}); diff --git a/packages/kbn-search-connectors/utils/fetch_with_pagination.ts b/packages/kbn-search-connectors/utils/fetch_with_pagination.ts new file mode 100644 index 0000000000000..fd6c6a5232374 --- /dev/null +++ b/packages/kbn-search-connectors/utils/fetch_with_pagination.ts @@ -0,0 +1,61 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { SearchHit, SearchResponse, SearchTotalHits } from '@elastic/elasticsearch/lib/api/types'; + +import { Paginate } from '../types/pagination'; + +const defaultResult = (data: T[]) => ({ + _meta: { + page: { + from: 0, + has_more_hits_than_total: false, + size: 10, + total: 0, + }, + }, + data, +}); + +export const fetchWithPagination = async ( + fetchFunction: () => Promise>, + from: number, + size: number +): Promise>> => { + if (size === 0) { + return defaultResult>([]); + } + const result = await fetchFunction(); + const total = totalToPaginateTotal(result.hits.total); + return { + _meta: { + page: { + from, + size, + ...total, + }, + }, + data: result.hits.hits, + }; +}; + +function totalToPaginateTotal(input: number | SearchTotalHits | undefined): { + has_more_hits_than_total: boolean; + total: number; +} { + if (typeof input === 'number') { + return { has_more_hits_than_total: false, total: input }; + } + + return input + ? { + has_more_hits_than_total: input.relation === 'gte' ? true : false, + total: input.value, + } + : { has_more_hits_than_total: false, total: 0 }; +} diff --git a/packages/kbn-search-connectors/utils/identify_exceptions.test.ts b/packages/kbn-search-connectors/utils/identify_exceptions.test.ts new file mode 100644 index 0000000000000..321b0310353bb --- /dev/null +++ b/packages/kbn-search-connectors/utils/identify_exceptions.test.ts @@ -0,0 +1,82 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { isIndexNotFoundException, isResourceAlreadyExistsException } from './identify_exceptions'; + +describe('IdentifyExceptions', () => { + describe('IsIndexNotFoundException', () => { + it('should return true for index not found exception', () => { + const error = { + meta: { + body: { + error: { + type: 'index_not_found_exception', + }, + status: 404, + }, + name: 'ResponseError', + statusCode: 404, + }, + }; + expect(isIndexNotFoundException(error as any)).toEqual(true); + }); + it('should return false for other exception', () => { + const error = { + meta: { + body: { + error: { + type: 'other_exception', + }, + status: 404, + }, + name: 'ResponseError', + statusCode: 404, + }, + }; + expect(isIndexNotFoundException(error as any)).toEqual(false); + }); + it('should return false for other object', () => { + expect(isIndexNotFoundException({} as any)).toEqual(false); + }); + }); + describe('isResourceAlreadyExistsError', () => { + it('should return true for resource already exists exception', () => { + const error = { + meta: { + body: { + error: { + type: 'resource_already_exists_exception', + }, + status: 400, + }, + name: 'ResponseError', + statusCode: 400, + }, + }; + expect(isResourceAlreadyExistsException(error as any)).toEqual(true); + }); + it('should return false for other exception', () => { + const error = { + meta: { + body: { + error: { + type: 'other_exception', + }, + status: 404, + }, + name: 'ResponseError', + statusCode: 404, + }, + }; + expect(isResourceAlreadyExistsException(error as any)).toEqual(false); + }); + it('should return false for other object', () => { + expect(isResourceAlreadyExistsException({} as any)).toEqual(false); + }); + }); +}); diff --git a/packages/kbn-search-connectors/utils/identify_exceptions.ts b/packages/kbn-search-connectors/utils/identify_exceptions.ts new file mode 100644 index 0000000000000..0bc395710d8f5 --- /dev/null +++ b/packages/kbn-search-connectors/utils/identify_exceptions.ts @@ -0,0 +1,50 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export interface ElasticsearchResponseError { + meta?: { + body?: { + error?: { + type: string; + }; + }; + statusCode?: number; + }; + name: 'ResponseError'; +} + +const MISSING_ALIAS_ERROR = new RegExp(/^alias \[.+\] missing/); + +export const isIndexNotFoundException = (error: ElasticsearchResponseError) => + error?.meta?.body?.error?.type === 'index_not_found_exception'; + +export const isResourceAlreadyExistsException = (error: ElasticsearchResponseError) => + error?.meta?.body?.error?.type === 'resource_already_exists_exception'; + +export const isResourceNotFoundException = (error: ElasticsearchResponseError) => + error?.meta?.body?.error?.type === 'resource_not_found_exception'; + +export const isUnauthorizedException = (error: ElasticsearchResponseError) => + error.meta?.statusCode === 403; + +export const isNotFoundException = (error: ElasticsearchResponseError) => + error.meta?.statusCode === 404; + +export const isIllegalArgumentException = (error: ElasticsearchResponseError) => + error.meta?.body?.error?.type === 'illegal_argument_exception'; + +export const isVersionConflictEngineException = (error: ElasticsearchResponseError) => + error.meta?.body?.error?.type === 'version_conflict_engine_exception'; + +export const isInvalidSearchApplicationNameException = (error: ElasticsearchResponseError) => + error.meta?.body?.error?.type === 'invalid_alias_name_exception'; + +export const isMissingAliasException = (error: ElasticsearchResponseError) => + error.meta?.statusCode === 404 && + typeof error.meta?.body?.error === 'string' && + MISSING_ALIAS_ERROR.test(error.meta?.body?.error); diff --git a/packages/kbn-search-connectors/utils/index.ts b/packages/kbn-search-connectors/utils/index.ts new file mode 100644 index 0000000000000..ae2bbe2a818aa --- /dev/null +++ b/packages/kbn-search-connectors/utils/index.ts @@ -0,0 +1,9 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export * from './is_category_entry'; diff --git a/packages/kbn-search-connectors/utils/is_category_entry.ts b/packages/kbn-search-connectors/utils/is_category_entry.ts new file mode 100644 index 0000000000000..fb72db52944df --- /dev/null +++ b/packages/kbn-search-connectors/utils/is_category_entry.ts @@ -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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ConnectorConfigProperties, ConnectorConfigCategoryProperties } from '../types/connectors'; + +export function isCategoryEntry( + input: + | ConnectorConfigProperties + | ConnectorConfigCategoryProperties + | { label: string; value: boolean } + | null +): input is ConnectorConfigCategoryProperties { + return (input as ConnectorConfigCategoryProperties)?.type === 'category'; +} + +export function isConfigEntry( + input: + | ConnectorConfigProperties + | ConnectorConfigCategoryProperties + | { label: string; value: boolean } + | null +): input is ConnectorConfigProperties { + return (input as ConnectorConfigCategoryProperties).type !== 'category'; +} diff --git a/packages/kbn-search-connectors/utils/is_not_nullish.ts b/packages/kbn-search-connectors/utils/is_not_nullish.ts new file mode 100644 index 0000000000000..88b39b70d4ec8 --- /dev/null +++ b/packages/kbn-search-connectors/utils/is_not_nullish.ts @@ -0,0 +1,11 @@ +/* + * 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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export function isNotNullish(value: T | null | undefined): value is T { + return value !== null && value !== undefined; +} diff --git a/tsconfig.base.json b/tsconfig.base.json index afbbdcfe7601b..e5808369793ae 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1186,6 +1186,8 @@ "@kbn/screenshotting-plugin/*": ["x-pack/plugins/screenshotting/*"], "@kbn/search-api-panels": ["packages/kbn-search-api-panels"], "@kbn/search-api-panels/*": ["packages/kbn-search-api-panels/*"], + "@kbn/search-connectors": ["packages/kbn-search-connectors"], + "@kbn/search-connectors/*": ["packages/kbn-search-connectors/*"], "@kbn/search-examples-plugin": ["examples/search_examples"], "@kbn/search-examples-plugin/*": ["examples/search_examples/*"], "@kbn/search-response-warnings": ["packages/kbn-search-response-warnings"], diff --git a/x-pack/plugins/enterprise_search/common/connectors/is_category_entry.ts b/x-pack/plugins/enterprise_search/common/connectors/is_category_entry.ts index 455bd6799e096..75344e1a0b912 100644 --- a/x-pack/plugins/enterprise_search/common/connectors/is_category_entry.ts +++ b/x-pack/plugins/enterprise_search/common/connectors/is_category_entry.ts @@ -5,7 +5,10 @@ * 2.0. */ -import { ConnectorConfigProperties, ConnectorConfigCategoryProperties } from '../types/connectors'; +import { + ConnectorConfigProperties, + ConnectorConfigCategoryProperties, +} from '@kbn/search-connectors'; export function isCategoryEntry( input: diff --git a/x-pack/plugins/enterprise_search/common/constants.ts b/x-pack/plugins/enterprise_search/common/constants.ts index 8c8ace6fd434f..9bbaadc4c2b83 100644 --- a/x-pack/plugins/enterprise_search/common/constants.ts +++ b/x-pack/plugins/enterprise_search/common/constants.ts @@ -7,8 +7,9 @@ import { i18n } from '@kbn/i18n'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { ProductFeatures } from './types'; -import { IngestPipelineParams } from './types/connectors'; export const SEARCH_PRODUCT_NAME = i18n.translate('xpack.enterpriseSearch.search.productName', { defaultMessage: 'Search', diff --git a/x-pack/plugins/enterprise_search/common/types/crawler.ts b/x-pack/plugins/enterprise_search/common/types/crawler.ts index 678a99fa448d6..60043444524aa 100644 --- a/x-pack/plugins/enterprise_search/common/types/crawler.ts +++ b/x-pack/plugins/enterprise_search/common/types/crawler.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ConnectorStatus, SyncStatus } from './connectors'; +import { ConnectorStatus, SyncStatus } from '@kbn/search-connectors'; // See SharedTogo::Crawler::Status for details on how these are generated export enum CrawlerStatus { diff --git a/x-pack/plugins/enterprise_search/common/types/indices.ts b/x-pack/plugins/enterprise_search/common/types/indices.ts index b9e822e5168fd..57807ae98248a 100644 --- a/x-pack/plugins/enterprise_search/common/types/indices.ts +++ b/x-pack/plugins/enterprise_search/common/types/indices.ts @@ -12,7 +12,8 @@ import { Uuid, } from '@elastic/elasticsearch/lib/api/types'; -import { Connector } from './connectors'; +import { Connector } from '@kbn/search-connectors'; + import { Crawler } from './crawler'; export interface AlwaysShowPattern { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/pipeline.mock.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/pipeline.mock.ts index 55b21f2e4c753..2817716873c7e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/pipeline.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/pipeline.mock.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IngestPipelineParams } from '../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; export const mockPipelineState: IngestPipelineParams = { extract_binary_content: true, diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/search_indices.mock.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/search_indices.mock.ts index 4f92ffa6a7830..d8ebc499400f9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/search_indices.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/search_indices.mock.ts @@ -5,8 +5,6 @@ * 2.0. */ -import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; - import { ConnectorStatus, DisplayType, @@ -15,7 +13,10 @@ import { FilteringRuleRule, FilteringValidationState, SyncStatus, -} from '../../../../common/types/connectors'; +} from '@kbn/search-connectors'; + +import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; + import { ElasticsearchIndexWithIngestion } from '../../../../common/types/indices'; export const indices: ElasticsearchIndexWithIngestion[] = [ diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/sync_job.mock.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/sync_job.mock.ts index db4d1870fba90..d19407961e039 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/sync_job.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/sync_job.mock.ts @@ -7,12 +7,8 @@ import moment from 'moment'; -import { - ConnectorSyncJob, - TriggerMethod, - SyncStatus, - SyncJobType, -} from '../../../../common/types/connectors'; +import { ConnectorSyncJob, TriggerMethod, SyncStatus, SyncJobType } from '@kbn/search-connectors'; + import { SyncJobView } from '../components/search_index/sync_jobs/sync_jobs_view_logic'; export const syncJob: ConnectorSyncJob = { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/view_index.mock.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/view_index.mock.ts index f10ca7cfba3b0..c548225ef78ac 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/view_index.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/__mocks__/view_index.mock.ts @@ -5,8 +5,6 @@ * 2.0. */ -import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; - import { ConnectorStatus, DisplayType, @@ -15,7 +13,9 @@ import { FilteringRuleRule, FilteringValidationState, SyncStatus, -} from '../../../../common/types/connectors'; +} from '@kbn/search-connectors'; + +import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; import { ApiViewIndex, diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/fetch_sync_jobs_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/fetch_sync_jobs_api_logic.ts index 7452c2b7d1600..e7485d6645ce4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/fetch_sync_jobs_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/fetch_sync_jobs_api_logic.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { ConnectorSyncJob } from '../../../../../common/types/connectors'; +import { ConnectorSyncJob } from '@kbn/search-connectors'; + import { Paginate } from '../../../../../common/types/pagination'; import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/get_default_pipeline_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/get_default_pipeline_api_logic.ts index eddc2f2ced2d5..288a9d17d179f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/get_default_pipeline_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/get_default_pipeline_api_logic.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { IngestPipelineParams } from '../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_configuration_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_configuration_api_logic.ts index 72510ea9fc1d3..5721addbc034f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_configuration_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_configuration_api_logic.ts @@ -7,7 +7,8 @@ import { i18n } from '@kbn/i18n'; -import { ConnectorConfiguration } from '../../../../../common/types/connectors'; +import { ConnectorConfiguration } from '@kbn/search-connectors'; + import { Actions, createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_filtering_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_filtering_api_logic.ts index 023d06b8f957b..00d300c32e058 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_filtering_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_filtering_api_logic.ts @@ -7,7 +7,8 @@ import { i18n } from '@kbn/i18n'; -import { FilteringRule, FilteringRules } from '../../../../../common/types/connectors'; +import { FilteringRule, FilteringRules } from '@kbn/search-connectors'; + import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_filtering_draft_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_filtering_draft_api_logic.ts index f380af36e849e..245899192726a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_filtering_draft_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_filtering_draft_api_logic.ts @@ -7,7 +7,8 @@ import { i18n } from '@kbn/i18n'; -import { FilteringRule, FilteringRules } from '../../../../../common/types/connectors'; +import { FilteringRule, FilteringRules } from '@kbn/search-connectors'; + import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_name_and_description_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_name_and_description_api_logic.ts index 88d2c19a59eb0..2fc296d31c247 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_name_and_description_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_name_and_description_api_logic.ts @@ -7,7 +7,8 @@ import { i18n } from '@kbn/i18n'; -import { Connector } from '../../../../../common/types/connectors'; +import { Connector } from '@kbn/search-connectors'; + import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_scheduling_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_scheduling_api_logic.ts index c2ffaa647614f..00dce404e322d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_scheduling_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_connector_scheduling_api_logic.ts @@ -7,7 +7,8 @@ import { i18n } from '@kbn/i18n'; -import { SchedulingConfiguraton } from '../../../../../common/types/connectors'; +import { SchedulingConfiguraton } from '@kbn/search-connectors'; + import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_default_pipeline_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_default_pipeline_api_logic.ts index 81cfeadf8e39a..61b127d7ddc11 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_default_pipeline_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_default_pipeline_api_logic.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; -import { IngestPipelineParams } from '../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_pipeline_api_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_pipeline_api_logic.ts index 496b50fce7444..f9ec661fa8df2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_pipeline_api_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/connector/update_pipeline_api_logic.ts @@ -7,7 +7,8 @@ import { i18n } from '@kbn/i18n'; -import { IngestPipelineParams } from '../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/fetch_index_pipeline_parameters.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/fetch_index_pipeline_parameters.ts index 901a40e5c9e23..94be9aade7801 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/fetch_index_pipeline_parameters.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/api/pipelines/fetch_index_pipeline_parameters.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { IngestPipelineParams } from '../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { Actions, createApiLogic } from '../../../shared/api_logic/create_api_logic'; import { HttpLogic } from '../../../shared/http'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/curl_request/curl_request.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/curl_request/curl_request.tsx index a645a60fb67fb..3061ba03e4556 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/curl_request/curl_request.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/components/curl_request/curl_request.tsx @@ -9,7 +9,8 @@ import React from 'react'; import { EuiCodeBlock } from '@elastic/eui'; -import { IngestPipelineParams } from '../../../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { useCloudDetails } from '../../../../../shared/cloud_details/cloud_details'; interface CurlRequestParams { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration.tsx index 0667451d8e761..90777ddfdb963 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration.tsx @@ -26,7 +26,8 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { ConnectorStatus } from '../../../../../../common/types/connectors'; +import { ConnectorStatus } from '@kbn/search-connectors'; + import { BetaConnectorCallout } from '../../../../shared/beta/beta_connector_callout'; import { useCloudDetails } from '../../../../shared/cloud_details/cloud_details'; import { docLinks } from '../../../../shared/doc_links'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_field.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_field.tsx index a5c7a5b217353..2408d58e4c5f2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_field.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_field.tsx @@ -25,8 +25,9 @@ import { import { i18n } from '@kbn/i18n'; +import { DisplayType } from '@kbn/search-connectors'; + import { Status } from '../../../../../../common/types/api'; -import { DisplayType } from '../../../../../../common/types/connectors'; import { LicensingLogic } from '../../../../shared/licensing'; import { ConnectorConfigurationApiLogic } from '../../../api/connector/update_connector_configuration_api_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_form_items.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_form_items.tsx index 68907850bd7a8..2aa2236b51e89 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_form_items.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_form_items.tsx @@ -11,7 +11,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiIcon, EuiPanel, EuiToolTip } import { i18n } from '@kbn/i18n'; -import { DisplayType } from '../../../../../../common/types/connectors'; +import { DisplayType } from '@kbn/search-connectors'; import { ConnectorConfigurationField } from './connector_configuration_field'; import { ConfigEntryView } from './connector_configuration_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_logic.test.ts index d38a58c8940d7..60cc58c1db395 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_logic.test.ts @@ -8,7 +8,7 @@ import { LogicMounter } from '../../../../__mocks__/kea_logic'; import { connectorIndex } from '../../../__mocks__/view_index.mock'; -import { ConnectorStatus, DisplayType, FieldType } from '../../../../../../common/types/connectors'; +import { ConnectorStatus, DisplayType, FieldType } from '@kbn/search-connectors'; import { ConnectorConfigurationApiLogic } from '../../../api/connector/update_connector_configuration_api_logic'; import { CachedFetchIndexApiLogic } from '../../../api/index/cached_fetch_index_api_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_logic.ts index fd13c0d55236c..9f82f4b539344 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_configuration_logic.ts @@ -9,14 +9,15 @@ import { kea, MakeLogicType } from 'kea'; import { i18n } from '@kbn/i18n'; -import { isCategoryEntry } from '../../../../../../common/connectors/is_category_entry'; import { ConnectorConfigProperties, ConnectorConfiguration, ConnectorStatus, Dependency, FieldType, -} from '../../../../../../common/types/connectors'; +} from '@kbn/search-connectors'; + +import { isCategoryEntry } from '../../../../../../common/connectors/is_category_entry'; import { isNotNullish } from '../../../../../../common/utils/is_not_nullish'; import { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_name_and_description/connector_name_and_description_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_name_and_description/connector_name_and_description_logic.ts index a2869f5a90963..f6cc74d20eb19 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_name_and_description/connector_name_and_description_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_name_and_description/connector_name_and_description_logic.ts @@ -7,7 +7,8 @@ import { kea, MakeLogicType } from 'kea'; -import { Connector } from '../../../../../../../common/types/connectors'; +import { Connector } from '@kbn/search-connectors'; + import { Actions } from '../../../../../shared/api_logic/create_api_logic'; import { ConnectorNameAndDescriptionApiLogic, diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling.tsx index 927f26e195f34..5ade2c11a8b55 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { ConnectorStatus, SyncJobType } from '../../../../../../common/types/connectors'; +import { ConnectorStatus, SyncJobType } from '@kbn/search-connectors'; import { generateEncodedPath } from '../../../../shared/encode_path_params'; import { KibanaLogic } from '../../../../shared/kibana'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/connector_cron_editor.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/connector_cron_editor.tsx index 9c38bdea220ca..c15a2ddefa5d6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/connector_cron_editor.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/connector_cron_editor.tsx @@ -13,8 +13,9 @@ import { EuiFlexItem, EuiFlexGroup, EuiButton, EuiButtonEmpty } from '@elastic/e import { i18n } from '@kbn/i18n'; +import { ConnectorScheduling, SyncJobType } from '@kbn/search-connectors'; + import { Status } from '../../../../../../../common/types/api'; -import { ConnectorScheduling, SyncJobType } from '../../../../../../../common/types/connectors'; import { CronEditor } from '../../../../../shared/cron_editor'; import { Frequency } from '../../../../../shared/cron_editor/types'; import { UpdateConnectorSchedulingApiLogic } from '../../../../api/connector/update_connector_scheduling_api_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/full_content.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/full_content.tsx index 3fbe4ef8859f2..2031fc1154dec 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/full_content.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/full_content.tsx @@ -23,7 +23,7 @@ import { import { i18n } from '@kbn/i18n'; -import { SyncJobType } from '../../../../../../../common/types/connectors'; +import { SyncJobType } from '@kbn/search-connectors'; import { ConnectorViewIndex, CrawlerViewIndex } from '../../../../types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling_logic.test.ts index 636035aa2ac83..c00392b24b3e3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling_logic.test.ts @@ -7,7 +7,7 @@ import { LogicMounter } from '../../../../__mocks__/kea_logic'; -import { SyncJobType } from '../../../../../../common/types/connectors'; +import { SyncJobType } from '@kbn/search-connectors'; import { ConnectorSchedulingLogic } from './connector_scheduling_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling_logic.ts index fdab8b7c59aef..5688b879b0d28 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling_logic.ts @@ -7,7 +7,8 @@ import { kea, MakeLogicType } from 'kea'; -import { ConnectorScheduling, SyncJobType } from '../../../../../../common/types/connectors'; +import { ConnectorScheduling, SyncJobType } from '@kbn/search-connectors'; + import { Actions } from '../../../../shared/api_logic/create_api_logic'; import { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/constants.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/constants.ts index 64b4dad084d96..16ec910581086 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/constants.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/constants.ts @@ -7,7 +7,7 @@ import dedent from 'dedent'; -import { CONNECTOR_DEFINITIONS } from '../../../../../../common/connectors/connectors'; +import { CONNECTOR_DEFINITIONS } from '@kbn/search-connectors'; import { docLinks } from '../../../../shared/doc_links'; import { CONNECTOR_ICONS } from '../../../../shared/icons/connector_icons'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/native_connector_configuration/native_connector_configuration_config.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/native_connector_configuration/native_connector_configuration_config.tsx index 53a6166ad34e5..0c4fa42a3fedb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/native_connector_configuration/native_connector_configuration_config.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/native_connector_configuration/native_connector_configuration_config.tsx @@ -11,7 +11,7 @@ import { EuiSpacer, EuiLink, EuiText, EuiFlexGroup, EuiFlexItem, EuiCallOut } fr import { i18n } from '@kbn/i18n'; -import { ConnectorStatus } from '../../../../../../../common/types/connectors'; +import { ConnectorStatus } from '@kbn/search-connectors'; import { docLinks } from '../../../../../shared/doc_links'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/connector_filtering_logic.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/connector_filtering_logic.tsx index 13db854fa79e9..4dfea2cde5895 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/connector_filtering_logic.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/connector_filtering_logic.tsx @@ -9,8 +9,6 @@ import { kea, MakeLogicType } from 'kea'; import { isEqual } from 'lodash'; -import { Status } from '../../../../../../../common/types/api'; - import { FilteringConfig, FilteringPolicy, @@ -18,7 +16,10 @@ import { FilteringRuleRule, FilteringValidation, FilteringValidationState, -} from '../../../../../../../common/types/connectors'; +} from '@kbn/search-connectors'; + +import { Status } from '../../../../../../../common/types/api'; + import { Actions } from '../../../../../shared/api_logic/create_api_logic'; import { clearFlashMessages } from '../../../../../shared/flash_messages'; import { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/edit_sync_rules_flyout.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/edit_sync_rules_flyout.tsx index e675b7a149d3b..779c3ec9e8bee 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/edit_sync_rules_flyout.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/edit_sync_rules_flyout.tsx @@ -23,7 +23,8 @@ import { import { i18n } from '@kbn/i18n'; -import { FilteringValidation } from '../../../../../../../common/types/connectors'; +import { FilteringValidation } from '@kbn/search-connectors'; + import { BetaCallOut } from '../../../../../shared/beta/beta_callout'; import { AdvancedSyncRules } from './advanced_sync_rules'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/editable_basic_rules_table.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/editable_basic_rules_table.tsx index b153c6b345431..5e56d34043a04 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/editable_basic_rules_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/editable_basic_rules_table.tsx @@ -23,11 +23,8 @@ import { import { i18n } from '@kbn/i18n'; -import { - FilteringPolicy, - FilteringRule, - FilteringRuleRule, -} from '../../../../../../../common/types/connectors'; +import { FilteringPolicy, FilteringRule, FilteringRuleRule } from '@kbn/search-connectors'; + import { docLinks } from '../../../../../shared/doc_links'; import { InlineEditableTable } from '../../../../../shared/tables/inline_editable_table/inline_editable_table'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/sync_rules_callouts.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/sync_rules_callouts.tsx index fe28ea499964e..16c85e24c5a3a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/sync_rules_callouts.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/sync_rules/sync_rules_callouts.tsx @@ -11,7 +11,7 @@ import { EuiButton, EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } f import { i18n } from '@kbn/i18n'; -import { FilteringValidationState } from '../../../../../../../common/types/connectors'; +import { FilteringValidationState } from '@kbn/search-connectors'; interface FilteringStatusCalloutsProps { applyDraft: () => void; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/types.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/types.ts index a09a37ad1e93b..bab243892a146 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ConnectorServerSideDefinition } from '../../../../../../common/connectors/connectors'; +import { ConnectorServerSideDefinition } from '@kbn/search-connectors'; export interface ConnectorClientSideDefinition { docsUrl?: string; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/automatic_crawl_scheduler/automatic_crawl_scheduler_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/automatic_crawl_scheduler/automatic_crawl_scheduler_logic.ts index 12d00d64c1056..d7e64f9ea1550 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/automatic_crawl_scheduler/automatic_crawl_scheduler_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/automatic_crawl_scheduler/automatic_crawl_scheduler_logic.ts @@ -7,7 +7,7 @@ import { kea, MakeLogicType } from 'kea'; -import { ConnectorScheduling } from '../../../../../../../common/types/connectors'; +import { ConnectorScheduling } from '@kbn/search-connectors'; import { CrawlerIndex } from '../../../../../../../common/types/indices'; import { Actions } from '../../../../../shared/api_logic/create_api_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawl_custom_settings_flyout/crawl_custom_settings_flyout_crawl_scheduler.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawl_custom_settings_flyout/crawl_custom_settings_flyout_crawl_scheduler.tsx index 53daad3dc6d80..7cda2cb4702e3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawl_custom_settings_flyout/crawl_custom_settings_flyout_crawl_scheduler.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawl_custom_settings_flyout/crawl_custom_settings_flyout_crawl_scheduler.tsx @@ -22,7 +22,8 @@ import { import { i18n } from '@kbn/i18n'; -import { ConnectorScheduling } from '../../../../../../../common/types/connectors'; +import { ConnectorScheduling } from '@kbn/search-connectors'; + import { CrawlerIndex } from '../../../../../../../common/types/indices'; import { EnterpriseSearchCronEditor } from '../../../../../shared/cron_editor/enterprise_search_cron_editor'; import { docLinks } from '../../../../../shared/doc_links/doc_links'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawl_custom_settings_flyout/crawl_custom_settings_flyout_multi_crawl_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawl_custom_settings_flyout/crawl_custom_settings_flyout_multi_crawl_logic.ts index aa98f838a8e18..1266c143ba51f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawl_custom_settings_flyout/crawl_custom_settings_flyout_multi_crawl_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawl_custom_settings_flyout/crawl_custom_settings_flyout_multi_crawl_logic.ts @@ -7,7 +7,8 @@ import { kea, MakeLogicType } from 'kea'; -import { ConnectorScheduling } from '../../../../../../../common/types/connectors'; +import { ConnectorScheduling } from '@kbn/search-connectors'; + import { CrawlerCustomSchedulesServer } from '../../../../../../../common/types/crawler'; import { CrawlerIndex } from '../../../../../../../common/types/indices'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawler_configuration/crawler_configuration_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawler_configuration/crawler_configuration_logic.ts index 9298ca3b32585..2bf7d4646d8d6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawler_configuration/crawler_configuration_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/crawler/crawler_configuration/crawler_configuration_logic.ts @@ -7,8 +7,9 @@ import { kea, MakeLogicType } from 'kea'; +import { Connector } from '@kbn/search-connectors'; + import { Status } from '../../../../../../../common/types/api'; -import { Connector } from '../../../../../../../common/types/connectors'; import { UpdateHtmlExtractionActions, diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.test.ts index 4bdcf6270f19e..65f61fd0d48ad 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.test.ts @@ -12,11 +12,11 @@ import { } from '../../../__mocks__/kea_logic'; import { apiIndex, connectorIndex, crawlerIndex } from '../../__mocks__/view_index.mock'; +import { SyncStatus } from '@kbn/search-connectors'; import { nextTick } from '@kbn/test-jest-helpers'; import { Status } from '../../../../../common/types/api'; -import { SyncStatus } from '../../../../../common/types/connectors'; import { StartSyncApiLogic } from '../../api/connector/start_sync_api_logic'; import { CachedFetchIndexApiLogic } from '../../api/index/cached_fetch_index_api_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.ts index 7605910777dcc..f939b3b3dea63 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.ts @@ -9,13 +9,9 @@ import { kea, MakeLogicType } from 'kea'; import { i18n } from '@kbn/i18n'; +import { Connector, FeatureName, IngestPipelineParams, SyncStatus } from '@kbn/search-connectors'; + import { Status } from '../../../../../common/types/api'; -import { - Connector, - FeatureName, - IngestPipelineParams, - SyncStatus, -} from '../../../../../common/types/connectors'; import { Actions } from '../../../shared/api_logic/create_api_logic'; import { flashSuccessToast } from '../../../shared/flash_messages'; import { KibanaLogic } from '../../../shared/kibana'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/overview.logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/overview.logic.ts index dbe0610b4a855..ced2cc0d98099 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/overview.logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/overview.logic.ts @@ -7,9 +7,10 @@ import { kea, MakeLogicType } from 'kea'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { DEFAULT_PIPELINE_VALUES } from '../../../../../common/constants'; import { Status } from '../../../../../common/types/api'; -import { IngestPipelineParams } from '../../../../../common/types/connectors'; import { KibanaLogic } from '../../../shared/kibana'; import { GenerateApiKeyLogic } from '../../api/generate_api_key/generate_api_key_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipelines/default_pipeline_item.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipelines/default_pipeline_item.tsx index 087ceda6a8d9d..a0e9e0949bc0c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipelines/default_pipeline_item.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipelines/default_pipeline_item.tsx @@ -18,7 +18,8 @@ import { import { i18n } from '@kbn/i18n'; -import { IngestPipelineParams } from '../../../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { ElasticsearchIndexWithIngestion } from '../../../../../../../common/types/indices'; import { isApiIndex } from '../../../../utils/indices'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipelines/ingest_pipeline_flyout.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipelines/ingest_pipeline_flyout.tsx index 1dcffe443855e..e5e3d2a030615 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipelines/ingest_pipeline_flyout.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ingest_pipelines/ingest_pipeline_flyout.tsx @@ -28,7 +28,8 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { IngestPipelineParams } from '../../../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { docLinks } from '../../../../../shared/doc_links'; import { CurlRequest } from '../../components/curl_request/curl_request'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipeline_settings_form.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipeline_settings_form.tsx index 96566f60972ab..140d88a6e9740 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipeline_settings_form.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipeline_settings_form.tsx @@ -10,7 +10,8 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { IngestPipelineParams } from '../../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { SettingsCheckableCard } from '../../shared/settings_checkable_card/settings_checkable_card'; interface PipelineSettingsFormProps { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_logic.ts index bf71dc215243f..ccb86f1a7ecb2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/pipelines_logic.ts @@ -11,10 +11,11 @@ import { IngestPipeline } from '@elastic/elasticsearch/lib/api/types'; import { i18n } from '@kbn/i18n'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { DEFAULT_PIPELINE_VALUES } from '../../../../../../common/constants'; import { HttpError } from '../../../../../../common/types/api'; -import { IngestPipelineParams } from '../../../../../../common/types/connectors'; import { ElasticsearchIndexWithIngestion } from '../../../../../../common/types/indices'; import { InferencePipeline } from '../../../../../../common/types/pipelines'; import { Actions } from '../../../../shared/api_logic/create_api_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/events_panel.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/events_panel.test.tsx index 85c65f78a93f6..907072a720210 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/events_panel.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/events_panel.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { TriggerMethod } from '../../../../../../common/types/connectors'; +import { TriggerMethod } from '@kbn/search-connectors'; import { SyncJobEventsPanel } from './events_panel'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/events_panel.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/events_panel.tsx index 00c67249523c3..04134c791a229 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/events_panel.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/events_panel.tsx @@ -13,7 +13,8 @@ import { EuiBasicTable, EuiBasicTableColumn } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { TriggerMethod } from '../../../../../../common/types/connectors'; +import { TriggerMethod } from '@kbn/search-connectors'; + import { FormattedDateTime } from '../../../../shared/formatted_date_time'; import { FlyoutPanel } from './flyout_panel'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/filtering_panel.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/filtering_panel.test.tsx index 007a3b60b7900..14a46c8373ad9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/filtering_panel.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/filtering_panel.test.tsx @@ -9,11 +9,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { - FilteringPolicy, - FilteringRule, - FilteringRuleRule, -} from '../../../../../../common/types/connectors'; +import { FilteringPolicy, FilteringRule, FilteringRuleRule } from '@kbn/search-connectors'; import { FilteringPanel } from './filtering_panel'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/filtering_panel.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/filtering_panel.tsx index f5807525dbabe..8f5dee105df4e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/filtering_panel.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/filtering_panel.tsx @@ -11,7 +11,7 @@ import { EuiCodeBlock, EuiPanel, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { FilteringRule, FilteringRules } from '../../../../../../common/types/connectors'; +import { FilteringRule, FilteringRules } from '@kbn/search-connectors'; import { FilteringRulesTable } from '../../shared/filtering_rules_table/filtering_rules_table'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/pipeline_panel.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/pipeline_panel.tsx index 191961ad0b21b..f0a3d3945df71 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/pipeline_panel.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/pipeline_panel.tsx @@ -11,7 +11,7 @@ import { EuiBasicTable, EuiBasicTableColumn } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { IngestPipelineParams } from '../../../../../../common/types/connectors'; +import { IngestPipelineParams } from '@kbn/search-connectors'; import { FlyoutPanel } from './flyout_panel'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_callouts.test.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_callouts.test.tsx index 03e0e4b17e51a..f57b45dee7abc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_callouts.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_callouts.test.tsx @@ -11,7 +11,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { SyncStatus, TriggerMethod } from '../../../../../../common/types/connectors'; +import { SyncStatus, TriggerMethod } from '@kbn/search-connectors'; import { SyncJobCallouts } from './sync_callouts'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_callouts.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_callouts.tsx index 461132980c66b..7c8a26617f2a8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_callouts.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_callouts.tsx @@ -13,7 +13,8 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { SyncStatus, TriggerMethod } from '../../../../../../common/types/connectors'; +import { SyncStatus, TriggerMethod } from '@kbn/search-connectors'; + import { FormattedDateTime } from '../../../../shared/formatted_date_time'; import { durationToText } from '../../../utils/duration_to_text'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_history_table.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_history_table.tsx index 84fd9a30436d3..c659320614c6c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_history_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_history_table.tsx @@ -13,7 +13,8 @@ import { EuiBadge, EuiBasicTable, EuiBasicTableColumn } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { SyncJobType, SyncStatus } from '../../../../../../common/types/connectors'; +import { SyncJobType, SyncStatus } from '@kbn/search-connectors'; + import { FormattedDateTime } from '../../../../shared/formatted_date_time'; import { pageToPagination } from '../../../../shared/pagination/page_to_pagination'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_view_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_view_logic.test.ts index d5f21cc46b273..7ccc28de37772 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_view_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_view_logic.test.ts @@ -9,16 +9,11 @@ import { LogicMounter, mockFlashMessageHelpers } from '../../../../__mocks__/kea import moment from 'moment'; +import { ConnectorSyncJob, SyncJobType, SyncStatus, TriggerMethod } from '@kbn/search-connectors'; import { nextTick } from '@kbn/test-jest-helpers'; import { HttpError, Status } from '../../../../../../common/types/api'; -import { - ConnectorSyncJob, - SyncJobType, - SyncStatus, - TriggerMethod, -} from '../../../../../../common/types/connectors'; import { FetchSyncJobsApiLogic } from '../../../api/connector/fetch_sync_jobs_api_logic'; import { IndexViewLogic } from '../index_view_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_view_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_view_logic.ts index cd17eb9a931d6..900b3a8360728 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_view_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/sync_jobs/sync_jobs_view_logic.ts @@ -9,9 +9,10 @@ import { kea, MakeLogicType } from 'kea'; import moment from 'moment'; +import { ConnectorSyncJob } from '@kbn/search-connectors'; + import { Status } from '../../../../../../common/types/api'; -import { ConnectorSyncJob } from '../../../../../../common/types/connectors'; import { Page, Paginate } from '../../../../../../common/types/pagination'; import { Actions } from '../../../../shared/api_logic/create_api_logic'; import { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_indices/indices_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_indices/indices_logic.test.ts index 8455b563b4022..de14705f2b234 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_indices/indices_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_indices/indices_logic.test.ts @@ -11,12 +11,11 @@ import { connectorIndex, elasticsearchViewIndices } from '../../__mocks__/view_i import moment from 'moment'; +import { ConnectorStatus, SyncStatus } from '@kbn/search-connectors'; import { nextTick } from '@kbn/test-jest-helpers'; import { HttpError, Status } from '../../../../../common/types/api'; -import { ConnectorStatus, SyncStatus } from '../../../../../common/types/connectors'; - import { FetchIndicesAPILogic } from '../../api/index/fetch_indices_api_logic'; import { IngestionMethod, IngestionStatus } from '../../types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_indices/indices_table.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_indices/indices_table.tsx index aee36cda0b348..244e4a48eca54 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_indices/indices_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_indices/indices_table.tsx @@ -19,7 +19,7 @@ import { import { i18n } from '@kbn/i18n'; -import { NATIVE_CONNECTOR_DEFINITIONS } from '../../../../../common/connectors/native_connectors'; +import { NATIVE_CONNECTOR_DEFINITIONS } from '@kbn/search-connectors'; import { Meta } from '../../../../../common/types/pagination'; import { healthColorsMap } from '../../../shared/constants/health_colors'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/settings/settings_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/settings/settings_logic.ts index 240ca8e43c15b..43ccf6f47ca39 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/settings/settings_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/settings/settings_logic.ts @@ -9,10 +9,11 @@ import { kea, MakeLogicType } from 'kea'; import { isDeepEqual } from 'react-use/lib/util'; +import { IngestPipelineParams } from '@kbn/search-connectors'; + import { DEFAULT_PIPELINE_VALUES } from '../../../../../common/constants'; import { Status } from '../../../../../common/types/api'; -import { IngestPipelineParams } from '../../../../../common/types/connectors'; import { Actions } from '../../../shared/api_logic/create_api_logic'; import { KibanaLogic } from '../../../shared/kibana'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/shared/filtering_rules_table/filtering_rules_table.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/shared/filtering_rules_table/filtering_rules_table.tsx index fc31f7892261d..763664329b19c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/shared/filtering_rules_table/filtering_rules_table.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/shared/filtering_rules_table/filtering_rules_table.tsx @@ -11,11 +11,7 @@ import { EuiBasicTable, EuiBasicTableColumn, EuiCode } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { - FilteringRule, - FilteringPolicy, - FilteringRuleRule, -} from '../../../../../../common/types/connectors'; +import { FilteringRule, FilteringPolicy, FilteringRuleRule } from '@kbn/search-connectors'; import { filteringPolicyToText, filteringRuleToText } from '../../../utils/filtering_rule_helpers'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/filtering_rule_helpers.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/filtering_rule_helpers.ts index 44d832a0ef51d..b04dd1b37bf4a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/filtering_rule_helpers.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/filtering_rule_helpers.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; -import { FilteringPolicy, FilteringRuleRule } from '../../../../common/types/connectors'; +import { FilteringPolicy, FilteringRuleRule } from '@kbn/search-connectors'; const filteringRuleStringMap: Record = { [FilteringRuleRule.CONTAINS]: i18n.translate( diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/has_configured_configuration.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/has_configured_configuration.ts index b9cadd80181b8..6b6d8a53b2c30 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/has_configured_configuration.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/has_configured_configuration.ts @@ -5,8 +5,9 @@ * 2.0. */ +import { ConnectorConfiguration } from '@kbn/search-connectors'; + import { isConfigEntry } from '../../../../common/connectors/is_category_entry'; -import { ConnectorConfiguration } from '../../../../common/types/connectors'; export const hasConfiguredConfiguration = (configuration: ConnectorConfiguration) => { return !Object.entries(configuration).find( diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.test.ts index e5e4273555b55..13e3482064ff6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.test.ts @@ -9,7 +9,8 @@ import { connectorIndex, crawlerIndex, apiIndex } from '../__mocks__/view_index. import moment from 'moment'; -import { ConnectorStatus, SyncStatus } from '../../../../common/types/connectors'; +import { ConnectorStatus, SyncStatus } from '@kbn/search-connectors'; + import { IngestionMethod, IngestionStatus } from '../types'; import { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.ts index e420ab0cf8dcf..2323b1b22cf5f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/indices.ts @@ -9,8 +9,9 @@ import moment from 'moment'; import { i18n } from '@kbn/i18n'; +import { SyncStatus, ConnectorStatus } from '@kbn/search-connectors'; + import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; -import { SyncStatus, ConnectorStatus } from '../../../../common/types/connectors'; import { ConnectorIndex, CrawlerIndex, diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/sync_status_to_text.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/sync_status_to_text.test.ts index 4272eaf11641e..5f11fabe1bc48 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/sync_status_to_text.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/sync_status_to_text.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SyncStatus } from '../../../../common/types/connectors'; +import { SyncStatus } from '@kbn/search-connectors'; import { syncStatusToColor, syncStatusToText } from './sync_status_to_text'; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/sync_status_to_text.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/sync_status_to_text.ts index 6868fba40e59f..83b3245999dfc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/sync_status_to_text.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/utils/sync_status_to_text.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; -import { SyncJobType, SyncStatus } from '../../../../common/types/connectors'; +import { SyncJobType, SyncStatus } from '@kbn/search-connectors'; export function syncStatusToText(status: SyncStatus): string { switch (status) { diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/enterprise_search_cron_editor.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/enterprise_search_cron_editor.tsx index 7b915f08c5df9..f31b26cd76e85 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/enterprise_search_cron_editor.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/enterprise_search_cron_editor.tsx @@ -9,7 +9,7 @@ import React, { useState } from 'react'; import { Frequency } from '@kbn/es-ui-shared-plugin/public/components/cron_editor/types'; -import { ConnectorScheduling } from '../../../../common/types/connectors'; +import { ConnectorScheduling } from '@kbn/search-connectors'; import { CronEditor } from './cron_editor'; diff --git a/x-pack/plugins/enterprise_search/server/api/connectors_service.ts b/x-pack/plugins/enterprise_search/server/api/connectors_service.ts deleted file mode 100644 index f13f02cb50796..0000000000000 --- a/x-pack/plugins/enterprise_search/server/api/connectors_service.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 { IClusterClient } from '@kbn/core-elasticsearch-server'; -import { HttpServiceStart, KibanaRequest } from '@kbn/core-http-server'; - -import { CONNECTOR_DEFINITIONS } from '../../common/connectors/connectors'; - -import { Connector, IngestPipelineParams } from '../../common/types/connectors'; - -import { addConnector } from '../lib/connectors/add_connector'; -import { fetchConnectors } from '../lib/connectors/fetch_connectors'; - -export class ConnectorsService { - private readonly clusterClient: IClusterClient; - private readonly http: HttpServiceStart; - - constructor({ clusterClient, http }: { clusterClient: IClusterClient; http: HttpServiceStart }) { - this.clusterClient = clusterClient; - this.http = http; - } - - async createConnector( - request: KibanaRequest, - input: { - indexName: string | null; - isNative: boolean; - language: string | null; - pipeline?: IngestPipelineParams | null; - serviceType: string | null; - } - ): Promise { - return await addConnector(this.clusterClient.asScoped(request), input); - } - - getConnectorTypes() { - return CONNECTOR_DEFINITIONS.map((connector) => ({ - ...connector, - iconPath: connector.iconPath - ? this.http.basePath.prepend( - `/plugins/enterpriseSearch/assets/source_icons/${connector.iconPath}` - ) - : 'logoEnterpriseSearch', - })); - } - - async getConnectors(request: KibanaRequest): Promise { - return await fetchConnectors(this.clusterClient.asScoped(request)); - } -} diff --git a/x-pack/plugins/enterprise_search/server/index.ts b/x-pack/plugins/enterprise_search/server/index.ts index e7df036ada1a4..a82d6f18a3b26 100644 --- a/x-pack/plugins/enterprise_search/server/index.ts +++ b/x-pack/plugins/enterprise_search/server/index.ts @@ -52,11 +52,7 @@ export const config: PluginConfigDescriptor = { }, schema: configSchema, }; -export const CONNECTORS_INDEX = '.elastic-connectors'; -export const CURRENT_CONNECTORS_INDEX = '.elastic-connectors-v1'; -export const CONNECTORS_JOBS_INDEX = '.elastic-connectors-sync-jobs'; -export const CURRENT_CONNECTORS_JOB_INDEX = '.elastic-connectors-sync-jobs-v1'; -export const CONNECTORS_VERSION = 1; + export const CRAWLERS_INDEX = '.ent-search-actastic-crawler2_configurations_v2'; export type EnterpriseSearchPluginStart = PluginStart; diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/add_connector.test.ts b/x-pack/plugins/enterprise_search/server/lib/connectors/add_connector.test.ts index fe18dbccda2d8..cd15faf6b90c1 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/add_connector.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/connectors/add_connector.test.ts @@ -7,19 +7,24 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CURRENT_CONNECTORS_INDEX } from '../..'; -import { ConnectorStatus } from '../../../common/types/connectors'; +import { + createConnector, + fetchConnectorByIndexName, + deleteConnectorById, +} from '@kbn/search-connectors'; + import { ErrorCode } from '../../../common/types/error_codes'; import { fetchCrawlerByIndexName } from '../crawler/fetch_crawlers'; import { textAnalysisSettings } from '../indices/text_analysis'; import { addConnector } from './add_connector'; -import { deleteConnectorById } from './delete_connector'; -import { fetchConnectorByIndexName } from './fetch_connectors'; -jest.mock('./fetch_connectors', () => ({ fetchConnectorByIndexName: jest.fn() })); -jest.mock('./delete_connector', () => ({ deleteConnectorById: jest.fn() })); +jest.mock('@kbn/search-connectors', () => ({ + createConnector: jest.fn(), + deleteConnectorById: jest.fn(), + fetchConnectorByIndexName: jest.fn(), +})); jest.mock('../crawler/fetch_crawlers', () => ({ fetchCrawlerByIndexName: jest.fn() })); describe('addConnector lib function', () => { @@ -57,6 +62,10 @@ describe('addConnector lib function', () => { it('should add connector', async () => { mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); + (createConnector as jest.Mock).mockImplementation(() => ({ + id: 'fakeId', + index_name: 'index_name', + })); mockClient.asCurrentUser.indices.exists.mockImplementation(() => false); (fetchConnectorByIndexName as jest.Mock).mockImplementation(() => undefined); (fetchCrawlerByIndexName as jest.Mock).mockImplementation(() => undefined); @@ -69,95 +78,17 @@ describe('addConnector lib function', () => { language: 'fr', }) ).resolves.toEqual(expect.objectContaining({ id: 'fakeId', index_name: 'index_name' })); - expect(mockClient.asCurrentUser.index).toHaveBeenCalledWith({ - document: { - api_key_id: null, - configuration: {}, - custom_scheduling: {}, - description: null, - error: null, - features: null, - filtering: [ - { - active: { - advanced_snippet: { - created_at: expect.any(String), - updated_at: expect.any(String), - value: {}, - }, - rules: [ - { - created_at: expect.any(String), - field: '_', - id: 'DEFAULT', - order: 0, - policy: 'include', - rule: 'regex', - updated_at: expect.any(String), - value: '.*', - }, - ], - validation: { - errors: [], - state: 'valid', - }, - }, - domain: 'DEFAULT', - draft: { - advanced_snippet: { - created_at: expect.any(String), - updated_at: expect.any(String), - value: {}, - }, - rules: [ - { - created_at: expect.any(String), - field: '_', - id: 'DEFAULT', - order: 0, - policy: 'include', - rule: 'regex', - updated_at: expect.any(String), - value: '.*', - }, - ], - validation: { - errors: [], - state: 'valid', - }, - }, - }, - ], - index_name: 'index_name', - is_native: false, - language: 'fr', - last_access_control_sync_error: null, - last_access_control_sync_scheduled_at: null, - last_access_control_sync_status: null, - last_incremental_sync_scheduled_at: null, - last_seen: null, - last_sync_error: null, - last_sync_scheduled_at: null, - last_sync_status: null, - last_synced: null, - name: 'index_name', - pipeline: { - extract_binary_content: true, - name: 'ent-search-generic-ingestion', - reduce_whitespace: true, - run_ml_inference: false, - }, - scheduling: { - access_control: { enabled: false, interval: '0 0 0 * * ?' }, - full: { enabled: false, interval: '0 0 0 * * ?' }, - incremental: { enabled: false, interval: '0 0 0 * * ?' }, - }, - service_type: null, - status: ConnectorStatus.CREATED, - sync_now: false, + expect(createConnector).toHaveBeenCalledWith(mockClient.asCurrentUser, { + indexName: 'index_name', + isNative: false, + language: 'fr', + name: 'index_name', + pipeline: { + extract_binary_content: true, + name: 'ent-search-generic-ingestion', + reduce_whitespace: true, + run_ml_inference: false, }, - index: CURRENT_CONNECTORS_INDEX, - refresh: 'wait_for', }); expect(mockClient.asCurrentUser.indices.create).toHaveBeenCalledWith({ index: 'index_name', @@ -168,6 +99,10 @@ describe('addConnector lib function', () => { it('should reject if index already exists', async () => { mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); + (createConnector as jest.Mock).mockImplementation(() => ({ + id: 'fakeId', + index_name: 'index_name', + })); mockClient.asCurrentUser.indices.exists.mockImplementation(() => true); (fetchConnectorByIndexName as jest.Mock).mockImplementation(() => undefined); (fetchCrawlerByIndexName as jest.Mock).mockImplementation(() => undefined); @@ -202,6 +137,10 @@ describe('addConnector lib function', () => { it('should reject if crawler already exists', async () => { mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); + (createConnector as jest.Mock).mockImplementation(() => ({ + id: 'fakeId', + index_name: 'index_name', + })); mockClient.asCurrentUser.indices.exists.mockImplementation(() => false); (fetchConnectorByIndexName as jest.Mock).mockImplementation(() => undefined); (fetchCrawlerByIndexName as jest.Mock).mockImplementation(() => true); @@ -215,6 +154,7 @@ describe('addConnector lib function', () => { }) ).rejects.toEqual(new Error(ErrorCode.CRAWLER_ALREADY_EXISTS)); expect(mockClient.asCurrentUser.indices.create).not.toHaveBeenCalled(); + expect(createConnector).not.toHaveBeenCalled(); }); it('should reject with index already exists if connector and index already exist', async () => { @@ -232,10 +172,15 @@ describe('addConnector lib function', () => { }) ).rejects.toEqual(new Error(ErrorCode.INDEX_ALREADY_EXISTS)); expect(mockClient.asCurrentUser.indices.create).not.toHaveBeenCalled(); + expect(createConnector).not.toHaveBeenCalled(); }); it('should replace connector if deleteExistingConnector flag is true', async () => { mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); + (createConnector as jest.Mock).mockImplementation(() => ({ + id: 'fakeId', + index_name: 'index_name', + })); mockClient.asCurrentUser.indices.exists.mockImplementation(() => false); (fetchConnectorByIndexName as jest.Mock).mockImplementation(() => ({ id: 'connectorId' })); (fetchCrawlerByIndexName as jest.Mock).mockImplementation(() => undefined); @@ -249,96 +194,19 @@ describe('addConnector lib function', () => { language: null, }) ).resolves.toEqual(expect.objectContaining({ id: 'fakeId', index_name: 'index_name' })); - expect(deleteConnectorById).toHaveBeenCalledWith(mockClient, 'connectorId'); - expect(mockClient.asCurrentUser.index).toHaveBeenCalledWith({ - document: { - api_key_id: null, - configuration: {}, - custom_scheduling: {}, - description: null, - error: null, - features: null, - filtering: [ - { - active: { - advanced_snippet: { - created_at: expect.any(String), - updated_at: expect.any(String), - value: {}, - }, - rules: [ - { - created_at: expect.any(String), - field: '_', - id: 'DEFAULT', - order: 0, - policy: 'include', - rule: 'regex', - updated_at: expect.any(String), - value: '.*', - }, - ], - validation: { - errors: [], - state: 'valid', - }, - }, - domain: 'DEFAULT', - draft: { - advanced_snippet: { - created_at: expect.any(String), - updated_at: expect.any(String), - value: {}, - }, - rules: [ - { - created_at: expect.any(String), - field: '_', - id: 'DEFAULT', - order: 0, - policy: 'include', - rule: 'regex', - updated_at: expect.any(String), - value: '.*', - }, - ], - validation: { - errors: [], - state: 'valid', - }, - }, - }, - ], - index_name: 'index_name', - is_native: true, - language: null, - last_access_control_sync_error: null, - last_access_control_sync_scheduled_at: null, - last_access_control_sync_status: null, - last_incremental_sync_scheduled_at: null, - last_seen: null, - last_sync_error: null, - last_sync_scheduled_at: null, - last_sync_status: null, - last_synced: null, - name: 'index_name', - pipeline: { - extract_binary_content: true, - name: 'ent-search-generic-ingestion', - reduce_whitespace: true, - run_ml_inference: false, - }, - scheduling: { - access_control: { enabled: false, interval: '0 0 0 * * ?' }, - full: { enabled: false, interval: '0 0 0 * * ?' }, - incremental: { enabled: false, interval: '0 0 0 * * ?' }, - }, - service_type: null, - status: ConnectorStatus.CREATED, - sync_now: false, + expect(deleteConnectorById).toHaveBeenCalledWith(mockClient.asCurrentUser, 'connectorId'); + expect(createConnector).toHaveBeenCalledWith(mockClient.asCurrentUser, { + deleteExistingConnector: true, + indexName: 'index_name', + isNative: true, + language: null, + name: 'index_name', + pipeline: { + extract_binary_content: true, + name: 'ent-search-generic-ingestion', + reduce_whitespace: true, + run_ml_inference: false, }, - index: CURRENT_CONNECTORS_INDEX, - refresh: 'wait_for', }); expect(mockClient.asCurrentUser.indices.create).toHaveBeenCalledWith({ index: 'index_name', diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/add_connector.ts b/x-pack/plugins/enterprise_search/server/lib/connectors/add_connector.ts index 891a3e14a2a62..623b2f21c2c05 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/add_connector.ts +++ b/x-pack/plugins/enterprise_search/server/lib/connectors/add_connector.ts @@ -7,30 +7,35 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CURRENT_CONNECTORS_INDEX } from '../..'; import { + createConnector, Connector, - ConnectorDocument, - IngestPipelineParams, -} from '../../../common/types/connectors'; + deleteConnectorById, + ConnectorStatus, +} from '@kbn/search-connectors'; + +import { fetchConnectorByIndexName, NATIVE_CONNECTOR_DEFINITIONS } from '@kbn/search-connectors'; + +import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../common/constants'; + import { ErrorCode } from '../../../common/types/error_codes'; -import { createConnectorDocument } from '../../utils/create_connector_document'; +import { stripSearchPrefix } from '../../../common/utils/strip_search_prefix'; import { fetchCrawlerByIndexName } from '../crawler/fetch_crawlers'; import { createIndex } from '../indices/create_index'; import { getDefaultPipeline } from '../pipelines/get_default_pipeline'; -import { deleteConnectorById } from './delete_connector'; - -import { fetchConnectorByIndexName } from './fetch_connectors'; - -const createConnector = async ( - document: ConnectorDocument, +export const addConnector = async ( client: IScopedClusterClient, - language: string | null, - deleteExisting: boolean + input: { + deleteExistingConnector?: boolean; + indexName: string | null; + isNative: boolean; + language: string | null; + serviceType?: string | null; + } ): Promise => { - const index = document.index_name; + const index = input.indexName; if (index) { const indexExists = await client.asCurrentUser.indices.exists({ index }); if (indexExists) { @@ -39,10 +44,10 @@ const createConnector = async ( } } - const connector = await fetchConnectorByIndexName(client, index); + const connector = await fetchConnectorByIndexName(client.asCurrentUser, index); if (connector) { - if (deleteExisting) { - await deleteConnectorById(client, connector.id); + if (input.deleteExistingConnector) { + await deleteConnectorById(client.asCurrentUser, connector.id); } else { throw new Error(ErrorCode.CONNECTOR_DOCUMENT_ALREADY_EXISTS); } @@ -52,35 +57,35 @@ const createConnector = async ( if (crawler) { throw new Error(ErrorCode.CRAWLER_ALREADY_EXISTS); } - await createIndex(client, index, language, false); + await createIndex(client, index, input.language, false); } - const result = await client.asCurrentUser.index({ - document, - index: CURRENT_CONNECTORS_INDEX, - refresh: 'wait_for', - }); - return { ...document, id: result._id }; -}; + const nativeConnector = + input.isNative && input.serviceType + ? NATIVE_CONNECTOR_DEFINITIONS[input.serviceType] + : undefined; -export const addConnector = async ( - client: IScopedClusterClient, - input: { - deleteExistingConnector?: boolean; - indexName: string | null; - isNative: boolean; - language: string | null; - pipeline?: IngestPipelineParams | null; - serviceType?: string | null; + if ( + input.isNative && + input.serviceType && + !nativeConnector && + input.serviceType !== ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE + ) { + throw new Error(`Could not find connector definition for service type ${input.serviceType}`); } -): Promise => { - const pipeline = input.pipeline || (await getDefaultPipeline(client)); - const document = createConnectorDocument({ + const nativeFields = nativeConnector + ? { + configuration: nativeConnector.configuration, + features: nativeConnector.features, + status: ConnectorStatus.NEEDS_CONFIGURATION, + } + : {}; + + return await createConnector(client.asCurrentUser, { ...input, - pipeline, - serviceType: input.serviceType || null, + name: stripSearchPrefix(input.indexName || ''), + ...nativeFields, + pipeline: await getDefaultPipeline(client), }); - - return await createConnector(document, client, input.language, !!input.deleteExistingConnector); }; diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/delete_connector.ts b/x-pack/plugins/enterprise_search/server/lib/connectors/delete_connector.ts deleted file mode 100644 index cd935f32c2c15..0000000000000 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/delete_connector.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 { IScopedClusterClient } from '@kbn/core/server'; - -import { CONNECTORS_INDEX } from '../..'; - -import { cancelSyncs } from './post_cancel_syncs'; - -export const deleteConnectorById = async (client: IScopedClusterClient, id: string) => { - // timeout function to mitigate race condition with external connector running job and recreating index - const timeout = async () => { - const promise = new Promise((resolve) => setTimeout(resolve, 500)); - return promise; - }; - await Promise.all([cancelSyncs(client, id), timeout]); - return await client.asCurrentUser.delete({ id, index: CONNECTORS_INDEX, refresh: 'wait_for' }); -}; diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connector_index_names.ts b/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connector_index_names.ts deleted file mode 100644 index 7d087f8e74c75..0000000000000 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/fetch_connector_index_names.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 { IScopedClusterClient } from '@kbn/core/server'; -import { isIndexNotFoundException } from '@kbn/core-saved-objects-migration-server-internal'; - -import { CONNECTORS_INDEX } from '../..'; - -export async function fetchConnectorIndexNames(client: IScopedClusterClient): Promise { - try { - const result = await client.asCurrentUser.search({ - _source: false, - fields: [{ field: 'index_name' }], - index: CONNECTORS_INDEX, - size: 10000, - }); - return (result?.hits.hits ?? []).map((field) => field.fields?.index_name[0] ?? ''); - } catch (error) { - if (isIndexNotFoundException(error)) { - return []; - } - throw error; - } -} diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/put_update_native.ts b/x-pack/plugins/enterprise_search/server/lib/connectors/put_update_native.ts deleted file mode 100644 index 6b3039974f8a4..0000000000000 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/put_update_native.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; - -import { CONNECTORS_INDEX } from '../..'; -import { Connector } from '../../../common/types/connectors'; - -export const putUpdateNative = async ( - client: IScopedClusterClient, - connectorId: string, - isNative: boolean -) => { - const result = await client.asCurrentUser.update({ - doc: { - is_native: isNative, - }, - id: connectorId, - index: CONNECTORS_INDEX, - }); - - return result; -}; diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/start_sync.test.ts b/x-pack/plugins/enterprise_search/server/lib/connectors/start_sync.test.ts index 90d82c82aca93..6498d3f4d1a03 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/start_sync.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/connectors/start_sync.test.ts @@ -6,15 +6,19 @@ */ import { IScopedClusterClient } from '@kbn/core/server'; +import { + CONNECTORS_INDEX, + SyncJobType, + SyncStatus, + TriggerMethod, + CURRENT_CONNECTORS_JOB_INDEX, +} from '@kbn/search-connectors'; -import { CONNECTORS_INDEX, CURRENT_CONNECTORS_JOB_INDEX } from '../..'; import { CONNECTORS_ACCESS_CONTROL_INDEX_PREFIX } from '../../../common/constants'; -import { SyncJobType, SyncStatus, TriggerMethod } from '../../../common/types/connectors'; - import { ErrorCode } from '../../../common/types/error_codes'; -import { startConnectorSync } from './start_sync'; +import { startSync } from './start_sync'; describe('startSync lib function', () => { const mockClient = { @@ -31,7 +35,7 @@ describe('startSync lib function', () => { }); it('should start a full sync', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => { + mockClient.asCurrentUser.get.mockImplementation(() => { return Promise.resolve({ _id: 'connectorId', _source: { @@ -61,11 +65,7 @@ describe('startSync lib function', () => { mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); await expect( - startConnectorSync( - mockClient as unknown as IScopedClusterClient, - 'connectorId', - SyncJobType.FULL - ) + startSync(mockClient as unknown as IScopedClusterClient, 'connectorId', SyncJobType.FULL) ).resolves.toEqual({ _id: 'fakeId' }); expect(mockClient.asCurrentUser.index).toHaveBeenCalledWith({ document: { @@ -98,8 +98,8 @@ describe('startSync lib function', () => { index: CURRENT_CONNECTORS_JOB_INDEX, }); }); - it('should start a full sync with service type, pipeline and nextSyncConfig', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => { + it('should start a full sync with service type, pipeline', async () => { + mockClient.asCurrentUser.get.mockImplementation(() => { return Promise.resolve({ _source: { api_key_id: null, @@ -126,12 +126,7 @@ describe('startSync lib function', () => { mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); await expect( - startConnectorSync( - mockClient as unknown as IScopedClusterClient, - 'connectorId', - SyncJobType.FULL, - 'syncConfig' - ) + startSync(mockClient as unknown as IScopedClusterClient, 'connectorId', SyncJobType.FULL) ).resolves.toEqual({ _id: 'fakeId' }); expect(mockClient.asCurrentUser.index).toHaveBeenCalledWith({ document: { @@ -141,7 +136,6 @@ describe('startSync lib function', () => { connector: { configuration: { config: { label: 'label', value: 'haha' }, - nextSyncConfig: { label: 'nextSyncConfig', value: 'syncConfig' }, }, filtering: 'filtering', id: 'connectorId', @@ -169,21 +163,17 @@ describe('startSync lib function', () => { }); it('should not create index if there is no connector', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => { + mockClient.asCurrentUser.get.mockImplementation(() => { return Promise.resolve({}); }); await expect( - startConnectorSync( - mockClient as unknown as IScopedClusterClient, - 'connectorId', - SyncJobType.FULL - ) + startSync(mockClient as unknown as IScopedClusterClient, 'connectorId', SyncJobType.FULL) ).rejects.toEqual(new Error(ErrorCode.RESOURCE_NOT_FOUND)); expect(mockClient.asCurrentUser.index).not.toHaveBeenCalled(); }); it('should set sync_now for crawler and not index a sync job', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => { + mockClient.asCurrentUser.get.mockImplementation(() => { return Promise.resolve({ _primary_term: 1, _seq_no: 10, @@ -212,7 +202,7 @@ describe('startSync lib function', () => { mockClient.asCurrentUser.update.mockImplementation(() => ({ _id: 'fakeId' })); await expect( - startConnectorSync( + startSync( mockClient as unknown as IScopedClusterClient, 'connectorId', SyncJobType.FULL, @@ -236,7 +226,7 @@ describe('startSync lib function', () => { }); it('should start an incremental sync', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => { + mockClient.asCurrentUser.get.mockImplementation(() => { return Promise.resolve({ _id: 'connectorId', _source: { @@ -265,7 +255,7 @@ describe('startSync lib function', () => { mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); await expect( - startConnectorSync( + startSync( mockClient as unknown as IScopedClusterClient, 'connectorId', SyncJobType.INCREMENTAL @@ -304,7 +294,7 @@ describe('startSync lib function', () => { }); it('should start an access control sync', async () => { - mockClient.asCurrentUser.get.mockImplementationOnce(() => { + mockClient.asCurrentUser.get.mockImplementation(() => { return Promise.resolve({ _id: 'connectorId', _source: { @@ -332,7 +322,7 @@ describe('startSync lib function', () => { mockClient.asCurrentUser.index.mockImplementation(() => ({ _id: 'fakeId' })); await expect( - startConnectorSync( + startSync( mockClient as unknown as IScopedClusterClient, 'connectorId', SyncJobType.ACCESS_CONTROL diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/start_sync.ts b/x-pack/plugins/enterprise_search/server/lib/connectors/start_sync.ts index faac79a29c0a7..808fd2fc0d40e 100644 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/start_sync.ts +++ b/x-pack/plugins/enterprise_search/server/lib/connectors/start_sync.ts @@ -7,7 +7,14 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX, CURRENT_CONNECTORS_JOB_INDEX } from '../..'; +import { + ConnectorConfiguration, + ConnectorDocument, + SyncJobType, + CONNECTORS_INDEX, + startConnectorSync, +} from '@kbn/search-connectors'; + import { isConfigEntry } from '../../../common/connectors/is_category_entry'; import { @@ -15,21 +22,14 @@ import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE, } from '../../../common/constants'; -import { - ConnectorConfiguration, - ConnectorDocument, - SyncJobType, - SyncStatus, - TriggerMethod, -} from '../../../common/types/connectors'; import { ErrorCode } from '../../../common/types/error_codes'; import { stripSearchPrefix } from '../../../common/utils/strip_search_prefix'; -export const startConnectorSync = async ( +export const startSync = async ( client: IScopedClusterClient, connectorId: string, jobType: SyncJobType, - nextSyncConfig?: string + nextSyncConfig?: string // only processed for elastic-crawler service types ) => { const connectorResult = await client.asCurrentUser.get({ id: connectorId, @@ -49,9 +49,7 @@ export const startConnectorSync = async ( nextSyncConfig: { label: 'nextSyncConfig', value: nextSyncConfig }, } : config; - const { filtering, index_name, language, pipeline, service_type } = connector; - - const now = new Date().toISOString(); + const { index_name } = connector; if (connector.service_type === ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE) { return await client.asCurrentUser.update({ @@ -70,37 +68,12 @@ export const startConnectorSync = async ( const targetIndexName = jobType === SyncJobType.ACCESS_CONTROL ? `${CONNECTORS_ACCESS_CONTROL_INDEX_PREFIX}${indexNameWithoutSearchPrefix}` - : index_name; + : index_name ?? undefined; - return await client.asCurrentUser.index({ - document: { - cancelation_requested_at: null, - canceled_at: null, - completed_at: null, - connector: { - configuration, - filtering: filtering ? filtering[0]?.active ?? null : null, - id: connectorId, - index_name: targetIndexName, - language, - pipeline: pipeline ?? null, - service_type, - }, - created_at: now, - deleted_document_count: 0, - error: null, - indexed_document_count: 0, - indexed_document_volume: 0, - job_type: jobType, - last_seen: null, - metadata: {}, - started_at: null, - status: SyncStatus.PENDING, - total_document_count: null, - trigger_method: TriggerMethod.ON_DEMAND, - worker_hostname: null, - }, - index: CURRENT_CONNECTORS_JOB_INDEX, + return await startConnectorSync(client.asCurrentUser, { + connectorId, + jobType, + targetIndexName, }); } else { throw new Error(ErrorCode.RESOURCE_NOT_FOUND); diff --git a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_status.ts b/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_status.ts deleted file mode 100644 index caf8bbc7c7ce9..0000000000000 --- a/x-pack/plugins/enterprise_search/server/lib/connectors/update_connector_status.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { IScopedClusterClient } from '@kbn/core/server'; -import { i18n } from '@kbn/i18n'; - -import { CONNECTORS_INDEX } from '../..'; - -import { ConnectorDocument, ConnectorStatus } from '../../../common/types/connectors'; - -export const updateConnectorStatus = async ( - client: IScopedClusterClient, - connectorId: string, - status: ConnectorStatus -) => { - const connectorResult = await client.asCurrentUser.get({ - id: connectorId, - index: CONNECTORS_INDEX, - }); - const connector = connectorResult._source; - if (connector) { - const result = await client.asCurrentUser.index({ - document: { ...connector, status }, - id: connectorId, - index: CONNECTORS_INDEX, - }); - await client.asCurrentUser.indices.refresh({ index: CONNECTORS_INDEX }); - return result; - } else { - throw new Error( - i18n.translate('xpack.enterpriseSearch.server.connectors.serviceType.error', { - defaultMessage: 'Could not find document', - }) - ); - } -}; diff --git a/x-pack/plugins/enterprise_search/server/lib/crawler/fetch_crawler_multiple_schedules.ts b/x-pack/plugins/enterprise_search/server/lib/crawler/fetch_crawler_multiple_schedules.ts index 666921a950a8c..d367e02ed6ab1 100644 --- a/x-pack/plugins/enterprise_search/server/lib/crawler/fetch_crawler_multiple_schedules.ts +++ b/x-pack/plugins/enterprise_search/server/lib/crawler/fetch_crawler_multiple_schedules.ts @@ -7,8 +7,9 @@ import { IScopedClusterClient } from '@kbn/core/server'; +import { Connector } from '@kbn/search-connectors'; + import { CONNECTORS_INDEX } from '../..'; -import { Connector } from '../../../common/types/connectors'; const CUSTOM_SCHEDULING = 'custom_scheduling'; diff --git a/x-pack/plugins/enterprise_search/server/lib/crawler/fetch_crawlers.ts b/x-pack/plugins/enterprise_search/server/lib/crawler/fetch_crawlers.ts index 9f6890fb9b8ab..b4766cf0d9d4b 100644 --- a/x-pack/plugins/enterprise_search/server/lib/crawler/fetch_crawlers.ts +++ b/x-pack/plugins/enterprise_search/server/lib/crawler/fetch_crawlers.ts @@ -7,9 +7,8 @@ import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; import { IScopedClusterClient } from '@kbn/core/server'; +import { Connector, CONNECTORS_INDEX } from '@kbn/search-connectors'; -import { CONNECTORS_INDEX } from '../..'; -import { Connector } from '../../../common/types/connectors'; import { Crawler, CrawlRequest } from '../../../common/types/crawler'; import { fetchAll } from '../fetch_all'; diff --git a/x-pack/plugins/enterprise_search/server/lib/crawler/post_connector.test.ts b/x-pack/plugins/enterprise_search/server/lib/crawler/post_connector.test.ts index 8c6ad6cbb6a84..7a8f5edd80330 100644 --- a/x-pack/plugins/enterprise_search/server/lib/crawler/post_connector.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/crawler/post_connector.test.ts @@ -7,8 +7,7 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; -import { ConnectorStatus } from '../../../common/types/connectors'; +import { CONNECTORS_INDEX, ConnectorStatus } from '@kbn/search-connectors'; import { recreateConnectorDocument } from './post_connector'; diff --git a/x-pack/plugins/enterprise_search/server/lib/crawler/post_connector.ts b/x-pack/plugins/enterprise_search/server/lib/crawler/post_connector.ts index 17bf6945d0d82..292e07809b7bd 100644 --- a/x-pack/plugins/enterprise_search/server/lib/crawler/post_connector.ts +++ b/x-pack/plugins/enterprise_search/server/lib/crawler/post_connector.ts @@ -7,12 +7,10 @@ import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; -import { CONNECTORS_INDEX } from '../..'; +import { createConnectorDocument, CONNECTORS_INDEX, ConnectorStatus } from '@kbn/search-connectors'; import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../common/constants'; -import { ConnectorStatus } from '../../../common/types/connectors'; - -import { createConnectorDocument } from '../../utils/create_connector_document'; +import { stripSearchPrefix } from '../../../common/utils/strip_search_prefix'; export const recreateConnectorDocument = async ( client: IScopedClusterClient, @@ -23,6 +21,7 @@ export const recreateConnectorDocument = async ( isNative: false, // The search index has already been created so we don't need the language, which we can't retrieve anymore anyway language: '', + name: stripSearchPrefix(indexName), pipeline: null, serviceType: ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE, }); diff --git a/x-pack/plugins/enterprise_search/server/lib/crawler/put_html_extraction.test.ts b/x-pack/plugins/enterprise_search/server/lib/crawler/put_html_extraction.test.ts index 9789be5e40cb1..9e5c62a3d9464 100644 --- a/x-pack/plugins/enterprise_search/server/lib/crawler/put_html_extraction.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/crawler/put_html_extraction.test.ts @@ -7,8 +7,7 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; -import { Connector } from '../../../common/types/connectors'; +import { Connector, CONNECTORS_INDEX } from '@kbn/search-connectors'; import { updateHtmlExtraction } from './put_html_extraction'; diff --git a/x-pack/plugins/enterprise_search/server/lib/crawler/put_html_extraction.ts b/x-pack/plugins/enterprise_search/server/lib/crawler/put_html_extraction.ts index 908f8c27b5a0c..f040f7af85d00 100644 --- a/x-pack/plugins/enterprise_search/server/lib/crawler/put_html_extraction.ts +++ b/x-pack/plugins/enterprise_search/server/lib/crawler/put_html_extraction.ts @@ -7,8 +7,7 @@ import { IScopedClusterClient } from '@kbn/core-elasticsearch-server'; -import { CONNECTORS_INDEX } from '../..'; -import { Connector } from '../../../common/types/connectors'; +import { CONNECTORS_INDEX, Connector } from '@kbn/search-connectors'; export async function updateHtmlExtraction( client: IScopedClusterClient, diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.test.ts b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.test.ts index de04b0bed2d47..3db722c0f58b2 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.test.ts @@ -8,15 +8,24 @@ import { ByteSizeValue } from '@kbn/config-schema'; import { IScopedClusterClient } from '@kbn/core/server'; +import { fetchConnectorByIndexName } from '@kbn/search-connectors'; + import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../common/constants'; -import { SyncStatus } from '../../../common/types/connectors'; -import { fetchConnectorByIndexName } from '../connectors/fetch_connectors'; import { fetchCrawlerByIndexName } from '../crawler/fetch_crawlers'; import { fetchIndex } from './fetch_index'; -jest.mock('../connectors/fetch_connectors', () => ({ +jest.mock('@kbn/search-connectors', () => ({ + SyncStatus: { + CANCELED: 'canceled', + CANCELING: 'canceling', + COMPLETED: 'completed', + ERROR: 'error', + IN_PROGRESS: 'in_progress', + PENDING: 'pending', + SUSPENDED: 'suspended', + }, fetchConnectorByIndexName: jest.fn(), })); @@ -35,10 +44,7 @@ describe('fetchIndex lib function', () => { }, search: jest.fn().mockReturnValue({ hits: { - hits: [ - { _source: { status: SyncStatus.IN_PROGRESS } }, - { _source: { status: SyncStatus.PENDING } }, - ], + hits: [{ _source: { status: 'in_progress' } }, { _source: { status: 'pending' } }], }, }), }, @@ -111,10 +117,7 @@ describe('fetchIndex lib function', () => { it('should return data and stats for index and connector if connector is present', async () => { mockClient.asCurrentUser.search.mockReturnValue({ hits: { - hits: [ - { _source: { status: SyncStatus.CANCELED } }, - { _source: { status: SyncStatus.PENDING } }, - ], + hits: [{ _source: { status: 'canceled' } }, { _source: { status: 'pending' } }], }, }); mockClient.asCurrentUser.indices.get.mockImplementation(() => @@ -169,10 +172,7 @@ describe('fetchIndex lib function', () => { mockClient.asCurrentUser.count.mockReturnValue({ count: 0 }); mockClient.asCurrentUser.search.mockReturnValue({ hits: { - hits: [ - { _source: { status: SyncStatus.IN_PROGRESS } }, - { _source: { status: SyncStatus.COMPLETED } }, - ], + hits: [{ _source: { status: 'in_progress' } }, { _source: { status: 'completed' } }], }, }); mockClient.asCurrentUser.indices.get.mockImplementation(() => diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.ts b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.ts index 4233f8abbeff1..41875daad3717 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_index.ts @@ -7,13 +7,18 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_JOBS_INDEX } from '../..'; +import {} from '../..'; + +import { + CONNECTORS_JOBS_INDEX, + ConnectorSyncJobDocument, + fetchConnectorByIndexName, + SyncStatus, +} from '@kbn/search-connectors'; import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../common/constants'; -import { ConnectorSyncJobDocument, SyncStatus } from '../../../common/types/connectors'; import { ElasticsearchIndexWithIngestion } from '../../../common/types/indices'; import { isIndexNotFoundException } from '../../utils/identify_exceptions'; -import { fetchConnectorByIndexName } from '../connectors/fetch_connectors'; import { fetchCrawlerByIndexName } from '../crawler/fetch_crawlers'; import { mapIndexStats } from './utils/map_index_stats'; @@ -69,7 +74,7 @@ export const fetchIndex = async ( } const indexStats = indices[index]; - const connector = await fetchConnectorByIndexName(client, index); + const connector = await fetchConnectorByIndexName(client.asCurrentUser, index); const hasInProgressSyncsResult = connector ? await hasInProgressSyncs(client, connector.id) : { inProgress: false, pending: false }; diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/generate_api_key.test.ts b/x-pack/plugins/enterprise_search/server/lib/indices/generate_api_key.test.ts index 00188b37d334a..a28450108290a 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/generate_api_key.test.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/generate_api_key.test.ts @@ -7,7 +7,7 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; +import { CONNECTORS_INDEX } from '@kbn/search-connectors'; import { generateApiKey } from './generate_api_key'; diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/generate_api_key.ts b/x-pack/plugins/enterprise_search/server/lib/indices/generate_api_key.ts index f29dc327dfecc..d256bc6a91d88 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/generate_api_key.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/generate_api_key.ts @@ -7,8 +7,8 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; -import { ConnectorDocument } from '../../../common/types/connectors'; +import { ConnectorDocument, CONNECTORS_INDEX } from '@kbn/search-connectors'; + import { toAlphanumeric } from '../../../common/utils/to_alphanumeric'; export const generateApiKey = async (client: IScopedClusterClient, indexName: string) => { diff --git a/x-pack/plugins/enterprise_search/server/lib/pipelines/get_default_pipeline.ts b/x-pack/plugins/enterprise_search/server/lib/pipelines/get_default_pipeline.ts index c13ee2571b82b..66619b99ef96e 100644 --- a/x-pack/plugins/enterprise_search/server/lib/pipelines/get_default_pipeline.ts +++ b/x-pack/plugins/enterprise_search/server/lib/pipelines/get_default_pipeline.ts @@ -7,11 +7,11 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CURRENT_CONNECTORS_INDEX } from '../..'; +import { CURRENT_CONNECTORS_INDEX, IngestPipelineParams } from '@kbn/search-connectors'; + import { DEFAULT_PIPELINE_VALUES } from '../../../common/constants'; import { DefaultConnectorsPipelineMeta } from '../../../common/constants'; -import { IngestPipelineParams } from '../../../common/types/connectors'; import { isIndexNotFoundException } from '../../utils/identify_exceptions'; export const getDefaultPipeline = async ( diff --git a/x-pack/plugins/enterprise_search/server/lib/pipelines/get_index_pipeline.ts b/x-pack/plugins/enterprise_search/server/lib/pipelines/get_index_pipeline.ts index 45813a109de76..54a916898740e 100644 --- a/x-pack/plugins/enterprise_search/server/lib/pipelines/get_index_pipeline.ts +++ b/x-pack/plugins/enterprise_search/server/lib/pipelines/get_index_pipeline.ts @@ -6,9 +6,7 @@ */ import { IScopedClusterClient } from '@kbn/core/server'; - -import { IngestPipelineParams } from '../../../common/types/connectors'; -import { fetchConnectorByIndexName } from '../connectors/fetch_connectors'; +import { IngestPipelineParams, fetchConnectorByIndexName } from '@kbn/search-connectors'; import { getDefaultPipeline } from './get_default_pipeline'; @@ -20,7 +18,7 @@ export const getIndexPipelineParameters = async ( // we want to throw the error if getDefaultPipeline() fails so we're not catching it on purpose const [defaultPipeline, connector, customPipelineResp] = await Promise.all([ getDefaultPipeline(client), - fetchConnectorByIndexName(client, indexName), + fetchConnectorByIndexName(client.asCurrentUser, indexName), client.asCurrentUser.ingest .getPipeline({ id: `${indexName}`, @@ -30,11 +28,7 @@ export const getIndexPipelineParameters = async ( if (connector && connector.pipeline) { return connector.pipeline; } - let pipelineName = defaultPipeline.name; - - if (customPipelineResp && customPipelineResp[indexName]) { - pipelineName = indexName; - } + const pipelineName = customPipelineResp?.[indexName] ? indexName : defaultPipeline.name; return { ...defaultPipeline, diff --git a/x-pack/plugins/enterprise_search/server/lib/pipelines/revert_custom_pipeline.ts b/x-pack/plugins/enterprise_search/server/lib/pipelines/revert_custom_pipeline.ts index 60a9e5cfcf97d..297456b9c00e7 100644 --- a/x-pack/plugins/enterprise_search/server/lib/pipelines/revert_custom_pipeline.ts +++ b/x-pack/plugins/enterprise_search/server/lib/pipelines/revert_custom_pipeline.ts @@ -7,16 +7,14 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; - -import { fetchConnectorByIndexName } from '../connectors/fetch_connectors'; +import { CONNECTORS_INDEX, fetchConnectorByIndexName } from '@kbn/search-connectors'; import { deleteIndexPipelines } from './delete_pipelines'; import { getDefaultPipeline } from './get_default_pipeline'; export const revertCustomPipeline = async (client: IScopedClusterClient, indexName: string) => { - const connector = await fetchConnectorByIndexName(client, indexName); + const connector = await fetchConnectorByIndexName(client.asCurrentUser, indexName); if (connector) { const pipeline = await getDefaultPipeline(client); await client.asCurrentUser.update({ diff --git a/x-pack/plugins/enterprise_search/server/lib/pipelines/update_default_pipeline.ts b/x-pack/plugins/enterprise_search/server/lib/pipelines/update_default_pipeline.ts index 060c0edc88316..73e7e85f53d32 100644 --- a/x-pack/plugins/enterprise_search/server/lib/pipelines/update_default_pipeline.ts +++ b/x-pack/plugins/enterprise_search/server/lib/pipelines/update_default_pipeline.ts @@ -7,10 +7,9 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CURRENT_CONNECTORS_INDEX } from '../..'; +import { CURRENT_CONNECTORS_INDEX, IngestPipelineParams } from '@kbn/search-connectors'; import { DefaultConnectorsPipelineMeta } from '../../../common/constants'; -import { IngestPipelineParams } from '../../../common/types/connectors'; export const updateDefaultPipeline = async ( client: IScopedClusterClient, diff --git a/x-pack/plugins/enterprise_search/server/lib/pipelines/update_pipeline.ts b/x-pack/plugins/enterprise_search/server/lib/pipelines/update_pipeline.ts index 1acc91f7e2684..f8a9ef82453cb 100644 --- a/x-pack/plugins/enterprise_search/server/lib/pipelines/update_pipeline.ts +++ b/x-pack/plugins/enterprise_search/server/lib/pipelines/update_pipeline.ts @@ -7,9 +7,7 @@ import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX } from '../..'; - -import { IngestPipelineParams } from '../../../common/types/connectors'; +import { CONNECTORS_INDEX, IngestPipelineParams } from '@kbn/search-connectors'; export const updateConnectorPipeline = async ( client: IScopedClusterClient, diff --git a/x-pack/plugins/enterprise_search/server/lib/stats/get_sync_jobs.ts b/x-pack/plugins/enterprise_search/server/lib/stats/get_sync_jobs.ts index a19315507bf4c..0cf096bcd9d53 100644 --- a/x-pack/plugins/enterprise_search/server/lib/stats/get_sync_jobs.ts +++ b/x-pack/plugins/enterprise_search/server/lib/stats/get_sync_jobs.ts @@ -9,10 +9,15 @@ import moment from 'moment'; import { IScopedClusterClient } from '@kbn/core/server'; -import { CONNECTORS_INDEX, CONNECTORS_JOBS_INDEX } from '../..'; +import { + CONNECTORS_INDEX, + CONNECTORS_JOBS_INDEX, + ConnectorStatus, + SyncStatus, +} from '@kbn/search-connectors'; + import { SyncJobsStats } from '../../../common/stats'; -import { ConnectorStatus, SyncStatus } from '../../../common/types/connectors'; import { isIndexNotFoundException } from '../../utils/identify_exceptions'; export const fetchSyncJobsStats = async (client: IScopedClusterClient): Promise => { diff --git a/x-pack/plugins/enterprise_search/server/plugin.ts b/x-pack/plugins/enterprise_search/server/plugin.ts index ed6ef8f3886bf..154a7192d35f0 100644 --- a/x-pack/plugins/enterprise_search/server/plugin.ts +++ b/x-pack/plugins/enterprise_search/server/plugin.ts @@ -15,8 +15,6 @@ import { IRouter, KibanaRequest, DEFAULT_APP_CATEGORIES, - IClusterClient, - CoreStart, } from '@kbn/core/server'; import { CustomIntegrationsPluginSetup } from '@kbn/custom-integrations-plugin/server'; import { DataPluginStart } from '@kbn/data-plugin/server/plugin'; @@ -51,7 +49,6 @@ import { databaseSearchGuideConfig, } from '../common/guided_onboarding/search_guide_config'; -import { ConnectorsService } from './api/connectors_service'; import { registerTelemetryUsageCollector as registerASTelemetryUsageCollector } from './collectors/app_search/telemetry'; import { registerTelemetryUsageCollector as registerESTelemetryUsageCollector } from './collectors/enterprise_search/telemetry'; import { registerTelemetryUsageCollector as registerWSTelemetryUsageCollector } from './collectors/workplace_search/telemetry'; @@ -103,10 +100,6 @@ interface PluginsStart { spaces?: SpacesPluginStart; } -export interface EnterpriseSearchPluginStart { - connectorsService: ConnectorsService; -} - export interface RouteDependencies { config: ConfigType; enterpriseSearchRequestHandler: IEnterpriseSearchRequestHandler; @@ -116,14 +109,12 @@ export interface RouteDependencies { router: IRouter; } -export class EnterpriseSearchPlugin implements Plugin { +export class EnterpriseSearchPlugin implements Plugin { private readonly config: ConfigType; private readonly logger: Logger; - private clusterClient?: IClusterClient; /** * Exposed services */ - private connectorsService?: ConnectorsService; constructor(initializerContext: PluginInitializerContext) { this.config = initializerContext.config.get(); @@ -259,7 +250,6 @@ export class EnterpriseSearchPlugin implements Plugin { - this.clusterClient = coreStart.elasticsearch.client; savedObjectsStarted = coreStart.savedObjects; if (usageCollection) { @@ -322,26 +312,7 @@ export class EnterpriseSearchPlugin implements Plugin({ - connectorsService: this.connectorsService, - }); - } + public start() {} public stop() {} } diff --git a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/connectors.ts b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/connectors.ts index 923009c05d098..fea646d9d726e 100644 --- a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/connectors.ts +++ b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/connectors.ts @@ -6,8 +6,18 @@ */ import { schema } from '@kbn/config-schema'; - import { i18n } from '@kbn/i18n'; +import { + fetchSyncJobsByConnectorId, + putUpdateNative, + updateConnectorConfiguration, + updateConnectorNameAndDescription, + updateConnectorScheduling, + updateConnectorServiceType, + updateConnectorStatus, + updateFiltering, + updateFilteringDraft, +} from '@kbn/search-connectors'; import { ConnectorStatus, @@ -15,21 +25,12 @@ import { FilteringRule, FilteringRuleRule, SyncJobType, -} from '../../../common/types/connectors'; +} from '@kbn/search-connectors'; +import { cancelSyncs } from '@kbn/search-connectors/lib/cancel_syncs'; import { ErrorCode } from '../../../common/types/error_codes'; import { addConnector } from '../../lib/connectors/add_connector'; -import { fetchSyncJobsByConnectorId } from '../../lib/connectors/fetch_sync_jobs'; -import { cancelSyncs } from '../../lib/connectors/post_cancel_syncs'; -import { updateFiltering } from '../../lib/connectors/put_update_filtering'; -import { updateFilteringDraft } from '../../lib/connectors/put_update_filtering_draft'; -import { putUpdateNative } from '../../lib/connectors/put_update_native'; -import { startConnectorSync } from '../../lib/connectors/start_sync'; -import { updateConnectorConfiguration } from '../../lib/connectors/update_connector_configuration'; -import { updateConnectorNameAndDescription } from '../../lib/connectors/update_connector_name_and_description'; -import { updateConnectorScheduling } from '../../lib/connectors/update_connector_scheduling'; -import { updateConnectorServiceType } from '../../lib/connectors/update_connector_service_type'; -import { updateConnectorStatus } from '../../lib/connectors/update_connector_status'; +import { startSync } from '../../lib/connectors/start_sync'; import { getDefaultPipeline } from '../../lib/pipelines/get_default_pipeline'; import { updateDefaultPipeline } from '../../lib/pipelines/update_default_pipeline'; import { updateConnectorPipeline } from '../../lib/pipelines/update_pipeline'; @@ -98,7 +99,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { }, elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; - await cancelSyncs(client, request.params.connectorId); + await cancelSyncs(client.asCurrentUser, request.params.connectorId); return response.ok(); }) ); @@ -119,7 +120,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; const configuration = await updateConnectorConfiguration( - client, + client.asCurrentUser, request.params.connectorId, request.body ); @@ -143,7 +144,11 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { }, elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; - await updateConnectorScheduling(client, request.params.connectorId, request.body); + await updateConnectorScheduling( + client.asCurrentUser, + request.params.connectorId, + request.body + ); return response.ok(); }) ); @@ -162,7 +167,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { }, elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; - await startConnectorSync( + await startSync( client, request.params.connectorId, SyncJobType.FULL, @@ -183,7 +188,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { }, elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; - await startConnectorSync(client, request.params.connectorId, SyncJobType.INCREMENTAL); + await startSync(client, request.params.connectorId, SyncJobType.INCREMENTAL); return response.ok(); }) ); @@ -199,7 +204,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { }, elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; - await startConnectorSync(client, request.params.connectorId, SyncJobType.ACCESS_CONTROL); + await startSync(client, request.params.connectorId, SyncJobType.ACCESS_CONTROL); return response.ok(); }) ); @@ -221,7 +226,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; const result = await fetchSyncJobsByConnectorId( - client, + client.asCurrentUser, request.params.connectorId, request.query.from, request.query.size, @@ -298,7 +303,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; const result = await updateConnectorServiceType( - client, + client.asCurrentUser, request.params.connectorId, request.body.serviceType ); @@ -319,7 +324,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; const result = await updateConnectorStatus( - client, + client.asCurrentUser, request.params.connectorId, request.body.status as ConnectorStatus ); @@ -343,10 +348,14 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; const { name, description } = request.body; - const result = await updateConnectorNameAndDescription(client, request.params.connectorId, { - description, - name, - }); + const result = await updateConnectorNameAndDescription( + client.asCurrentUser, + request.params.connectorId, + { + description, + name, + } + ); return response.ok({ body: result }); }) ); @@ -383,7 +392,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { const { client } = (await context.core).elasticsearch; const { connectorId } = request.params; const { advanced_snippet, filtering_rules } = request.body; - const result = await updateFilteringDraft(client, connectorId, { + const result = await updateFilteringDraft(client.asCurrentUser, connectorId, { advancedSnippet: advanced_snippet, // Have to cast here because our API schema validator doesn't know how to deal with enums // We're relying on the schema in the validator above to flag if something goes wrong @@ -425,7 +434,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { const { client } = (await context.core).elasticsearch; const { connectorId } = request.params; const { advanced_snippet, filtering_rules } = request.body; - const result = await updateFiltering(client, connectorId, { + const result = await updateFiltering(client.asCurrentUser, connectorId, { advancedSnippet: advanced_snippet, // Have to cast here because our API schema validator doesn't know how to deal with enums // We're relying on the schema in the validator above to flag if something goes wrong @@ -450,7 +459,7 @@ export function registerConnectorRoutes({ router, log }: RouteDependencies) { const { client } = (await context.core).elasticsearch; const connectorId = decodeURIComponent(request.params.connectorId); const { is_native } = request.body; - const result = await putUpdateNative(client, connectorId, is_native); + const result = await putUpdateNative(client.asCurrentUser, connectorId, is_native); return result ? response.ok({ body: result }) : response.conflict(); }) ); diff --git a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/crawler/crawler.ts b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/crawler/crawler.ts index c5c45806e560f..18a1c5aa8bca6 100644 --- a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/crawler/crawler.ts +++ b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/crawler/crawler.ts @@ -9,12 +9,12 @@ import { schema } from '@kbn/config-schema'; import { i18n } from '@kbn/i18n'; +import { deleteConnectorById, fetchConnectorByIndexName } from '@kbn/search-connectors'; + import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE } from '../../../../common/constants'; import { ErrorCode } from '../../../../common/types/error_codes'; import { addConnector } from '../../../lib/connectors/add_connector'; -import { deleteConnectorById } from '../../../lib/connectors/delete_connector'; -import { fetchConnectorByIndexName } from '../../../lib/connectors/fetch_connectors'; import { fetchCrawlerByIndexName } from '../../../lib/crawler/fetch_crawlers'; import { recreateConnectorDocument } from '../../../lib/crawler/post_connector'; import { updateHtmlExtraction } from '../../../lib/crawler/put_html_extraction'; @@ -83,7 +83,10 @@ export function registerCrawlerRoutes(routeDependencies: RouteDependencies) { }); } - const connector = await fetchConnectorByIndexName(client, request.body.index_name); + const connector = await fetchConnectorByIndexName( + client.asCurrentUser, + request.body.index_name + ); if (connector) { return createError({ errorCode: ErrorCode.CONNECTOR_DOCUMENT_ALREADY_EXISTS, @@ -110,9 +113,12 @@ export function registerCrawlerRoutes(routeDependencies: RouteDependencies) { return res; } catch (error) { // clean up connector index if it was created - const createdConnector = await fetchConnectorByIndexName(client, request.body.index_name); + const createdConnector = await fetchConnectorByIndexName( + client.asCurrentUser, + request.body.index_name + ); if (createdConnector) { - await deleteConnectorById(client, createdConnector.id); + await deleteConnectorById(client.asCurrentUser, createdConnector.id); if (createdConnector.index_name) { await deleteIndex(client, createdConnector.index_name); } @@ -410,7 +416,10 @@ export function registerCrawlerRoutes(routeDependencies: RouteDependencies) { elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; - const connector = await fetchConnectorByIndexName(client, request.params.indexName); + const connector = await fetchConnectorByIndexName( + client.asCurrentUser, + request.params.indexName + ); if ( connector && connector.service_type === ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE @@ -444,7 +453,10 @@ export function registerCrawlerRoutes(routeDependencies: RouteDependencies) { }, elasticsearchErrorHandler(log, async (context, request, response) => { const { client } = (await context.core).elasticsearch; - const connector = await fetchConnectorByIndexName(client, request.params.indexName); + const connector = await fetchConnectorByIndexName( + client.asCurrentUser, + request.params.indexName + ); if (connector) { return createError({ errorCode: ErrorCode.CONNECTOR_DOCUMENT_ALREADY_EXISTS, diff --git a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/indices.ts b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/indices.ts index 25342217e5192..cc031bd3ef684 100644 --- a/x-pack/plugins/enterprise_search/server/routes/enterprise_search/indices.ts +++ b/x-pack/plugins/enterprise_search/server/routes/enterprise_search/indices.ts @@ -14,15 +14,18 @@ import { schema } from '@kbn/config-schema'; import { i18n } from '@kbn/i18n'; +import { deleteConnectorById } from '@kbn/search-connectors'; +import { + fetchConnectorByIndexName, + fetchConnectors, +} from '@kbn/search-connectors/lib/fetch_connectors'; + import { DEFAULT_PIPELINE_NAME } from '../../../common/constants'; import { ErrorCode } from '../../../common/types/error_codes'; import { AlwaysShowPattern } from '../../../common/types/indices'; import type { AttachMlInferencePipelineResponse } from '../../../common/types/pipelines'; -import { deleteConnectorById } from '../../lib/connectors/delete_connector'; - -import { fetchConnectorByIndexName, fetchConnectors } from '../../lib/connectors/fetch_connectors'; import { fetchCrawlerByIndexName, fetchCrawlers } from '../../lib/crawler/fetch_crawlers'; import { createIndex } from '../../lib/indices/create_index'; @@ -113,7 +116,7 @@ export function registerIndexRoutes({ from, size ); - const connectors = await fetchConnectors(client, indexNames); + const connectors = await fetchConnectors(client.asCurrentUser, indexNames); const crawlers = await fetchCrawlers(client, indexNames); const enrichedIndices = indices.map((index) => ({ ...index, @@ -186,7 +189,7 @@ export function registerIndexRoutes({ try { const crawler = await fetchCrawlerByIndexName(client, indexName); - const connector = await fetchConnectorByIndexName(client, indexName); + const connector = await fetchConnectorByIndexName(client.asCurrentUser, indexName); if (crawler) { const crawlerRes = await enterpriseSearchRequestHandler.createRequest({ @@ -199,7 +202,7 @@ export function registerIndexRoutes({ } if (connector) { - await deleteConnectorById(client, connector.id); + await deleteConnectorById(client.asCurrentUser, connector.id); } await deleteIndexPipelines(client, indexName); @@ -575,7 +578,10 @@ export function registerIndexRoutes({ }); } - const connector = await fetchConnectorByIndexName(client, request.body.index_name); + const connector = await fetchConnectorByIndexName( + client.asCurrentUser, + request.body.index_name + ); if (connector) { return createError({ diff --git a/x-pack/plugins/enterprise_search/server/utils/search_result_provider.ts b/x-pack/plugins/enterprise_search/server/utils/search_result_provider.ts index 0869a16b79dc7..3f98b5368c7d2 100644 --- a/x-pack/plugins/enterprise_search/server/utils/search_result_provider.ts +++ b/x-pack/plugins/enterprise_search/server/utils/search_result_provider.ts @@ -11,11 +11,9 @@ import { IBasePath } from '@kbn/core-http-server'; import { GlobalSearchResultProvider } from '@kbn/global-search-plugin/server'; import { i18n } from '@kbn/i18n'; +import { CONNECTOR_DEFINITIONS, ConnectorServerSideDefinition } from '@kbn/search-connectors'; + import { ConfigType } from '..'; -import { - CONNECTOR_DEFINITIONS, - ConnectorServerSideDefinition, -} from '../../common/connectors/connectors'; import { ENTERPRISE_SEARCH_CONNECTOR_CRAWLER_SERVICE_TYPE, ENTERPRISE_SEARCH_CONTENT_PLUGIN, diff --git a/x-pack/plugins/enterprise_search/tsconfig.json b/x-pack/plugins/enterprise_search/tsconfig.json index 25cc264924d47..4195acec083ff 100644 --- a/x-pack/plugins/enterprise_search/tsconfig.json +++ b/x-pack/plugins/enterprise_search/tsconfig.json @@ -11,7 +11,6 @@ "common/**/*", "public/**/*", "server/**/*", - "../../../typings/**/*", ], "kbn_references": [ "@kbn/core", @@ -61,7 +60,7 @@ "@kbn/global-search-plugin", "@kbn/logs-shared-plugin", "@kbn/share-plugin", - "@kbn/core-saved-objects-migration-server-internal", "@kbn/search-api-panels", + "@kbn/search-connectors" ] } diff --git a/x-pack/plugins/serverless_search/kibana.jsonc b/x-pack/plugins/serverless_search/kibana.jsonc index d056148e3aa79..bcf4cc540df14 100644 --- a/x-pack/plugins/serverless_search/kibana.jsonc +++ b/x-pack/plugins/serverless_search/kibana.jsonc @@ -7,14 +7,17 @@ "id": "serverlessSearch", "server": true, "browser": true, - "configPath": ["xpack", "serverless", "search"], + "configPath": [ + "xpack", + "serverless", + "search" + ], "requiredPlugins": [ "cloud", "console", "dashboard", "devTools", "discover", - "enterpriseSearch", "grokdebugger", "management", "ml", @@ -26,6 +29,8 @@ "visualizations" ], "optionalPlugins": [], - "requiredBundles": ["kibanaReact"] + "requiredBundles": [ + "kibanaReact" + ] } } diff --git a/x-pack/plugins/serverless_search/public/application/components/connectors_overview.tsx b/x-pack/plugins/serverless_search/public/application/components/connectors_overview.tsx index 97a3b5887389f..540c78ac521ab 100644 --- a/x-pack/plugins/serverless_search/public/application/components/connectors_overview.tsx +++ b/x-pack/plugins/serverless_search/public/application/components/connectors_overview.tsx @@ -17,13 +17,12 @@ import { EuiTitle, EuiToolTip, } from '@elastic/eui'; -import { Connector } from '@kbn/enterprise-search-plugin/common/types/connectors'; +import { Connector, ConnectorServerSideDefinition } from '@kbn/search-connectors'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { useQuery } from '@tanstack/react-query'; import React from 'react'; -import { ConnectorServerSideDefinition } from '@kbn/enterprise-search-plugin/common/connectors/connectors'; import { LEARN_MORE_LABEL } from '../../../common/i18n_string'; import { PLUGIN_ID } from '../../../common'; import { useKibanaServices } from '../hooks/use_kibana'; diff --git a/x-pack/plugins/serverless_search/public/application/components/overview.tsx b/x-pack/plugins/serverless_search/public/application/components/overview.tsx index ddcc4e08cce13..a01ebdb941eda 100644 --- a/x-pack/plugins/serverless_search/public/application/components/overview.tsx +++ b/x-pack/plugins/serverless_search/public/application/components/overview.tsx @@ -38,7 +38,7 @@ import type { LanguageDefinitionSnippetArguments, } from '@kbn/search-api-panels'; import { useQuery } from '@tanstack/react-query'; -import { Connector } from '@kbn/enterprise-search-plugin/common/types/connectors'; +import { Connector } from '@kbn/search-connectors'; import { docLinks } from '../../../common/doc_links'; import { PLUGIN_ID } from '../../../common'; import { useKibanaServices } from '../hooks/use_kibana'; diff --git a/x-pack/plugins/serverless_search/server/plugin.ts b/x-pack/plugins/serverless_search/server/plugin.ts index 2798a4333d35c..693cdc1e7035e 100644 --- a/x-pack/plugins/serverless_search/server/plugin.ts +++ b/x-pack/plugins/serverless_search/server/plugin.ts @@ -13,7 +13,6 @@ import type { CoreSetup, } from '@kbn/core/server'; import type { SecurityPluginStart } from '@kbn/security-plugin/server'; -import { EnterpriseSearchPluginStart } from '@kbn/enterprise-search-plugin/server'; import { registerApiKeyRoutes } from './routes/api_key_routes'; import { registerIndicesRoutes } from './routes/indices_routes'; @@ -27,9 +26,9 @@ import type { import { registerConnectorsRoutes } from './routes/connectors_routes'; export interface RouteDependencies { + http: CoreSetup['http']; logger: Logger; router: IRouter; - search: EnterpriseSearchPluginStart; security: SecurityPluginStart; } @@ -46,7 +45,6 @@ export class ServerlessSearchPlugin private readonly config: ServerlessSearchConfig; private readonly logger: Logger; private security?: SecurityPluginStart; - private enterpriseSearch?: EnterpriseSearchPluginStart; constructor(initializerContext: PluginInitializerContext) { this.config = initializerContext.config.get(); @@ -58,13 +56,12 @@ export class ServerlessSearchPlugin pluginsSetup: SetupDependencies ) { const router = http.createRouter(); - getStartServices().then(([, { enterpriseSearch, security }]) => { + getStartServices().then(([, { security }]) => { this.security = security; - this.enterpriseSearch = enterpriseSearch; const dependencies = { + http, logger: this.logger, router, - search: this.enterpriseSearch, security: this.security, }; diff --git a/x-pack/plugins/serverless_search/server/routes/connectors_routes.ts b/x-pack/plugins/serverless_search/server/routes/connectors_routes.ts index c74c18f6d7414..766564bb9eaa7 100644 --- a/x-pack/plugins/serverless_search/server/routes/connectors_routes.ts +++ b/x-pack/plugins/serverless_search/server/routes/connectors_routes.ts @@ -5,16 +5,18 @@ * 2.0. */ +import { CONNECTOR_DEFINITIONS, fetchConnectors } from '@kbn/search-connectors'; import { RouteDependencies } from '../plugin'; -export const registerConnectorsRoutes = ({ router, search, security }: RouteDependencies) => { +export const registerConnectorsRoutes = ({ http, router }: RouteDependencies) => { router.get( { path: '/internal/serverless_search/connectors', validate: {}, }, async (context, request, response) => { - const connectors = await search.connectorsService.getConnectors(request); + const { client } = (await context.core).elasticsearch; + const connectors = await fetchConnectors(client.asCurrentUser); return response.ok({ body: { @@ -31,7 +33,14 @@ export const registerConnectorsRoutes = ({ router, search, security }: RouteDepe validate: {}, }, async (context, request, response) => { - const connectors = await search.connectorsService.getConnectorTypes(); + const connectors = CONNECTOR_DEFINITIONS.map((connector) => ({ + ...connector, + iconPath: connector.iconPath + ? http.basePath.prepend( + `/plugins/enterpriseSearch/assets/source_icons/${connector.iconPath}` + ) + : 'logoEnterpriseSearch', + })); return response.ok({ body: { diff --git a/x-pack/plugins/serverless_search/server/types.ts b/x-pack/plugins/serverless_search/server/types.ts index 38100d36f330e..8e8f7f15a8124 100644 --- a/x-pack/plugins/serverless_search/server/types.ts +++ b/x-pack/plugins/serverless_search/server/types.ts @@ -6,7 +6,6 @@ */ import type { SecurityPluginStart } from '@kbn/security-plugin/server'; -import type { EnterpriseSearchPluginStart } from '@kbn/enterprise-search-plugin/server'; import type { MlPluginSetup } from '@kbn/ml-plugin/server'; // eslint-disable-next-line @typescript-eslint/no-empty-interface @@ -15,7 +14,6 @@ export interface ServerlessSearchPluginSetup {} export interface ServerlessSearchPluginStart {} export interface StartDependencies { - enterpriseSearch: EnterpriseSearchPluginStart; security: SecurityPluginStart; } export interface SetupDependencies { diff --git a/x-pack/plugins/serverless_search/tsconfig.json b/x-pack/plugins/serverless_search/tsconfig.json index 1187c90cd1a79..c149beabd33ec 100644 --- a/x-pack/plugins/serverless_search/tsconfig.json +++ b/x-pack/plugins/serverless_search/tsconfig.json @@ -17,7 +17,6 @@ "kbn_references": [ "@kbn/core", "@kbn/config-schema", - "@kbn/enterprise-search-plugin", "@kbn/management-plugin", "@kbn/shared-ux-chrome-navigation", "@kbn/doc-links", @@ -34,5 +33,6 @@ "@kbn/search-api-panels", "@kbn/core-lifecycle-browser", "@kbn/react-kibana-context-theme", + "@kbn/search-connectors", ] } diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index e320b5a24c8be..14688c6898e1f 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -2299,36 +2299,7 @@ "discover.docTable.tableRow.viewSurroundingDocumentsLinkText": "Afficher les documents alentour", "discover.documentsAriaLabel": "Documents", "discover.documentsErrorTitle": "Erreur lors de la recherche", - "unifiedDocViewer.docView.table.actions.label": "Actions", - "unifiedDocViewer.docView.table.actions.open": "Actions ouvertes", - "unifiedDocViewer.docView.table.ignored.multiAboveTooltip": "Une ou plusieurs valeurs dans ce champ sont trop longues et ne peuvent pas être recherchées ni filtrées.", - "unifiedDocViewer.docView.table.ignored.multiMalformedTooltip": "Ce champ comporte une ou plusieurs valeurs mal formées qui ne peuvent pas être recherchées ni filtrées.", - "unifiedDocViewer.docView.table.ignored.multiUnknownTooltip": "Une ou plusieurs valeurs dans ce champ ont été ignorées par Elasticsearch et ne peuvent pas être recherchées ni filtrées.", - "unifiedDocViewer.docView.table.ignored.singleAboveTooltip": "La valeur dans ce champ est trop longue et ne peut pas être recherchée ni filtrée.", - "unifiedDocViewer.docView.table.ignored.singleMalformedTooltip": "La valeur dans ce champ est mal formée et ne peut pas être recherchée ni filtrée.", - "unifiedDocViewer.docView.table.ignored.singleUnknownTooltip": "La valeur dans ce champ a été ignorée par Elasticsearch et ne peut pas être recherchée ni filtrée.", - "unifiedDocViewer.docView.table.searchPlaceHolder": "Rechercher les noms de champs", - "unifiedDocViewer.docViews.json.jsonTitle": "JSON", - "unifiedDocViewer.docViews.table.filterForFieldPresentButtonAriaLabel": "Filtrer sur le champ", - "unifiedDocViewer.docViews.table.filterForFieldPresentButtonTooltip": "Filtrer sur le champ", - "unifiedDocViewer.docViews.table.filterForValueButtonAriaLabel": "Filtrer sur la valeur", - "unifiedDocViewer.docViews.table.filterForValueButtonTooltip": "Filtrer sur la valeur", - "unifiedDocViewer.docViews.table.filterOutValueButtonAriaLabel": "Exclure la valeur", - "unifiedDocViewer.docViews.table.filterOutValueButtonTooltip": "Exclure la valeur", - "unifiedDocViewer.docViews.table.ignored.multiValueLabel": "Contient des valeurs ignorées", - "unifiedDocViewer.docViews.table.ignored.singleValueLabel": "Valeur ignorée", - "unifiedDocViewer.docViews.table.pinFieldAriaLabel": "Épingler le champ", - "unifiedDocViewer.docViews.table.pinFieldLabel": "Épingler le champ", "discover.docViews.table.scoreSortWarningTooltip": "Filtrez sur _score pour pouvoir récupérer les valeurs correspondantes.", - "unifiedDocViewer.docViews.table.tableTitle": "Tableau", - "unifiedDocViewer.docViews.table.toggleColumnInTableButtonAriaLabel": "Afficher/Masquer la colonne dans le tableau", - "unifiedDocViewer.docViews.table.toggleColumnInTableButtonTooltip": "Afficher/Masquer la colonne dans le tableau", - "unifiedDocViewer.fieldChooser.discoverField.name": "Afficher/Masquer les détails du champ", - "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfMetaFieldsTooltip": "Impossible de filtrer sur les champs méta", - "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfScriptedFieldsTooltip": "Impossible de filtrer sur les champs scriptés", - "unifiedDocViewer.docViews.table.unindexedFieldsCanNotBeSearchedTooltip": "Les champs non indexés ou les valeurs ignorées ne peuvent pas être recherchés", - "unifiedDocViewer.docViews.table.unpinFieldAriaLabel": "Désépingler le champ", - "unifiedDocViewer.docViews.table.unpinFieldLabel": "Désépingler le champ", "discover.dropZoneTableLabel": "Abandonner la zone pour ajouter un champ en tant que colonne dans la table", "discover.dscTour.stepAddFields.imageAltText": "Dans la liste Champs disponibles, cliquez sur l'icône Plus pour afficher/masquer un champ dans le tableau de documents.", "discover.dscTour.stepAddFields.title": "Ajouter des champs dans le tableau", @@ -2349,13 +2320,8 @@ "discover.embeddable.search.displayName": "rechercher", "discover.errorCalloutShowErrorMessage": "Afficher les détails", "discover.fieldChooser.availableFieldsTooltip": "Champs disponibles pour l'affichage dans le tableau.", - "unifiedDocViewer.fieldChooser.discoverField.actions": "Actions", "discover.fieldChooser.discoverField.addFieldTooltip": "Ajouter le champ en tant que colonne", - "unifiedDocViewer.fieldChooser.discoverField.multiField": "champ multiple", - "unifiedDocViewer.fieldChooser.discoverField.multiFieldTooltipContent": "Les champs multiples peuvent avoir plusieurs valeurs.", - "unifiedDocViewer.fieldChooser.discoverField.name": "Champ", "discover.fieldChooser.discoverField.removeFieldTooltip": "Supprimer le champ du tableau", - "unifiedDocViewer.fieldChooser.discoverField.value": "Valeur", "discover.goToDiscoverButtonText": "Aller à Discover", "discover.grid.flyout.documentNavigation": "Navigation dans le document", "discover.grid.flyout.toastColumnAdded": "La colonne \"{columnName}\" a été ajoutée.", @@ -2371,10 +2337,8 @@ "discover.inspectorRequestDescriptionDocument": "Cette requête interroge Elasticsearch afin de récupérer les documents.", "discover.invalidFiltersWarnToast.description": "Les références d'ID de la vue de données dans certains filtres appliqués diffèrent de la vue de données actuelle.", "discover.invalidFiltersWarnToast.title": "Références d'index différentes", - "unifiedDocViewer.json.codeEditorAriaLabel": "Affichage JSON en lecture seule d’un document Elasticsearch", - "unifiedDocViewer.json.copyToClipboardLabel": "Copier dans le presse-papiers", "discover.loadingDocuments": "Chargement des documents", - "unifiedDocViewer.loadingJSON": "Chargement de JSON", + "discover.loadingResults": "Chargement des résultats", "discover.localMenu.alertsDescription": "Alertes", "discover.localMenu.fallbackReportTitle": "Recherche Discover sans titre", "discover.localMenu.inspectTitle": "Inspecter", @@ -2431,9 +2395,6 @@ "discover.serverLocatorExtension.titleFromLocatorUnknown": "Recherche inconnue", "discover.singleDocRoute.errorTitle": "Une erreur s'est produite", "discover.skipToBottomButtonLabel": "Atteindre la fin du tableau", - "unifiedDocViewer.sourceViewer.errorMessage": "Impossible de récupérer les données pour le moment. Actualisez l'onglet et réessayez.", - "unifiedDocViewer.sourceViewer.errorMessageTitle": "Une erreur s'est produite.", - "unifiedDocViewer.sourceViewer.refresh": "Actualiser", "discover.toggleSidebarAriaLabel": "Activer/Désactiver la barre latérale", "discover.topNav.openSearchPanel.manageSearchesButtonLabel": "Gérer les recherches", "discover.topNav.openSearchPanel.noSearchesFoundDescription": "Aucune recherche correspondante trouvée.", @@ -2450,25 +2411,73 @@ "discover.viewAlert.searchSourceErrorTitle": "Erreur lors de la récupération de la source de recherche", "discover.viewModes.document.label": "Documents", "discover.viewModes.fieldStatistics.label": "Statistiques de champ", - "unifiedDataTable.tableHeader.timeFieldIconTooltipAriaLabel": "{timeFieldName} – Ce champ représente l'heure à laquelle les événements se sont produits.", - "unifiedDataTable.searchGenerationWithDescription": "Tableau généré par la recherche {searchTitle}", - "unifiedDataTable.searchGenerationWithDescriptionGrid": "Tableau généré par la recherche {searchTitle} ({searchDescription})", - "unifiedDataTable.selectedDocumentsNumber": "{nr} documents sélectionnés", - "unifiedDataTable.clearSelection": "Effacer la sélection", - "unifiedDataTable.controlColumnHeader": "Colonne de commande", - "unifiedDataTable.copyToClipboardJSON": "Copier les documents dans le presse-papiers (JSON)", - "unifiedDataTable.tableHeader.timeFieldIconTooltip": "Ce champ représente l'heure à laquelle les événements se sont produits.", - "unifiedDataTable.grid.copyColumnNameToClipBoardButton": "Copier le nom", - "unifiedDataTable.grid.copyColumnValuesToClipBoardButton": "Copier la colonne", - "unifiedDataTable.grid.documentHeader": "Document", - "unifiedDataTable.grid.editFieldButton": "Modifier le champ de la vue de données", - "unifiedDataTable.grid.selectDoc": "Sélectionner le document \"{rowNumber}\"", - "unifiedDataTable.loadingResults": "Chargement des résultats", - "unifiedDataTable.noResultsFound": "Résultat introuvable", - "unifiedDataTable.removeColumnLabel": "Supprimer la colonne", - "unifiedDataTable.selectColumnHeader": "Sélectionner la colonne", - "unifiedDataTable.showAllDocuments": "Afficher tous les documents", - "unifiedDataTable.showSelectedDocumentsOnly": "Afficher uniquement les documents sélectionnés", + "discover.fieldNameIcons.binaryAriaLabel": "Binaire", + "discover.fieldNameIcons.booleanAriaLabel": "Booléen", + "discover.fieldNameIcons.conflictFieldAriaLabel": "Conflit", + "discover.fieldNameIcons.counterFieldAriaLabel": "Indicateur de compteur", + "discover.fieldNameIcons.dateFieldAriaLabel": "Date", + "discover.fieldNameIcons.dateRangeFieldAriaLabel": "Plage de dates", + "discover.fieldNameIcons.denseVectorFieldAriaLabel": "Vecteur dense", + "discover.fieldNameIcons.flattenedFieldAriaLabel": "Lissé", + "discover.fieldNameIcons.gaugeFieldAriaLabel": "Indicateur de jauge", + "discover.fieldNameIcons.geoPointFieldAriaLabel": "Point géographique", + "discover.fieldNameIcons.geoShapeFieldAriaLabel": "Forme géométrique", + "discover.fieldNameIcons.histogramFieldAriaLabel": "Histogramme", + "discover.fieldNameIcons.ipAddressFieldAriaLabel": "Adresse IP", + "discover.fieldNameIcons.ipRangeFieldAriaLabel": "Plage d'IP", + "discover.fieldNameIcons.keywordFieldAriaLabel": "Mot-clé", + "discover.fieldNameIcons.murmur3FieldAriaLabel": "Murmur3", + "discover.fieldNameIcons.nestedFieldAriaLabel": "Imbriqué", + "discover.fieldNameIcons.numberFieldAriaLabel": "Nombre", + "discover.fieldNameIcons.pointFieldAriaLabel": "Point", + "discover.fieldNameIcons.rankFeatureFieldAriaLabel": "Fonctionnalité de rang", + "discover.fieldNameIcons.rankFeaturesFieldAriaLabel": "Fonctionnalités de rang", + "discover.fieldNameIcons.recordAriaLabel": "Enregistrements", + "discover.fieldNameIcons.shapeFieldAriaLabel": "Forme", + "discover.fieldNameIcons.sourceFieldAriaLabel": "Champ source", + "discover.fieldNameIcons.stringFieldAriaLabel": "Chaîne", + "discover.fieldNameIcons.textFieldAriaLabel": "Texte", + "discover.fieldNameIcons.unknownFieldAriaLabel": "Champ inconnu", + "discover.fieldNameIcons.versionFieldAriaLabel": "Version", + "unifiedDocViewer.docView.table.actions.label": "Actions", + "unifiedDocViewer.docView.table.actions.open": "Actions ouvertes", + "unifiedDocViewer.docView.table.ignored.multiAboveTooltip": "Une ou plusieurs valeurs dans ce champ sont trop longues et ne peuvent pas être recherchées ni filtrées.", + "unifiedDocViewer.docView.table.ignored.multiMalformedTooltip": "Ce champ comporte une ou plusieurs valeurs mal formées qui ne peuvent pas être recherchées ni filtrées.", + "unifiedDocViewer.docView.table.ignored.multiUnknownTooltip": "Une ou plusieurs valeurs dans ce champ ont été ignorées par Elasticsearch et ne peuvent pas être recherchées ni filtrées.", + "unifiedDocViewer.docView.table.ignored.singleAboveTooltip": "La valeur dans ce champ est trop longue et ne peut pas être recherchée ni filtrée.", + "unifiedDocViewer.docView.table.ignored.singleMalformedTooltip": "La valeur dans ce champ est mal formée et ne peut pas être recherchée ni filtrée.", + "unifiedDocViewer.docView.table.ignored.singleUnknownTooltip": "La valeur dans ce champ a été ignorée par Elasticsearch et ne peut pas être recherchée ni filtrée.", + "unifiedDocViewer.docView.table.searchPlaceHolder": "Rechercher les noms de champs", + "unifiedDocViewer.docViews.json.jsonTitle": "JSON", + "unifiedDocViewer.docViews.table.filterForFieldPresentButtonAriaLabel": "Filtrer sur le champ", + "unifiedDocViewer.docViews.table.filterForFieldPresentButtonTooltip": "Filtrer sur le champ", + "unifiedDocViewer.docViews.table.filterForValueButtonAriaLabel": "Filtrer sur la valeur", + "unifiedDocViewer.docViews.table.filterForValueButtonTooltip": "Filtrer sur la valeur", + "unifiedDocViewer.docViews.table.filterOutValueButtonAriaLabel": "Exclure la valeur", + "unifiedDocViewer.docViews.table.filterOutValueButtonTooltip": "Exclure la valeur", + "unifiedDocViewer.docViews.table.ignored.multiValueLabel": "Contient des valeurs ignorées", + "unifiedDocViewer.docViews.table.ignored.singleValueLabel": "Valeur ignorée", + "unifiedDocViewer.docViews.table.pinFieldAriaLabel": "Épingler le champ", + "unifiedDocViewer.docViews.table.pinFieldLabel": "Épingler le champ", + "unifiedDocViewer.docViews.table.tableTitle": "Tableau", + "unifiedDocViewer.docViews.table.toggleColumnInTableButtonAriaLabel": "Afficher/Masquer la colonne dans le tableau", + "unifiedDocViewer.docViews.table.toggleColumnInTableButtonTooltip": "Afficher/Masquer la colonne dans le tableau", + "unifiedDocViewer.fieldChooser.discoverField.name": "Champ", + "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfMetaFieldsTooltip": "Impossible de filtrer sur les champs méta", + "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfScriptedFieldsTooltip": "Impossible de filtrer sur les champs scriptés", + "unifiedDocViewer.docViews.table.unindexedFieldsCanNotBeSearchedTooltip": "Les champs non indexés ou les valeurs ignorées ne peuvent pas être recherchés", + "unifiedDocViewer.docViews.table.unpinFieldAriaLabel": "Désépingler le champ", + "unifiedDocViewer.docViews.table.unpinFieldLabel": "Désépingler le champ", + "unifiedDocViewer.fieldChooser.discoverField.actions": "Actions", + "unifiedDocViewer.fieldChooser.discoverField.multiField": "champ multiple", + "unifiedDocViewer.fieldChooser.discoverField.multiFieldTooltipContent": "Les champs multiples peuvent avoir plusieurs valeurs.", + "unifiedDocViewer.fieldChooser.discoverField.value": "Valeur", + "unifiedDocViewer.json.codeEditorAriaLabel": "Affichage JSON en lecture seule d’un document Elasticsearch", + "unifiedDocViewer.json.copyToClipboardLabel": "Copier dans le presse-papiers", + "unifiedDocViewer.loadingJSON": "Chargement de JSON", + "unifiedDocViewer.sourceViewer.errorMessage": "Impossible de récupérer les données pour le moment. Actualisez l'onglet et réessayez.", + "unifiedDocViewer.sourceViewer.errorMessageTitle": "Une erreur s'est produite.", + "unifiedDocViewer.sourceViewer.refresh": "Actualiser", "domDragDrop.announce.cancelled": "Mouvement annulé. {label} revenu à sa position initiale", "domDragDrop.announce.cancelledItem": "Mouvement annulé. {label} revenu au groupe {groupLabel} à la position {position}", "domDragDrop.announce.dropped.combineCompatible": "{label} combiné dans le groupe {groupLabel} en {dropLabel} dans le groupe {dropGroupLabel} à la position {dropPosition} dans le calque {dropLayerNumber}", @@ -5685,34 +5694,6 @@ "unifiedFieldList.fieldNameDescription.textField": "Texte intégral tel que le corps d'un e-mail ou la description d'un produit.", "unifiedFieldList.fieldNameDescription.unknownField": "Champ inconnu", "unifiedFieldList.fieldNameDescription.versionField": "Versions des logiciels. Prend en charge les règles de priorité de la Gestion sémantique des versions.", - "discover.fieldNameIcons.binaryAriaLabel": "Binaire", - "discover.fieldNameIcons.booleanAriaLabel": "Booléen", - "discover.fieldNameIcons.conflictFieldAriaLabel": "Conflit", - "discover.fieldNameIcons.counterFieldAriaLabel": "Indicateur de compteur", - "discover.fieldNameIcons.dateFieldAriaLabel": "Date", - "discover.fieldNameIcons.dateRangeFieldAriaLabel": "Plage de dates", - "discover.fieldNameIcons.denseVectorFieldAriaLabel": "Vecteur dense", - "discover.fieldNameIcons.flattenedFieldAriaLabel": "Lissé", - "discover.fieldNameIcons.gaugeFieldAriaLabel": "Indicateur de jauge", - "discover.fieldNameIcons.geoPointFieldAriaLabel": "Point géographique", - "discover.fieldNameIcons.geoShapeFieldAriaLabel": "Forme géométrique", - "discover.fieldNameIcons.histogramFieldAriaLabel": "Histogramme", - "discover.fieldNameIcons.ipAddressFieldAriaLabel": "Adresse IP", - "discover.fieldNameIcons.ipRangeFieldAriaLabel": "Plage d'IP", - "discover.fieldNameIcons.keywordFieldAriaLabel": "Mot-clé", - "discover.fieldNameIcons.murmur3FieldAriaLabel": "Murmur3", - "discover.fieldNameIcons.nestedFieldAriaLabel": "Imbriqué", - "discover.fieldNameIcons.numberFieldAriaLabel": "Nombre", - "discover.fieldNameIcons.pointFieldAriaLabel": "Point", - "discover.fieldNameIcons.rankFeatureFieldAriaLabel": "Fonctionnalité de rang", - "discover.fieldNameIcons.rankFeaturesFieldAriaLabel": "Fonctionnalités de rang", - "discover.fieldNameIcons.recordAriaLabel": "Enregistrements", - "discover.fieldNameIcons.shapeFieldAriaLabel": "Forme", - "discover.fieldNameIcons.sourceFieldAriaLabel": "Champ source", - "discover.fieldNameIcons.stringFieldAriaLabel": "Chaîne", - "discover.fieldNameIcons.textFieldAriaLabel": "Texte", - "discover.fieldNameIcons.unknownFieldAriaLabel": "Champ inconnu", - "discover.fieldNameIcons.versionFieldAriaLabel": "Version", "unifiedFieldList.fieldNameSearch.filterByNameLabel": "Rechercher les noms de champs", "unifiedFieldList.fieldPopover.addExistsFilterLabel": "Filtrer sur le champ", "unifiedFieldList.fieldPopover.deleteFieldLabel": "Supprimer le champ de la vue de données", @@ -13655,19 +13636,6 @@ "xpack.enterpriseSearch.content.ml_inference.text_embedding": "Incorporation de texte vectoriel dense", "xpack.enterpriseSearch.content.ml_inference.text_expansion": "Expansion de texte ELSER", "xpack.enterpriseSearch.content.ml_inference.zero_shot_classification": "Classification de texte Zero-Shot", - "xpack.enterpriseSearch.content.nativeConnectors.azureBlob.name": "Stockage Blob Azure", - "xpack.enterpriseSearch.content.nativeConnectors.confluence.name": "Confluence Cloud & Server", - "xpack.enterpriseSearch.content.nativeConnectors.customConnector.name": "Connecteur personnalisé", - "xpack.enterpriseSearch.content.nativeConnectors.googleCloud.name": "Google Cloud Storage", - "xpack.enterpriseSearch.content.nativeConnectors.jira.name": "Jira Cloud & Server", - "xpack.enterpriseSearch.content.nativeConnectors.microsoftSQL.name": "Microsoft SQL", - "xpack.enterpriseSearch.content.nativeConnectors.mongodb.name": "MongoDB", - "xpack.enterpriseSearch.content.nativeConnectors.mysql.name": "MySQL", - "xpack.enterpriseSearch.content.nativeConnectors.networkDrive.name": "Lecteur réseau", - "xpack.enterpriseSearch.content.nativeConnectors.oracle.name": "Oracle", - "xpack.enterpriseSearch.content.nativeConnectors.postgresql.name": "PostgreSQL", - "xpack.enterpriseSearch.content.nativeConnectors.s3.name": "S3", - "xpack.enterpriseSearch.content.nativeConnectors.sharepoint_online.name": "SharePoint en ligne", "xpack.enterpriseSearch.content.navTitle": "Contenu", "xpack.enterpriseSearch.content.new_index.apiDescription": "Utilisez l’API pour ajouter des documents par programme à un index Elasticsearch. Commencez par créer votre index.", "xpack.enterpriseSearch.content.new_index.apiTitle": "Nouvel index de recherche", @@ -14278,40 +14246,6 @@ "xpack.enterpriseSearch.licenseDocumentationLink": "En savoir plus sur les fonctionnalités incluses dans la licence", "xpack.enterpriseSearch.licenseManagementLink": "Gérer votre licence", "xpack.enterpriseSearch.nameLabel": "Nom", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.collectionLabel": "Collection", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.directConnectionLabel": "Connexion directe", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.hostLabel": "Nom d'hôte du serveur", - "xpack.enterpriseSearch.nativeConnectors.mongodb.name": "MongoDB", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.hostLabel": "Hôte", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.passwordLabel": "Mot de passe", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.retriesLabel": "Nouvelles tentatives par requête", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.rowsFetchedLabel": "Lignes extraites par requête", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.schemaLabel": "Schéma", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.tablesLabel": "Liste de tables séparées par des virgules", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.usernameLabel": "Nom d'utilisateur", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.validateHostLabel": "Valider l’hôte", - "xpack.enterpriseSearch.nativeConnectors.mssql.name": "Microsoft SQL", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.hostLabel": "Hôte", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.passwordLabel": "Mot de passe", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.retriesLabel": "Nouvelles tentatives par requête", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.rowsFetchedLabel": "Lignes extraites par requête", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.tablesLabel": "Liste de tables séparées par des virgules", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.usernameLabel": "Nom d'utilisateur", - "xpack.enterpriseSearch.nativeConnectors.mysql.name": "MySQL", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.hostLabel": "Hôte", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.retriesLabel": "Nouvelles tentatives par requête", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.rowsFetchedLabel": "Lignes extraites par requête", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.tablesLabel": "Liste de tables séparées par des virgules", - "xpack.enterpriseSearch.nativeConnectors.postgresql.name": "PostgreSQL", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.clientIdLabel": "ID client", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.secretValueLabel": "Valeur secrète", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.siteCollectionsLabel": "Liste de sites séparées par des virgules", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.siteCollectionsTooltip": "Une liste de sites séparés par des virgules dont les données doivent être ingérées. Utilisez \"*\" pour inclure tous les sites disponibles.", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.tenantIdLabel": "ID locataire", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.tenantNameLabel": "Nom du locataire", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.textExtractionServiceLabel": "Utiliser un service d’extraction de texte", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.textExtractionServiceTooltip": "Nécessite un déploiement distinct du service d’extraction de données d’Elastic. Nécessite également que les paramètres de pipeline désactivent l’extraction de texte.", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.name": "SharePoint en ligne", "xpack.enterpriseSearch.nativeLabel": "Natif", "xpack.enterpriseSearch.nav.analyticsCollections.explorerTitle": "Explorer", "xpack.enterpriseSearch.nav.analyticsCollections.integrationTitle": "Intégration", @@ -14497,9 +14431,6 @@ "xpack.enterpriseSearch.searchExperiences.navTitle": "Expériences de recherche", "xpack.enterpriseSearch.searchExperiences.productDescription": "Construisez une expérience de recherche attrayante et intuitive sans perdre votre temps à tout réinventer.", "xpack.enterpriseSearch.searchExperiences.productName": "Expériences de recherche", - "xpack.enterpriseSearch.server.connectors.configuration.error": "Connecteur introuvable", - "xpack.enterpriseSearch.server.connectors.scheduling.error": "Document introuvable", - "xpack.enterpriseSearch.server.connectors.serviceType.error": "Document introuvable", "xpack.enterpriseSearch.server.routes.addAnalyticsCollection.analyticsCollectionExistsError": "Le nom de collection existe déjà. Choisissez un autre nom.", "xpack.enterpriseSearch.server.routes.addAnalyticsCollection.analyticsCollectionNotFoundErrorMessage": "Collection d'analyses introuvable", "xpack.enterpriseSearch.server.routes.addConnector.connectorExistsError": "Le connecteur ou l'index existe déjà", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 26fa98a750f8d..6849a96b4bd4a 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2314,36 +2314,7 @@ "discover.docTable.tableRow.viewSurroundingDocumentsLinkText": "周りのドキュメントを表示", "discover.documentsAriaLabel": "ドキュメント", "discover.documentsErrorTitle": "検索エラー", - "unifiedDocViewer.docView.table.actions.label": "アクション", - "unifiedDocViewer.docView.table.actions.open": "アクションを開く", - "unifiedDocViewer.docView.table.ignored.multiAboveTooltip": "このフィールドの1つ以上の値が長すぎるため、検索またはフィルタリングできません。", - "unifiedDocViewer.docView.table.ignored.multiMalformedTooltip": "このフィールドは、検索またはフィルタリングできない正しくない形式の値が1つ以上あります。", - "unifiedDocViewer.docView.table.ignored.multiUnknownTooltip": "このフィールドの1つ以上の値がElasticsearchによって無視されたため、検索またはフィルタリングできません。", - "unifiedDocViewer.docView.table.ignored.singleAboveTooltip": "このフィールドの値が長すぎるため、検索またはフィルタリングできません。", - "unifiedDocViewer.docView.table.ignored.singleMalformedTooltip": "このフィールドの値の形式が正しくないため、検索またはフィルタリングできません。", - "unifiedDocViewer.docView.table.ignored.singleUnknownTooltip": "このフィールドの値はElasticsearchによって無視されたため、検索またはフィルタリングできません。", - "unifiedDocViewer.docView.table.searchPlaceHolder": "検索フィールド名", - "unifiedDocViewer.docViews.json.jsonTitle": "JSON", - "unifiedDocViewer.docViews.table.filterForFieldPresentButtonAriaLabel": "フィールド表示のフィルター", - "unifiedDocViewer.docViews.table.filterForFieldPresentButtonTooltip": "フィールド表示のフィルター", - "unifiedDocViewer.docViews.table.filterForValueButtonAriaLabel": "値でフィルター", - "unifiedDocViewer.docViews.table.filterForValueButtonTooltip": "値でフィルター", - "unifiedDocViewer.docViews.table.filterOutValueButtonAriaLabel": "値を除外", - "unifiedDocViewer.docViews.table.filterOutValueButtonTooltip": "値を除外", - "unifiedDocViewer.docViews.table.ignored.multiValueLabel": "無視された値を含む", - "unifiedDocViewer.docViews.table.ignored.singleValueLabel": "無視された値", - "unifiedDocViewer.docViews.table.pinFieldAriaLabel": "フィールドを固定", - "unifiedDocViewer.docViews.table.pinFieldLabel": "フィールドを固定", "discover.docViews.table.scoreSortWarningTooltip": "_scoreの値を取得するには、並べ替える必要があります。", - "unifiedDocViewer.docViews.table.tableTitle": "表", - "unifiedDocViewer.docViews.table.toggleColumnInTableButtonAriaLabel": "表の列を切り替える", - "unifiedDocViewer.docViews.table.toggleColumnInTableButtonTooltip": "表の列を切り替える", - "unifiedDocViewer.fieldChooser.discoverField.name": "フィールド詳細を切り替える", - "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfMetaFieldsTooltip": "メタフィールドの有無でフィルタリングできません", - "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfScriptedFieldsTooltip": "スクリプトフィールドの有無でフィルタリングできません", - "unifiedDocViewer.docViews.table.unindexedFieldsCanNotBeSearchedTooltip": "インデックスがないフィールドまたは無視された値は検索できません", - "unifiedDocViewer.docViews.table.unpinFieldAriaLabel": "フィールドを固定解除", - "unifiedDocViewer.docViews.table.unpinFieldLabel": "フィールドを固定解除", "discover.dropZoneTableLabel": "フィールドを列として表に追加するには、ゾーンをドロップします", "discover.dscTour.stepAddFields.imageAltText": "[使用可能なフィールド]リストで、プラスアイコンをクリックし、フィールドをドキュメントテーブルに切り替えます。", "discover.dscTour.stepAddFields.title": "フィールドをテーブルに追加", @@ -2364,13 +2335,8 @@ "discover.embeddable.search.displayName": "検索", "discover.errorCalloutShowErrorMessage": "詳細を表示", "discover.fieldChooser.availableFieldsTooltip": "フィールドをテーブルに表示できます。", - "unifiedDocViewer.fieldChooser.discoverField.actions": "アクション", "discover.fieldChooser.discoverField.addFieldTooltip": "フィールドを列として追加", - "unifiedDocViewer.fieldChooser.discoverField.multiField": "複数フィールド", - "unifiedDocViewer.fieldChooser.discoverField.multiFieldTooltipContent": "複数フィールドにはフィールドごとに複数の値を入力できます", - "unifiedDocViewer.fieldChooser.discoverField.name": "フィールド", "discover.fieldChooser.discoverField.removeFieldTooltip": "フィールドを表から削除", - "unifiedDocViewer.fieldChooser.discoverField.value": "値", "discover.goToDiscoverButtonText": "Discoverに移動", "discover.grid.flyout.documentNavigation": "ドキュメントナビゲーション", "discover.grid.flyout.toastColumnAdded": "列'{columnName}'が追加されました", @@ -2386,10 +2352,8 @@ "discover.inspectorRequestDescriptionDocument": "このリクエストはElasticsearchにクエリをかけ、ドキュメントを取得します。", "discover.invalidFiltersWarnToast.description": "一部の適用されたフィルターのデータビューID参照は、現在のデータビューとは異なります。", "discover.invalidFiltersWarnToast.title": "別のインデックス参照", - "unifiedDocViewer.json.codeEditorAriaLabel": "Elasticsearch ドキュメントの JSON ビューのみを読み込む", - "unifiedDocViewer.json.copyToClipboardLabel": "クリップボードにコピー", "discover.loadingDocuments": "ドキュメントを読み込み中", - "unifiedDocViewer.loadingJSON": "JSONを読み込んでいます", + "discover.loadingResults": "結果を読み込み中", "discover.localMenu.alertsDescription": "アラート", "discover.localMenu.fallbackReportTitle": "無題のDiscover検索", "discover.localMenu.inspectTitle": "検査", @@ -2446,9 +2410,6 @@ "discover.serverLocatorExtension.titleFromLocatorUnknown": "不明な検索", "discover.singleDocRoute.errorTitle": "エラーが発生しました", "discover.skipToBottomButtonLabel": "テーブルの最後に移動", - "unifiedDocViewer.sourceViewer.errorMessage": "現在データを取得できませんでした。タブを更新して、再試行してください。", - "unifiedDocViewer.sourceViewer.errorMessageTitle": "エラーが発生しました", - "unifiedDocViewer.sourceViewer.refresh": "更新", "discover.toggleSidebarAriaLabel": "サイドバーを切り替える", "discover.topNav.openSearchPanel.manageSearchesButtonLabel": "検索の管理", "discover.topNav.openSearchPanel.noSearchesFoundDescription": "一致する検索が見つかりませんでした。", @@ -2465,25 +2426,73 @@ "discover.viewAlert.searchSourceErrorTitle": "検索ソースの取得エラー", "discover.viewModes.document.label": "ドキュメント", "discover.viewModes.fieldStatistics.label": "フィールド統計情報", - "unifiedDataTable.tableHeader.timeFieldIconTooltipAriaLabel": "{timeFieldName} - このフィールドはイベントの発生時刻を表します。", - "unifiedDataTable.searchGenerationWithDescription": "検索{searchTitle}で生成されたテーブル", - "unifiedDataTable.searchGenerationWithDescriptionGrid": "検索{searchTitle}で生成されたテーブル({searchDescription})", - "unifiedDataTable.selectedDocumentsNumber": "{nr}個のドキュメントが選択されました", - "unifiedDataTable.clearSelection": "選択した項目をクリア", - "unifiedDataTable.controlColumnHeader": "列の制御", - "unifiedDataTable.copyToClipboardJSON": "ドキュメントをクリップボードにコピー(JSON)", - "unifiedDataTable.tableHeader.timeFieldIconTooltip": "このフィールドはイベントの発生時刻を表します。", - "unifiedDataTable.grid.copyColumnNameToClipBoardButton": "名前をコピー", - "unifiedDataTable.grid.copyColumnValuesToClipBoardButton": "列をコピー", - "unifiedDataTable.grid.documentHeader": "ドキュメント", - "unifiedDataTable.grid.editFieldButton": "データビューフィールドを編集", - "unifiedDataTable.grid.selectDoc": "ドキュメント'{rowNumber}'を選択", - "unifiedDataTable.loadingResults": "結果を読み込み中", - "unifiedDataTable.noResultsFound": "結果が見つかりませんでした", - "unifiedDataTable.removeColumnLabel": "列を削除", - "unifiedDataTable.selectColumnHeader": "列を選択", - "unifiedDataTable.showAllDocuments": "すべてのドキュメントを表示", - "unifiedDataTable.showSelectedDocumentsOnly": "選択したドキュメントのみを表示", + "discover.fieldNameIcons.binaryAriaLabel": "バイナリー", + "discover.fieldNameIcons.booleanAriaLabel": "ブール", + "discover.fieldNameIcons.conflictFieldAriaLabel": "競合", + "discover.fieldNameIcons.counterFieldAriaLabel": "カウンターメトリック", + "discover.fieldNameIcons.dateFieldAriaLabel": "日付", + "discover.fieldNameIcons.dateRangeFieldAriaLabel": "日付範囲", + "discover.fieldNameIcons.denseVectorFieldAriaLabel": "密集ベクトル", + "discover.fieldNameIcons.flattenedFieldAriaLabel": "平坦化済み", + "discover.fieldNameIcons.gaugeFieldAriaLabel": "ゲージメトリック", + "discover.fieldNameIcons.geoPointFieldAriaLabel": "地理ポイント", + "discover.fieldNameIcons.geoShapeFieldAriaLabel": "地理情報図形", + "discover.fieldNameIcons.histogramFieldAriaLabel": "ヒストグラム", + "discover.fieldNameIcons.ipAddressFieldAriaLabel": "IP アドレス", + "discover.fieldNameIcons.ipRangeFieldAriaLabel": "IP範囲", + "discover.fieldNameIcons.keywordFieldAriaLabel": "キーワード", + "discover.fieldNameIcons.murmur3FieldAriaLabel": "Murmur3", + "discover.fieldNameIcons.nestedFieldAriaLabel": "ネスト済み", + "discover.fieldNameIcons.numberFieldAriaLabel": "数字", + "discover.fieldNameIcons.pointFieldAriaLabel": "点", + "discover.fieldNameIcons.rankFeatureFieldAriaLabel": "ランク特性", + "discover.fieldNameIcons.rankFeaturesFieldAriaLabel": "ランク特性", + "discover.fieldNameIcons.recordAriaLabel": "記録", + "discover.fieldNameIcons.shapeFieldAriaLabel": "形状", + "discover.fieldNameIcons.sourceFieldAriaLabel": "ソースフィールド", + "discover.fieldNameIcons.stringFieldAriaLabel": "文字列", + "discover.fieldNameIcons.textFieldAriaLabel": "テキスト", + "discover.fieldNameIcons.unknownFieldAriaLabel": "不明なフィールド", + "discover.fieldNameIcons.versionFieldAriaLabel": "バージョン", + "unifiedDocViewer.docView.table.actions.label": "アクション", + "unifiedDocViewer.docView.table.actions.open": "アクションを開く", + "unifiedDocViewer.docView.table.ignored.multiAboveTooltip": "このフィールドの1つ以上の値が長すぎるため、検索またはフィルタリングできません。", + "unifiedDocViewer.docView.table.ignored.multiMalformedTooltip": "このフィールドは、検索またはフィルタリングできない正しくない形式の値が1つ以上あります。", + "unifiedDocViewer.docView.table.ignored.multiUnknownTooltip": "このフィールドの1つ以上の値がElasticsearchによって無視されたため、検索またはフィルタリングできません。", + "unifiedDocViewer.docView.table.ignored.singleAboveTooltip": "このフィールドの値が長すぎるため、検索またはフィルタリングできません。", + "unifiedDocViewer.docView.table.ignored.singleMalformedTooltip": "このフィールドの値の形式が正しくないため、検索またはフィルタリングできません。", + "unifiedDocViewer.docView.table.ignored.singleUnknownTooltip": "このフィールドの値はElasticsearchによって無視されたため、検索またはフィルタリングできません。", + "unifiedDocViewer.docView.table.searchPlaceHolder": "検索フィールド名", + "unifiedDocViewer.docViews.json.jsonTitle": "JSON", + "unifiedDocViewer.docViews.table.filterForFieldPresentButtonAriaLabel": "フィールド表示のフィルター", + "unifiedDocViewer.docViews.table.filterForFieldPresentButtonTooltip": "フィールド表示のフィルター", + "unifiedDocViewer.docViews.table.filterForValueButtonAriaLabel": "値でフィルター", + "unifiedDocViewer.docViews.table.filterForValueButtonTooltip": "値でフィルター", + "unifiedDocViewer.docViews.table.filterOutValueButtonAriaLabel": "値を除外", + "unifiedDocViewer.docViews.table.filterOutValueButtonTooltip": "値を除外", + "unifiedDocViewer.docViews.table.ignored.multiValueLabel": "無視された値を含む", + "unifiedDocViewer.docViews.table.ignored.singleValueLabel": "無視された値", + "unifiedDocViewer.docViews.table.pinFieldAriaLabel": "フィールドを固定", + "unifiedDocViewer.docViews.table.pinFieldLabel": "フィールドを固定", + "unifiedDocViewer.docViews.table.tableTitle": "表", + "unifiedDocViewer.docViews.table.toggleColumnInTableButtonAriaLabel": "表の列を切り替える", + "unifiedDocViewer.docViews.table.toggleColumnInTableButtonTooltip": "表の列を切り替える", + "unifiedDocViewer.fieldChooser.discoverField.name": "フィールド", + "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfMetaFieldsTooltip": "メタフィールドの有無でフィルタリングできません", + "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfScriptedFieldsTooltip": "スクリプトフィールドの有無でフィルタリングできません", + "unifiedDocViewer.docViews.table.unindexedFieldsCanNotBeSearchedTooltip": "インデックスがないフィールドまたは無視された値は検索できません", + "unifiedDocViewer.docViews.table.unpinFieldAriaLabel": "フィールドを固定解除", + "unifiedDocViewer.docViews.table.unpinFieldLabel": "フィールドを固定解除", + "unifiedDocViewer.fieldChooser.discoverField.actions": "アクション", + "unifiedDocViewer.fieldChooser.discoverField.multiField": "複数フィールド", + "unifiedDocViewer.fieldChooser.discoverField.multiFieldTooltipContent": "複数フィールドにはフィールドごとに複数の値を入力できます", + "unifiedDocViewer.fieldChooser.discoverField.value": "値", + "unifiedDocViewer.json.codeEditorAriaLabel": "Elasticsearch ドキュメントの JSON ビューのみを読み込む", + "unifiedDocViewer.json.copyToClipboardLabel": "クリップボードにコピー", + "unifiedDocViewer.loadingJSON": "JSONを読み込んでいます", + "unifiedDocViewer.sourceViewer.errorMessage": "現在データを取得できませんでした。タブを更新して、再試行してください。", + "unifiedDocViewer.sourceViewer.errorMessageTitle": "エラーが発生しました", + "unifiedDocViewer.sourceViewer.refresh": "更新", "domDragDrop.announce.cancelled": "移動がキャンセルされました。{label}は初期位置に戻りました", "domDragDrop.announce.cancelledItem": "移動がキャンセルされました。{label}は位置{position}の{groupLabel}グループに戻りました", "domDragDrop.announce.dropped.combineCompatible": "レイヤー{dropLayerNumber}の位置{dropPosition}でグループ{dropGroupLabel}の{dropLabel}にグループ{groupLabel}の{label}を結合しました。", @@ -5701,34 +5710,6 @@ "unifiedFieldList.fieldNameDescription.textField": "電子メール本文や製品説明などの全文テキスト。", "unifiedFieldList.fieldNameDescription.unknownField": "不明なフィールド", "unifiedFieldList.fieldNameDescription.versionField": "ソフトウェアバージョン。「セマンティックバージョニング」優先度ルールをサポートします。", - "discover.fieldNameIcons.binaryAriaLabel": "バイナリー", - "discover.fieldNameIcons.booleanAriaLabel": "ブール", - "discover.fieldNameIcons.conflictFieldAriaLabel": "競合", - "discover.fieldNameIcons.counterFieldAriaLabel": "カウンターメトリック", - "discover.fieldNameIcons.dateFieldAriaLabel": "日付", - "discover.fieldNameIcons.dateRangeFieldAriaLabel": "日付範囲", - "discover.fieldNameIcons.denseVectorFieldAriaLabel": "密集ベクトル", - "discover.fieldNameIcons.flattenedFieldAriaLabel": "平坦化済み", - "discover.fieldNameIcons.gaugeFieldAriaLabel": "ゲージメトリック", - "discover.fieldNameIcons.geoPointFieldAriaLabel": "地理ポイント", - "discover.fieldNameIcons.geoShapeFieldAriaLabel": "地理情報図形", - "discover.fieldNameIcons.histogramFieldAriaLabel": "ヒストグラム", - "discover.fieldNameIcons.ipAddressFieldAriaLabel": "IP アドレス", - "discover.fieldNameIcons.ipRangeFieldAriaLabel": "IP範囲", - "discover.fieldNameIcons.keywordFieldAriaLabel": "キーワード", - "discover.fieldNameIcons.murmur3FieldAriaLabel": "Murmur3", - "discover.fieldNameIcons.nestedFieldAriaLabel": "ネスト済み", - "discover.fieldNameIcons.numberFieldAriaLabel": "数字", - "discover.fieldNameIcons.pointFieldAriaLabel": "点", - "discover.fieldNameIcons.rankFeatureFieldAriaLabel": "ランク特性", - "discover.fieldNameIcons.rankFeaturesFieldAriaLabel": "ランク特性", - "discover.fieldNameIcons.recordAriaLabel": "記録", - "discover.fieldNameIcons.shapeFieldAriaLabel": "形状", - "discover.fieldNameIcons.sourceFieldAriaLabel": "ソースフィールド", - "discover.fieldNameIcons.stringFieldAriaLabel": "文字列", - "discover.fieldNameIcons.textFieldAriaLabel": "テキスト", - "discover.fieldNameIcons.unknownFieldAriaLabel": "不明なフィールド", - "discover.fieldNameIcons.versionFieldAriaLabel": "バージョン", "unifiedFieldList.fieldNameSearch.filterByNameLabel": "検索フィールド名", "unifiedFieldList.fieldPopover.addExistsFilterLabel": "フィールド表示のフィルター", "unifiedFieldList.fieldPopover.deleteFieldLabel": "データビューフィールドを削除", @@ -13669,19 +13650,6 @@ "xpack.enterpriseSearch.content.ml_inference.text_embedding": "密ベクトルテキスト埋め込み", "xpack.enterpriseSearch.content.ml_inference.text_expansion": "ELSERテキスト拡張", "xpack.enterpriseSearch.content.ml_inference.zero_shot_classification": "ゼロショットテキスト分類", - "xpack.enterpriseSearch.content.nativeConnectors.azureBlob.name": "Azure Blob Storage", - "xpack.enterpriseSearch.content.nativeConnectors.confluence.name": "Confluence Cloud & Server", - "xpack.enterpriseSearch.content.nativeConnectors.customConnector.name": "カスタマイズされたコネクター", - "xpack.enterpriseSearch.content.nativeConnectors.googleCloud.name": "Google Cloud Storage", - "xpack.enterpriseSearch.content.nativeConnectors.jira.name": "Jira Cloud & Server", - "xpack.enterpriseSearch.content.nativeConnectors.microsoftSQL.name": "Microsoft SQL", - "xpack.enterpriseSearch.content.nativeConnectors.mongodb.name": "MongoDB", - "xpack.enterpriseSearch.content.nativeConnectors.mysql.name": "MySQL", - "xpack.enterpriseSearch.content.nativeConnectors.networkDrive.name": "ネットワークドライブ", - "xpack.enterpriseSearch.content.nativeConnectors.oracle.name": "Oracle", - "xpack.enterpriseSearch.content.nativeConnectors.postgresql.name": "PostgreSQL", - "xpack.enterpriseSearch.content.nativeConnectors.s3.name": "S3", - "xpack.enterpriseSearch.content.nativeConnectors.sharepoint_online.name": "Sharepoint Online", "xpack.enterpriseSearch.content.navTitle": "コンテンツ", "xpack.enterpriseSearch.content.new_index.apiDescription": "プログラム的にElasticsearchインデックスにドキュメントを追加するにはAPIを使用します。パイプラインを作成して開始", "xpack.enterpriseSearch.content.new_index.apiTitle": "新しい検索インデックス", @@ -14292,40 +14260,6 @@ "xpack.enterpriseSearch.licenseDocumentationLink": "ライセンス機能の詳細", "xpack.enterpriseSearch.licenseManagementLink": "ライセンスを更新", "xpack.enterpriseSearch.nameLabel": "名前", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.collectionLabel": "収集", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.directConnectionLabel": "直接接続", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.hostLabel": "サーバーホスト名", - "xpack.enterpriseSearch.nativeConnectors.mongodb.name": "MongoDB", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.hostLabel": "ホスト", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.passwordLabel": "パスワード", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.retriesLabel": "リクエストごとの再試行回数", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.rowsFetchedLabel": "リクエストごとに取得された行数", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.schemaLabel": "スキーマ", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.tablesLabel": "カンマ区切りのテーブルのリスト", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.usernameLabel": "ユーザー名", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.validateHostLabel": "ホストを検証", - "xpack.enterpriseSearch.nativeConnectors.mssql.name": "Microsoft SQL", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.hostLabel": "ホスト", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.passwordLabel": "パスワード", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.retriesLabel": "リクエストごとの再試行回数", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.rowsFetchedLabel": "リクエストごとに取得された行数", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.tablesLabel": "カンマ区切りのテーブルのリスト", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.usernameLabel": "ユーザー名", - "xpack.enterpriseSearch.nativeConnectors.mysql.name": "MySQL", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.hostLabel": "ホスト", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.retriesLabel": "リクエストごとの再試行回数", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.rowsFetchedLabel": "リクエストごとに取得された行数", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.tablesLabel": "カンマ区切りのテーブルのリスト", - "xpack.enterpriseSearch.nativeConnectors.postgresql.name": "PostgreSQL", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.clientIdLabel": "クライアントID", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.secretValueLabel": "シークレット値", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.siteCollectionsLabel": "カンマ区切りのサイトのリスト", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.siteCollectionsTooltip": "データのインジェスト元のサイトのリスト(カンマ区切り)。すべての使用可能なサイトを含めるには、*を使用します。", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.tenantIdLabel": "テナントID", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.tenantNameLabel": "テナント名", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.textExtractionServiceLabel": "テキスト抽出サービスを使用", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.textExtractionServiceTooltip": "Elastic Data Extraction Serviceを別途デプロイする必要があります。また、パイプラインの設定でテキスト抽出を無効にする必要があります。", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.name": "Sharepoint Online", "xpack.enterpriseSearch.nativeLabel": "ネイティブ", "xpack.enterpriseSearch.nav.analyticsCollections.explorerTitle": "エクスプローラー", "xpack.enterpriseSearch.nav.analyticsCollections.integrationTitle": "統合", @@ -14511,9 +14445,6 @@ "xpack.enterpriseSearch.searchExperiences.navTitle": "検索エクスペリエンス", "xpack.enterpriseSearch.searchExperiences.productDescription": "直感的で、魅力的な検索エクスペリエンスを簡単に構築できます。", "xpack.enterpriseSearch.searchExperiences.productName": "検索エクスペリエンス", - "xpack.enterpriseSearch.server.connectors.configuration.error": "コネクターが見つかりませんでした", - "xpack.enterpriseSearch.server.connectors.scheduling.error": "ドキュメントが見つかりませんでした", - "xpack.enterpriseSearch.server.connectors.serviceType.error": "ドキュメントが見つかりませんでした", "xpack.enterpriseSearch.server.routes.addAnalyticsCollection.analyticsCollectionExistsError": "コレクション名はすでに存在します。別の名前を選択してください。", "xpack.enterpriseSearch.server.routes.addAnalyticsCollection.analyticsCollectionNotFoundErrorMessage": "分析コレクションが見つかりません", "xpack.enterpriseSearch.server.routes.addConnector.connectorExistsError": "コネクターまたはインデックスはすでに存在します", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index e96481d694485..9e1a41ddaea15 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2314,36 +2314,7 @@ "discover.docTable.tableRow.viewSurroundingDocumentsLinkText": "查看周围文档", "discover.documentsAriaLabel": "文档", "discover.documentsErrorTitle": "搜索错误", - "unifiedDocViewer.docView.table.actions.label": "操作", - "unifiedDocViewer.docView.table.actions.open": "打开操作", - "unifiedDocViewer.docView.table.ignored.multiAboveTooltip": "此字段中的一个或多个值过长,无法搜索或筛选。", - "unifiedDocViewer.docView.table.ignored.multiMalformedTooltip": "此字段包含一个或多个格式错误的值,无法搜索或筛选。", - "unifiedDocViewer.docView.table.ignored.multiUnknownTooltip": "此字段中的一个或多个值被 Elasticsearch 忽略,无法搜索或筛选。", - "unifiedDocViewer.docView.table.ignored.singleAboveTooltip": "此字段中的值过长,无法搜索或筛选。", - "unifiedDocViewer.docView.table.ignored.singleMalformedTooltip": "此字段中的值格式错误,无法搜索或筛选。", - "unifiedDocViewer.docView.table.ignored.singleUnknownTooltip": "此字段中的值被 Elasticsearch 忽略,无法搜索或筛选。", - "unifiedDocViewer.docView.table.searchPlaceHolder": "搜索字段名称", - "unifiedDocViewer.docViews.json.jsonTitle": "JSON", - "unifiedDocViewer.docViews.table.filterForFieldPresentButtonAriaLabel": "筛留存在的字段", - "unifiedDocViewer.docViews.table.filterForFieldPresentButtonTooltip": "字段是否存在筛选", - "unifiedDocViewer.docViews.table.filterForValueButtonAriaLabel": "筛留值", - "unifiedDocViewer.docViews.table.filterForValueButtonTooltip": "筛留值", - "unifiedDocViewer.docViews.table.filterOutValueButtonAriaLabel": "筛除值", - "unifiedDocViewer.docViews.table.filterOutValueButtonTooltip": "筛除值", - "unifiedDocViewer.docViews.table.ignored.multiValueLabel": "包含被忽略的值", - "unifiedDocViewer.docViews.table.ignored.singleValueLabel": "被忽略的值", - "unifiedDocViewer.docViews.table.pinFieldAriaLabel": "固定字段", - "unifiedDocViewer.docViews.table.pinFieldLabel": "固定字段", "discover.docViews.table.scoreSortWarningTooltip": "要检索 _score 的值,必须按其筛选。", - "unifiedDocViewer.docViews.table.tableTitle": "表", - "unifiedDocViewer.docViews.table.toggleColumnInTableButtonAriaLabel": "在表中切换列", - "unifiedDocViewer.docViews.table.toggleColumnInTableButtonTooltip": "在表中切换列", - "unifiedDocViewer.fieldChooser.discoverField.name": "切换字段详细信息", - "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfMetaFieldsTooltip": "无法筛选元数据字段是否存在", - "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfScriptedFieldsTooltip": "无法筛选脚本字段是否存在", - "unifiedDocViewer.docViews.table.unindexedFieldsCanNotBeSearchedTooltip": "无法搜索未编入索引的字段或被忽略的值", - "unifiedDocViewer.docViews.table.unpinFieldAriaLabel": "取消固定字段", - "unifiedDocViewer.docViews.table.unpinFieldLabel": "取消固定字段", "discover.dropZoneTableLabel": "放置区域以将字段作为列添加到表中", "discover.dscTour.stepAddFields.imageAltText": "在可用字段列表中,单击加号图标将字段切换为文档表。", "discover.dscTour.stepAddFields.title": "将字段添加到表中", @@ -2364,13 +2335,8 @@ "discover.embeddable.search.displayName": "搜索", "discover.errorCalloutShowErrorMessage": "显示详情", "discover.fieldChooser.availableFieldsTooltip": "适用于在表中显示的字段。", - "unifiedDocViewer.fieldChooser.discoverField.actions": "操作", "discover.fieldChooser.discoverField.addFieldTooltip": "将字段添加为列", - "unifiedDocViewer.fieldChooser.discoverField.multiField": "多字段", - "unifiedDocViewer.fieldChooser.discoverField.multiFieldTooltipContent": "多字段的每个字段可以有多个值", - "unifiedDocViewer.fieldChooser.discoverField.name": "字段", "discover.fieldChooser.discoverField.removeFieldTooltip": "从表中移除字段", - "unifiedDocViewer.fieldChooser.discoverField.value": "值", "discover.goToDiscoverButtonText": "前往 Discover", "discover.grid.flyout.documentNavigation": "文档导航", "discover.grid.flyout.toastColumnAdded": "已添加列“{columnName}”", @@ -2386,10 +2352,8 @@ "discover.inspectorRequestDescriptionDocument": "此请求将查询 Elasticsearch 以获取文档。", "discover.invalidFiltersWarnToast.description": "某些应用的筛选中的数据视图 ID 引用与当前数据视图不同。", "discover.invalidFiltersWarnToast.title": "不同的索引引用", - "unifiedDocViewer.json.codeEditorAriaLabel": "Elasticsearch 文档的只读 JSON 视图", - "unifiedDocViewer.json.copyToClipboardLabel": "复制到剪贴板", "discover.loadingDocuments": "正在加载文档", - "unifiedDocViewer.loadingJSON": "正在加载 JSON", + "discover.loadingResults": "正在加载结果", "discover.localMenu.alertsDescription": "告警", "discover.localMenu.fallbackReportTitle": "未命名 Discover 搜索", "discover.localMenu.inspectTitle": "检查", @@ -2446,9 +2410,6 @@ "discover.serverLocatorExtension.titleFromLocatorUnknown": "未知搜索", "discover.singleDocRoute.errorTitle": "发生错误", "discover.skipToBottomButtonLabel": "转到表尾", - "unifiedDocViewer.sourceViewer.errorMessage": "当前无法获取数据。请刷新选项卡以重试。", - "unifiedDocViewer.sourceViewer.errorMessageTitle": "发生错误", - "unifiedDocViewer.sourceViewer.refresh": "刷新", "discover.toggleSidebarAriaLabel": "切换侧边栏", "discover.topNav.openSearchPanel.manageSearchesButtonLabel": "管理搜索", "discover.topNav.openSearchPanel.noSearchesFoundDescription": "未找到匹配的搜索。", @@ -2465,25 +2426,73 @@ "discover.viewAlert.searchSourceErrorTitle": "提取搜索源时出错", "discover.viewModes.document.label": "文档", "discover.viewModes.fieldStatistics.label": "字段统计信息", - "unifiedDataTable.tableHeader.timeFieldIconTooltipAriaLabel": "{timeFieldName} - 此字段表示事件发生的时间。", - "unifiedDataTable.searchGenerationWithDescription": "搜索 {searchTitle} 生成的表", - "unifiedDataTable.searchGenerationWithDescriptionGrid": "搜索 {searchTitle} 生成的表({searchDescription})", - "unifiedDataTable.selectedDocumentsNumber": "{nr} 个文档已选择", - "unifiedDataTable.clearSelection": "清除所选内容", - "unifiedDataTable.controlColumnHeader": "控制列", - "unifiedDataTable.copyToClipboardJSON": "将文档复制到剪贴板 (JSON)", - "unifiedDataTable.tableHeader.timeFieldIconTooltip": "此字段表示事件发生的时间。", - "unifiedDataTable.grid.copyColumnNameToClipBoardButton": "复制名称", - "unifiedDataTable.grid.copyColumnValuesToClipBoardButton": "复制列", - "unifiedDataTable.grid.documentHeader": "文档", - "unifiedDataTable.grid.editFieldButton": "编辑数据视图字段", - "unifiedDataTable.grid.selectDoc": "选择文档“{rowNumber}”", - "unifiedDataTable.loadingResults": "正在加载结果", - "unifiedDataTable.noResultsFound": "找不到结果", - "unifiedDataTable.removeColumnLabel": "移除列", - "unifiedDataTable.selectColumnHeader": "选择列", - "unifiedDataTable.showAllDocuments": "显示所有文档", - "unifiedDataTable.showSelectedDocumentsOnly": "仅显示选定的文档", + "discover.fieldNameIcons.binaryAriaLabel": "二进制", + "discover.fieldNameIcons.booleanAriaLabel": "布尔型", + "discover.fieldNameIcons.conflictFieldAriaLabel": "冲突", + "discover.fieldNameIcons.counterFieldAriaLabel": "计数器指标", + "discover.fieldNameIcons.dateFieldAriaLabel": "日期", + "discover.fieldNameIcons.dateRangeFieldAriaLabel": "日期范围", + "discover.fieldNameIcons.denseVectorFieldAriaLabel": "密集向量", + "discover.fieldNameIcons.flattenedFieldAriaLabel": "扁平", + "discover.fieldNameIcons.gaugeFieldAriaLabel": "仪表盘指标", + "discover.fieldNameIcons.geoPointFieldAriaLabel": "地理点", + "discover.fieldNameIcons.geoShapeFieldAriaLabel": "几何形状", + "discover.fieldNameIcons.histogramFieldAriaLabel": "直方图", + "discover.fieldNameIcons.ipAddressFieldAriaLabel": "IP 地址", + "discover.fieldNameIcons.ipRangeFieldAriaLabel": "IP 范围", + "discover.fieldNameIcons.keywordFieldAriaLabel": "关键字", + "discover.fieldNameIcons.murmur3FieldAriaLabel": "Murmur3", + "discover.fieldNameIcons.nestedFieldAriaLabel": "嵌套", + "discover.fieldNameIcons.numberFieldAriaLabel": "数字", + "discover.fieldNameIcons.pointFieldAriaLabel": "点", + "discover.fieldNameIcons.rankFeatureFieldAriaLabel": "排名特征", + "discover.fieldNameIcons.rankFeaturesFieldAriaLabel": "排名特征", + "discover.fieldNameIcons.recordAriaLabel": "记录", + "discover.fieldNameIcons.shapeFieldAriaLabel": "形状", + "discover.fieldNameIcons.sourceFieldAriaLabel": "源字段", + "discover.fieldNameIcons.stringFieldAriaLabel": "字符串", + "discover.fieldNameIcons.textFieldAriaLabel": "文本", + "discover.fieldNameIcons.unknownFieldAriaLabel": "未知字段", + "discover.fieldNameIcons.versionFieldAriaLabel": "版本", + "unifiedDocViewer.docView.table.actions.label": "操作", + "unifiedDocViewer.docView.table.actions.open": "打开操作", + "unifiedDocViewer.docView.table.ignored.multiAboveTooltip": "此字段中的一个或多个值过长,无法搜索或筛选。", + "unifiedDocViewer.docView.table.ignored.multiMalformedTooltip": "此字段包含一个或多个格式错误的值,无法搜索或筛选。", + "unifiedDocViewer.docView.table.ignored.multiUnknownTooltip": "此字段中的一个或多个值被 Elasticsearch 忽略,无法搜索或筛选。", + "unifiedDocViewer.docView.table.ignored.singleAboveTooltip": "此字段中的值过长,无法搜索或筛选。", + "unifiedDocViewer.docView.table.ignored.singleMalformedTooltip": "此字段中的值格式错误,无法搜索或筛选。", + "unifiedDocViewer.docView.table.ignored.singleUnknownTooltip": "此字段中的值被 Elasticsearch 忽略,无法搜索或筛选。", + "unifiedDocViewer.docView.table.searchPlaceHolder": "搜索字段名称", + "unifiedDocViewer.docViews.json.jsonTitle": "JSON", + "unifiedDocViewer.docViews.table.filterForFieldPresentButtonAriaLabel": "筛留存在的字段", + "unifiedDocViewer.docViews.table.filterForFieldPresentButtonTooltip": "字段是否存在筛选", + "unifiedDocViewer.docViews.table.filterForValueButtonAriaLabel": "筛留值", + "unifiedDocViewer.docViews.table.filterForValueButtonTooltip": "筛留值", + "unifiedDocViewer.docViews.table.filterOutValueButtonAriaLabel": "筛除值", + "unifiedDocViewer.docViews.table.filterOutValueButtonTooltip": "筛除值", + "unifiedDocViewer.docViews.table.ignored.multiValueLabel": "包含被忽略的值", + "unifiedDocViewer.docViews.table.ignored.singleValueLabel": "被忽略的值", + "unifiedDocViewer.docViews.table.pinFieldAriaLabel": "固定字段", + "unifiedDocViewer.docViews.table.pinFieldLabel": "固定字段", + "unifiedDocViewer.docViews.table.tableTitle": "表", + "unifiedDocViewer.docViews.table.toggleColumnInTableButtonAriaLabel": "在表中切换列", + "unifiedDocViewer.docViews.table.toggleColumnInTableButtonTooltip": "在表中切换列", + "unifiedDocViewer.fieldChooser.discoverField.name": "字段", + "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfMetaFieldsTooltip": "无法筛选元数据字段是否存在", + "unifiedDocViewer.docViews.table.unableToFilterForPresenceOfScriptedFieldsTooltip": "无法筛选脚本字段是否存在", + "unifiedDocViewer.docViews.table.unindexedFieldsCanNotBeSearchedTooltip": "无法搜索未编入索引的字段或被忽略的值", + "unifiedDocViewer.docViews.table.unpinFieldAriaLabel": "取消固定字段", + "unifiedDocViewer.docViews.table.unpinFieldLabel": "取消固定字段", + "unifiedDocViewer.fieldChooser.discoverField.actions": "操作", + "unifiedDocViewer.fieldChooser.discoverField.multiField": "多字段", + "unifiedDocViewer.fieldChooser.discoverField.multiFieldTooltipContent": "多字段的每个字段可以有多个值", + "unifiedDocViewer.fieldChooser.discoverField.value": "值", + "unifiedDocViewer.json.codeEditorAriaLabel": "Elasticsearch 文档的只读 JSON 视图", + "unifiedDocViewer.json.copyToClipboardLabel": "复制到剪贴板", + "unifiedDocViewer.loadingJSON": "正在加载 JSON", + "unifiedDocViewer.sourceViewer.errorMessage": "当前无法获取数据。请刷新选项卡以重试。", + "unifiedDocViewer.sourceViewer.errorMessageTitle": "发生错误", + "unifiedDocViewer.sourceViewer.refresh": "刷新", "domDragDrop.announce.cancelled": "移动已取消。{label} 已返回至其初始位置", "domDragDrop.announce.cancelledItem": "移动已取消。{label} 返回至 {groupLabel} 组中的位置 {position}", "domDragDrop.announce.dropped.combineCompatible": "已将组 {groupLabel} 中的 {label} 组合到图层 {dropLayerNumber} 的组 {dropGroupLabel} 中的位置 {dropPosition} 上的 {dropLabel}", @@ -5700,34 +5709,6 @@ "unifiedFieldList.fieldNameDescription.textField": "全文本,如电子邮件正文或产品描述。", "unifiedFieldList.fieldNameDescription.unknownField": "未知字段", "unifiedFieldList.fieldNameDescription.versionField": "软件版本。支持“语义版本控制”优先规则。", - "discover.fieldNameIcons.binaryAriaLabel": "二进制", - "discover.fieldNameIcons.booleanAriaLabel": "布尔型", - "discover.fieldNameIcons.conflictFieldAriaLabel": "冲突", - "discover.fieldNameIcons.counterFieldAriaLabel": "计数器指标", - "discover.fieldNameIcons.dateFieldAriaLabel": "日期", - "discover.fieldNameIcons.dateRangeFieldAriaLabel": "日期范围", - "discover.fieldNameIcons.denseVectorFieldAriaLabel": "密集向量", - "discover.fieldNameIcons.flattenedFieldAriaLabel": "扁平", - "discover.fieldNameIcons.gaugeFieldAriaLabel": "仪表盘指标", - "discover.fieldNameIcons.geoPointFieldAriaLabel": "地理点", - "discover.fieldNameIcons.geoShapeFieldAriaLabel": "几何形状", - "discover.fieldNameIcons.histogramFieldAriaLabel": "直方图", - "discover.fieldNameIcons.ipAddressFieldAriaLabel": "IP 地址", - "discover.fieldNameIcons.ipRangeFieldAriaLabel": "IP 范围", - "discover.fieldNameIcons.keywordFieldAriaLabel": "关键字", - "discover.fieldNameIcons.murmur3FieldAriaLabel": "Murmur3", - "discover.fieldNameIcons.nestedFieldAriaLabel": "嵌套", - "discover.fieldNameIcons.numberFieldAriaLabel": "数字", - "discover.fieldNameIcons.pointFieldAriaLabel": "点", - "discover.fieldNameIcons.rankFeatureFieldAriaLabel": "排名特征", - "discover.fieldNameIcons.rankFeaturesFieldAriaLabel": "排名特征", - "discover.fieldNameIcons.recordAriaLabel": "记录", - "discover.fieldNameIcons.shapeFieldAriaLabel": "形状", - "discover.fieldNameIcons.sourceFieldAriaLabel": "源字段", - "discover.fieldNameIcons.stringFieldAriaLabel": "字符串", - "discover.fieldNameIcons.textFieldAriaLabel": "文本", - "discover.fieldNameIcons.unknownFieldAriaLabel": "未知字段", - "discover.fieldNameIcons.versionFieldAriaLabel": "版本", "unifiedFieldList.fieldNameSearch.filterByNameLabel": "搜索字段名称", "unifiedFieldList.fieldPopover.addExistsFilterLabel": "筛留存在的字段", "unifiedFieldList.fieldPopover.deleteFieldLabel": "删除数据视图字段", @@ -13669,19 +13650,6 @@ "xpack.enterpriseSearch.content.ml_inference.text_embedding": "密集向量文本嵌入", "xpack.enterpriseSearch.content.ml_inference.text_expansion": "ELSER 文本扩展", "xpack.enterpriseSearch.content.ml_inference.zero_shot_classification": "Zero-Shot 文本分类", - "xpack.enterpriseSearch.content.nativeConnectors.azureBlob.name": "Azure Blob 存储", - "xpack.enterpriseSearch.content.nativeConnectors.confluence.name": "Confluence Cloud 和 Confluence Server", - "xpack.enterpriseSearch.content.nativeConnectors.customConnector.name": "定制连接器", - "xpack.enterpriseSearch.content.nativeConnectors.googleCloud.name": "Google Cloud Storage", - "xpack.enterpriseSearch.content.nativeConnectors.jira.name": "Jira Cloud 和 Jira Server", - "xpack.enterpriseSearch.content.nativeConnectors.microsoftSQL.name": "Microsoft SQL", - "xpack.enterpriseSearch.content.nativeConnectors.mongodb.name": "MongoDB", - "xpack.enterpriseSearch.content.nativeConnectors.mysql.name": "MySQL", - "xpack.enterpriseSearch.content.nativeConnectors.networkDrive.name": "网络驱动器", - "xpack.enterpriseSearch.content.nativeConnectors.oracle.name": "Oracle", - "xpack.enterpriseSearch.content.nativeConnectors.postgresql.name": "PostgreSQL", - "xpack.enterpriseSearch.content.nativeConnectors.s3.name": "S3", - "xpack.enterpriseSearch.content.nativeConnectors.sharepoint_online.name": "Sharepoint", "xpack.enterpriseSearch.content.navTitle": "内容", "xpack.enterpriseSearch.content.new_index.apiDescription": "使用 API 以编程方式将文档添加到 Elasticsearch 索引。首先创建索引。", "xpack.enterpriseSearch.content.new_index.apiTitle": "新搜索索引", @@ -14292,40 +14260,6 @@ "xpack.enterpriseSearch.licenseDocumentationLink": "详细了解许可证功能", "xpack.enterpriseSearch.licenseManagementLink": "管理您的许可", "xpack.enterpriseSearch.nameLabel": "名称", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.collectionLabel": "集合", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.directConnectionLabel": "直接连接", - "xpack.enterpriseSearch.nativeConnectors.mongodb.configuration.hostLabel": "服务器主机名", - "xpack.enterpriseSearch.nativeConnectors.mongodb.name": "MongoDB", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.hostLabel": "主机", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.passwordLabel": "密码", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.retriesLabel": "根据请求重试", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.rowsFetchedLabel": "根据请求提取的行", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.schemaLabel": "架构", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.tablesLabel": "表的逗号分隔列表", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.usernameLabel": "用户名", - "xpack.enterpriseSearch.nativeConnectors.mssql.configuration.validateHostLabel": "验证主机", - "xpack.enterpriseSearch.nativeConnectors.mssql.name": "Microsoft SQL", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.hostLabel": "主机", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.passwordLabel": "密码", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.retriesLabel": "根据请求重试", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.rowsFetchedLabel": "根据请求提取的行", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.tablesLabel": "表的逗号分隔列表", - "xpack.enterpriseSearch.nativeConnectors.mysql.configuration.usernameLabel": "用户名", - "xpack.enterpriseSearch.nativeConnectors.mysql.name": "MySQL", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.hostLabel": "主机", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.retriesLabel": "根据请求重试", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.rowsFetchedLabel": "根据请求提取的行", - "xpack.enterpriseSearch.nativeConnectors.postgresql.configuration.tablesLabel": "表的逗号分隔列表", - "xpack.enterpriseSearch.nativeConnectors.postgresql.name": "PostgreSQL", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.clientIdLabel": "客户端 ID", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.secretValueLabel": "机密值", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.siteCollectionsLabel": "网站的逗号分隔列表", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.siteCollectionsTooltip": "要从中采集数据的网站的逗号分隔列表。使用 * 以包括所有可用网站。", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.tenantIdLabel": "租户 ID", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.tenantNameLabel": "租户名称", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.textExtractionServiceLabel": "使用文本提取服务", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.configuration.textExtractionServiceTooltip": "需要独立部署的 Elastic 数据提取服务。还需要管道设置禁用文本提取。", - "xpack.enterpriseSearch.nativeConnectors.sharepoint_online.name": "Sharepoint", "xpack.enterpriseSearch.nativeLabel": "原生", "xpack.enterpriseSearch.nav.analyticsCollections.explorerTitle": "浏览器", "xpack.enterpriseSearch.nav.analyticsCollections.integrationTitle": "集成", @@ -14511,9 +14445,6 @@ "xpack.enterpriseSearch.searchExperiences.navTitle": "搜索体验", "xpack.enterpriseSearch.searchExperiences.productDescription": "构建直观、具有吸引力的搜索体验,而无需浪费时间进行重复工作。", "xpack.enterpriseSearch.searchExperiences.productName": "搜索体验", - "xpack.enterpriseSearch.server.connectors.configuration.error": "找不到连接器", - "xpack.enterpriseSearch.server.connectors.scheduling.error": "无法找到文档", - "xpack.enterpriseSearch.server.connectors.serviceType.error": "无法找到文档", "xpack.enterpriseSearch.server.routes.addAnalyticsCollection.analyticsCollectionExistsError": "集合名称已存在。请选择其他名称。", "xpack.enterpriseSearch.server.routes.addAnalyticsCollection.analyticsCollectionNotFoundErrorMessage": "未找到分析集合", "xpack.enterpriseSearch.server.routes.addConnector.connectorExistsError": "连接器或索引已存在", diff --git a/yarn.lock b/yarn.lock index 3ff002d5dfe50..69e5329560e94 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5315,6 +5315,10 @@ version "0.0.0" uid "" +"@kbn/search-connectors@link:packages/kbn-search-connectors": + version "0.0.0" + uid "" + "@kbn/search-examples-plugin@link:examples/search_examples": version "0.0.0" uid ""