diff --git a/docs/maps/trouble-shooting.asciidoc b/docs/maps/trouble-shooting.asciidoc index 542138828530b..76383f8953a78 100644 --- a/docs/maps/trouble-shooting.asciidoc +++ b/docs/maps/trouble-shooting.asciidoc @@ -30,4 +30,9 @@ image::maps/images/inspector.png[] * Ensure your tile server has configured https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS[Cross-Origin Resource Sharing (CORS)] so tile requests from your Kibana domain have permission to access your tile server domain. * Ensure tiles have the required coordinate system. Vector data must use EPSG:4326 and tiles must use EPSG:3857. +[float] +==== Coordinate and region map visualizations not available in New Visualization menu + +Kibana’s out-of-the-box settings no longer offers coordinate and region maps as a choice in the New Visualization menu because you can create these maps in *Elastic Maps*. +If you want to create new coordinate and region map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`. diff --git a/docs/visualize/regionmap.asciidoc b/docs/visualize/regionmap.asciidoc index faecc207d81a7..c39282963ef7b 100644 --- a/docs/visualize/regionmap.asciidoc +++ b/docs/visualize/regionmap.asciidoc @@ -1,9 +1,12 @@ [[regionmap]] == Region Maps -Region maps are thematic maps in which boundary vector shapes are colored using a gradient: -higher intensity colors indicate larger values, and lower intensity colors indicate smaller values. -These are also known as choropleth maps. +Region maps are thematic maps in which boundary vector shapes are colored using a gradient: +higher intensity colors indicate larger values, and lower intensity colors indicate smaller values. +These are also known as choropleth maps. + +Kibana’s out-of-the-box settings do not show a region map in the New Visualization menu. Use <> instead, which offers more functionality and is easier to use. +If you want to create new region map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`. image::images/regionmap.png[] @@ -11,7 +14,7 @@ image::images/regionmap.png[] [[regionmap-configuration]] === Configuration -To create a region map, you configure an inner join that joins the result of an Elasticsearch terms aggregation +To create a region map, you configure an inner join that joins the result of an Elasticsearch terms aggregation and a reference vector file based on a shared key. [float] @@ -23,7 +26,7 @@ and a reference vector file based on a shared key. Select any of the supported _Metric_ or _Sibling Pipeline Aggregations_. [float] -===== Buckets +===== Buckets Configure a _Terms_ aggregation. The term is the _key_ that is used to join the results to the vector data on the map. @@ -35,7 +38,7 @@ Configure a _Terms_ aggregation. The term is the _key_ that is used to join the - *Vector map*: select from a list of vector maps. This list includes the maps that are hosted by the © https://www.elastic.co/elastic-maps-service[Elastic Maps Service], as well as your self-hosted layers that are configured in the *config/kibana.yml* file. To learn more about how to configure Kibana to make self-hosted layers available, see the <> documentation. You can also explore and preview vector layers available in Elastic Maps Service at https://maps.elastic.co[https://maps.elastic.co]. -- *Join field*: this is the property from the selected vector map that will be used to join on the terms in your terms-aggregation. +- *Join field*: this is the property from the selected vector map that will be used to join on the terms in your terms-aggregation. When terms cannot be joined to any of the shapes in the vector layer because there is no exact match in the vector layer, Kibana will display a warning. To turn of these warnings, go to *Management/Kibana/Advanced Settings* and set `visualization:regionmap:showWarnings` to `false`. @@ -46,4 +49,4 @@ To turn of these warnings, go to *Management/Kibana/Advanced Settings* and set ` [float] ===== Basic Settings - *Legend Position*: the location on the screen where the legend should be rendered. -- *Show Tooltip*: indicates whether a tooltip should be displayed when hovering over a shape.. \ No newline at end of file +- *Show Tooltip*: indicates whether a tooltip should be displayed when hovering over a shape.. diff --git a/docs/visualize/tilemap.asciidoc b/docs/visualize/tilemap.asciidoc index 157eb502bedb7..0e89704b8ba0b 100644 --- a/docs/visualize/tilemap.asciidoc +++ b/docs/visualize/tilemap.asciidoc @@ -3,7 +3,10 @@ A coordinate map displays a geographic area overlaid with circles keyed to the data determined by the buckets you specify. -NOTE: By default, Kibana uses the https://www.elastic.co/elastic-maps-service[Elastic Maps Service] +Kibana’s out-of-the-box settings do not show a coordinate map in the New Visualization menu. Use <> instead, which offers more functionality and is easier to use. +If you want to create new coordinate map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`. + +Kibana uses the https://www.elastic.co/elastic-maps-service[Elastic Maps Service] to display map tiles. To use other tile service providers, configure the <> in `kibana.yml`. diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts index 5dc0e452eea56..5d7ab12a677cf 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts @@ -42,6 +42,7 @@ const createSetupContract = (): VisualizationsSetup => ({ types: { registerVisualization: jest.fn(), registerAlias: jest.fn(), + hideTypes: jest.fn(), }, }); diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/types/types_service.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/types/types_service.ts index 1556c3716de1a..e0d26e3405048 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/types/types_service.ts +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/types/types_service.ts @@ -48,16 +48,30 @@ export interface VisType { */ export class TypesService { private types: Record = {}; + private unregisteredHiddenTypes: string[] = []; public setup() { return { registerVisualization: (registerFn: () => VisType) => { const visDefinition = registerFn(); + if (this.unregisteredHiddenTypes.includes(visDefinition.name)) { + visDefinition.hidden = true; + } + if (this.types[visDefinition.name]) { throw new Error('type already exists!'); } this.types[visDefinition.name] = visDefinition; }, registerAlias: visTypeAliasRegistry.add, + hideTypes: (typeNames: string[]) => { + typeNames.forEach((name: string) => { + if (this.types[name]) { + this.types[name].hidden = true; + } else { + this.unregisteredHiddenTypes.push(name); + } + }); + }, }; } diff --git a/x-pack/legacy/plugins/maps/index.js b/x-pack/legacy/plugins/maps/index.js index 3bb9d48741ab9..a8cc328e532e5 100644 --- a/x-pack/legacy/plugins/maps/index.js +++ b/x-pack/legacy/plugins/maps/index.js @@ -43,6 +43,7 @@ export function maps(kibana) { const mapConfig = serverConfig.get('map'); return { + showMapVisualizationTypes: serverConfig.get('xpack.maps.showMapVisualizationTypes'), showMapsInspectorAdapter: serverConfig.get('xpack.maps.showMapsInspectorAdapter'), preserveDrawingBuffer: serverConfig.get('xpack.maps.preserveDrawingBuffer'), isEmsEnabled: mapConfig.includeElasticMapsService, @@ -92,6 +93,7 @@ export function maps(kibana) { config(Joi) { return Joi.object({ enabled: Joi.boolean().default(true), + showMapVisualizationTypes: Joi.boolean().default(false), showMapsInspectorAdapter: Joi.boolean().default(false), // flag used in functional testing preserveDrawingBuffer: Joi.boolean().default(false), // flag used in functional testing }).default(); diff --git a/x-pack/legacy/plugins/maps/public/register_vis_type_alias.js b/x-pack/legacy/plugins/maps/public/register_vis_type_alias.js index 001bc5ca64fbd..009cff317fcaf 100644 --- a/x-pack/legacy/plugins/maps/public/register_vis_type_alias.js +++ b/x-pack/legacy/plugins/maps/public/register_vis_type_alias.js @@ -4,21 +4,35 @@ * you may not use this file except in compliance with the Elastic License. */ +import chrome from 'ui/chrome'; import { setup as visualizationsSetup } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy'; import { i18n } from '@kbn/i18n'; import { APP_ID, APP_ICON, MAP_BASE_URL } from '../common/constants'; +const showMapVisualizationTypes = chrome.getInjected('showMapVisualizationTypes', false); + +const description = i18n.translate('xpack.maps.visTypeAlias.description', { + defaultMessage: 'Create and style maps with multiple layers and indices.', +}); + +const legacyMapVisualizationWarning = i18n.translate('xpack.maps.visTypeAlias.legacyMapVizWarning', { + defaultMessage: `Use the Maps app instead of Coordinate Map and Region Map. +The Maps app offers more functionality and is easier to use.`, +}); + visualizationsSetup.types.registerAlias({ aliasUrl: MAP_BASE_URL, name: APP_ID, title: i18n.translate('xpack.maps.visTypeAlias.title', { defaultMessage: 'Maps', }), - description: i18n.translate('xpack.maps.visTypeAlias.description', { - defaultMessage: `Create and style maps with multiple layers and indices. -Use the Maps app instead of Coordinate Map and Region Map. -The Maps app offers more functionality and is easier to use.`, - }), + description: showMapVisualizationTypes + ? `${description} ${legacyMapVisualizationWarning}` + : description, icon: APP_ICON, stage: 'production', }); + +if (!showMapVisualizationTypes) { + visualizationsSetup.types.hideTypes(['region_map', 'tile_map']); +}