Update doc slugs to improve analytic tracking, move to appropriate folders (#113630)

* Update the slugs to improve google analytics drilldown tracking

* more slug updates

* Fix some formatting issues in building blocks

* update paths

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Stacey Gammon 2021-10-04 13:36:45 -04:00 committed by GitHub
parent a4eab441c0
commit eddbc8db6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 219 additions and 218 deletions

View file

@ -1,5 +1,5 @@
# Contributing to Kibana
If you are an employee at Elastic, please check out our Developer Guide [here](https://docs.elastic.dev/kibana-dev-docs/welcome).
If you are an employee at Elastic, please check out our Developer Guide [here](https://docs.elastic.dev/kibana-dev-docs/getting-started/welcome).
If you are an external developer, we have a legacy developer guide [here](https://www.elastic.co/guide/en/kibana/master/development.html), or you can view the raw docs from our new, internal Developer Guide [here](./dev_docs/getting_started/dev_welcome.mdx). Eventually, our internal Developer Guide will be opened for public consumption.

View file

@ -1,6 +1,6 @@
---
id: kibStyleGuide
slug: /kibana-dev-docs/styleguide
slug: /kibana-dev-docs/contributing/styleguide
title: Style Guide
summary: JavaScript/TypeScript styleguide.
date: 2021-05-06

View file

@ -1,6 +1,6 @@
---
id: kibDevDocsApiWelcome
slug: /kibana-dev-docs/api-welcome
slug: /kibana-dev-docs/api-meta/welcome
title: Welcome
summary: How to use our automatically generated API documentation
date: 2021-02-25

View file

@ -1,6 +1,6 @@
---
id: kibBestPractices
slug: /kibana-dev-docs/best-practices
slug: /kibana-dev-docs/contributing/best-practices
title: Best practices
summary: Best practices to follow when building a Kibana plugin.
date: 2021-03-17

View file

@ -1,10 +1,10 @@
---
id: kibDevPrinciples
slug: /kibana-dev-docs/dev-principles
slug: /kibana-dev-docs/contributing/dev-principles
title: Developer principles
summary: Follow our development principles to help keep our code base stable, maintainable and scalable.
date: 2021-03-04
tags: ['kibana','onboarding', 'dev', 'architecture']
tags: ['kibana', 'onboarding', 'dev', 'architecture']
---
Over time, the Kibana project has been shaped by certain principles. Like Kibana itself, some of these principles were formed by intention while others were the result of evolution and circumstance, but today all are important for the continued success and maintainability of Kibana.

View file

@ -1,6 +1,6 @@
---
id: kibGitHub
slug: /kibana-dev-docs/github
slug: /kibana-dev-docs/contributing/github
title: How we use Github
summary: Forking, branching, committing and using labels in the Kibana GitHub repo
date: 2021-09-16

View file

@ -1,6 +1,6 @@
---
id: kibDevAddData
slug: /kibana-dev-docs/tutorial/sample-data
slug: /kibana-dev-docs/getting-started/sample-data
title: Add data
summary: Learn how to add data to Kibana
date: 2021-08-11

View file

@ -1,6 +1,6 @@
---
id: kibDevDocsWelcome
slug: /kibana-dev-docs/welcome
slug: /kibana-dev-docs/getting-started/welcome
title: Welcome
summary: Build custom solutions and applications on top of Kibana.
date: 2021-01-02

View file

@ -1,6 +1,6 @@
---
id: kibHelloWorldApp
slug: /kibana-dev-docs/hello-world-app
slug: /kibana-dev-docs/getting-started/hello-world-app
title: Hello World
summary: Build a very basic plugin that registers an application that says "Hello World!".
date: 2021-08-03

View file

@ -1,6 +1,6 @@
---
id: kibDevTutorialSetupDevEnv
slug: /kibana-dev-docs/tutorial/setup-dev-env
slug: /kibana-dev-docs/getting-started/setup-dev-env
title: Set up a Development Environment
summary: Learn how to setup a development environment for contributing to the Kibana repository
date: 2021-04-26

View file

@ -1,6 +1,6 @@
---
id: kibTroubleshooting
slug: /kibana-dev-docs/troubleshooting
slug: /kibana-dev-docs/getting-started/troubleshooting
title: Troubleshooting
summary: A collection of tips for working around strange issues.
date: 2021-09-08

View file

@ -1,6 +1,6 @@
---
id: kibDevAnatomyOfAPlugin
slug: /kibana-dev-docs/anatomy-of-a-plugin
slug: /kibana-dev-docs/key-concepts/anatomy-of-a-plugin
title: Anatomy of a plugin
summary: Anatomy of a Kibana plugin.
date: 2021-08-03

View file

@ -1,26 +1,28 @@
---
id: kibBuildingBlocks
slug: /kibana-dev-docs/building-blocks
slug: /kibana-dev-docs/key-concepts/building-blocks
title: Building blocks
summary: Consider these building blocks when developing your plugin.
date: 2021-02-24
tags: ['kibana','onboarding', 'dev', 'architecture']
tags: ['kibana', 'onboarding', 'dev', 'architecture']
---
When building a plugin in Kibana, there are a handful of architectural "building blocks" you can use. Some of these building blocks are "higher-level",
and some are "lower-level". High-level building blocks come
with many built-in capabilities, require less maintenance, and evolve new feature sets over time with little to no
impact on consumers. When developers use high-level building blocks, new features are exposed consistently, across all of Kibana, at the same time.
On the downside, they are not as flexible as our low-level building blocks.
impact on consumers. When developers use high-level building blocks, new features are exposed consistently, across all of Kibana, at the same time.
On the downside, they are not as flexible as our low-level building blocks.
Low-level building blocks
provide greater flexibility, but require more code to stitch them together into a meaningful UX. This results in higher maintenance cost for consumers and greater UI/UX variability
across Kibana.
Low-level building blocks
provide greater flexibility, but require more code to stitch them together into a meaningful UX. This results in higher maintenance cost for consumers and greater UI/UX variability
across Kibana.
For example, if an application is using <DocLink id="kibBuildingBlocks" section="index-patterns" text="Index Patterns"/> and
<DocLink id="kibBuildingBlocks" section="search-source" text="Search Source"/>,
their application would automatically support runtime fields. If the app is instead using the
lower-level <DocLink id="kibBuildingBlocks" section="search-strategy" text="Search Strategy"/>, additional work would be required.
For example, if an application is using <DocLink id="kibBuildingBlocks" section="index-patterns" text="Index Patterns"/> and <DocLink id="kibBuildingBlocks" section="search-source" text="Search Source" />, their application would
automatically support runtime fields. If the app is instead using the lower-level <DocLink
id="kibBuildingBlocks"
section="search-strategy"
text="Search Strategy"
/>, additional work would be required.
Armed with this knowledge, you can choose what works best for your use case!
@ -33,22 +35,14 @@ The following high-level building blocks can be rendered directly into your appl
### Query Bar
The <DocLink id="kibDataPlugin" text="Data plugin"/> provides a high-level Query Bar component that comes with support for Lucene, KQL, Saved Queries,
and <DocLink id="kibBuildingBlocks" section="index-patterns" text="Index Patterns"/>.
If you would like to expose the ability to search and filter on Elasticsearch data, the Query Bar provided by the
<DocLink id="kibDataPlugin" text="Data plugin"/>
is your go-to building block.
and <DocLink id="kibBuildingBlocks" section="index-patterns" text="Index Patterns"/>. If you would like to expose the ability to search and filter on Elasticsearch data, the Query Bar provided by the <DocLink id="kibDataPlugin" text="Data plugin" /> is your go-to building block.
**Github labels**: `Team:AppServices`, `Feature:QueryBar`
### Dashboard Embeddable
Add a Dashboard Embeddable directly inside your application to provide users with a set of visualizations and graphs that work seamlessly
with the <DocLink id="kibBuildingBlocks" section="query-bar" text="Query Bar"/>. Every feature that is added to a registered
<DocLink id="kibBuildingBlocks" section="embeddables" text="Embeddable"/>
(Lens, Maps, Saved Searches and more) will be available automatically, as well as any
<DocLink id="kibBuildingBlocks" section="ui-actions--triggers" text="UI Actions"/> that are
added to the Embeddable context menu panel (for example, drilldowns, custom panel time ranges, and "share to" features).
with the <DocLink id="kibBuildingBlocks" section="query-bar" text="Query Bar"/>. Every feature that is added to a registered <DocLink id="kibBuildingBlocks" section="embeddables" text="Embeddable" /> (Lens, Maps, Saved Searches and more) will be available automatically, as well as any <DocLink id="kibBuildingBlocks" section="ui-actions--triggers" text="UI Actions" /> that are added to the Embeddable context menu panel (for example, drilldowns, custom panel time ranges, and "share to" features).
The Dashboard Embeddable is one of the highest-level UI components you can add to your application.
@ -56,11 +50,7 @@ The Dashboard Embeddable is one of the highest-level UI components you can add t
### Lens Embeddable
Check out the Lens Embeddable if you wish to show users visualizations based on Elasticsearch data without worrying about query building and chart rendering. It's built on top of the
<DocLink id="kibBuildingBlocks" section="expressions" text="Expression language"/>, and integrates with
<DocLink id="kibBuildingBlocks" section="index-patterns" text="Index Patterns"/>
and <DocLink id="kibBuildingBlocks" section="ui-actions--triggers" text="UI Actions"/>. Using the same configuration, it's also possible to link to
a prefilled Lens editor, allowing the user to drill deeper and explore their data.
Check out the Lens Embeddable if you wish to show users visualizations based on Elasticsearch data without worrying about query building and chart rendering. It's built on top of the <DocLink id="kibBuildingBlocks" section="expressions" text="Expression language" />, and integrates with <DocLink id="kibBuildingBlocks" section="index-patterns" text="Index Patterns" /> and <DocLink id="kibBuildingBlocks" section="ui-actions--triggers" text="UI Actions" />. Using the same configuration, it's also possible to link to a prefilled Lens editor, allowing the user to drill deeper and explore their data.
**Github labels**: `Team:VisEditors`, `Feature:Lens`
@ -82,10 +72,11 @@ Check out <DocLink id="kibDevDocsKPTTutorial" text="the KibanaPageTemplate tutor
### Index Patterns
<DocLink id="kibDataPlugin" section="index-patterns-api" text="Index Patterns"/> are a high-level, space-aware abstraction layer that sits
above Data Streams and Elasticsearch indices. Index Patterns provide users the
ability to define and customize the data they wish to search and filter on, on a per-space basis. For example, users can specify a set of indices,
and they can customize the field list with runtime fields, formatting options and custom labels.
<DocLink id="kibDataPlugin" section="index-patterns-api" text="Index Patterns" /> are a high-level, space-aware
abstraction layer that sits above Data Streams and Elasticsearch indices. Index Patterns provide users
the ability to define and customize the data they wish to search and filter on, on a per-space basis.
For example, users can specify a set of indices, and they can customize the field list with runtime fields,
formatting options and custom labels.
Index Patterns are used in many other high-level building blocks so we highly recommend you consider this building block for your search needs.
@ -93,11 +84,16 @@ Index Patterns are used in many other high-level building blocks so we highly re
### Search Source
<DocLink id="kibDataPlugin" section="searchsource" text="Search Source"/> is a high-level search service offered by the
<DocLink id="kibDataPlugin" section="searchsource" text="Data plugin"/>. It requires an
<DocLink id="kibBuildingBlocks" section="index-patterns" text="Index Pattern"/>, and abstracts away the raw ES DSL and search endpoint. Internally
it uses the ES <DocLink id="kibBuildingBlocks" section="search-strategies" text="Search Strategy"/>. Use Search Source if you need to query data
from Elasticsearch, and you aren't already using one of the high-level UI Components that handles this internally.
<DocLink id="kibDataPlugin" section="searchsource" text="Search Source" /> is a high-level search service
offered by the <DocLink id="kibDataPlugin" section="searchsource" text="Data plugin" />. It requires
an <DocLink id="kibBuildingBlocks" section="index-patterns" text="Index Pattern" />, and abstracts away
the raw ES DSL and search endpoint. Internally it uses the ES <DocLink
id="kibBuildingBlocks"
section="search-strategies"
text="Search Strategy"
/>
. Use Search Source if you need to query data from Elasticsearch, and you aren't already using one of
the high-level UI Components that handles this internally.
**Github labels**: `Team:AppServices`, `Feature:Search`
@ -112,24 +108,24 @@ languages, like EQL and SQL. These are very low-level building blocks so expect
### Expressions
Expressions are a low-level building block that can be used if you have advanced search needs that requiring piping results into additional functionality, like
joining and manipulating data. Lens and Canvas are built on top of Expressions. Most developers should be able to use
<DocLink id="kibBuildingBlocks" section="lens-embeddable" text="Lens"/> or
<DocLink id="kibBuildingBlocks" section="search-source" text="Search Source"/>, rather than need to access the Expression language directly.
joining and manipulating data. Lens and Canvas are built on top of Expressions. Most developers should be able to use <DocLink id="kibBuildingBlocks" section="lens-embeddable" text="Lens" /> or <DocLink id="kibBuildingBlocks" section="search-source" text="Search Source" />, rather than need to
access the Expression language directly.{' '}
**Github labels**: `Team:AppServices`, `Feature:ExpressionLanguage`
## Saved Objects
<DocLink id="kibDevDocsSavedObjectsIntro" text="Saved Objects" /> should be used if you need to persist application-level information. If you were building a TODO
application, each TODO item would be a `Saved Object`. Saved objects come pre-wired with support for bulk export/import, security features like space sharing and
space isolation, and tags.
<DocLink id="kibDevDocsSavedObjectsIntro" text="Saved Objects" /> should be used if you need to persist
application-level information. If you were building a TODO application, each TODO item would be a `Saved
Object`. Saved objects come pre-wired with support for bulk export/import, security features like space
sharing and space isolation, and tags.
**Github labels**: `Team:Core`, `Feature:Saved Objects`
# Integration building blocks
Use the following building blocks to create an inter-connected, cross-application, holistic Kibana experience. These building blocks allow you to expose functionality
that promotes your own application into other applications, as well as help developers of other applications integrate into your app.
that promotes your own application into other applications, as well as help developers of other applications integrate into your app.
## UI Actions & Triggers

View file

@ -1,13 +1,13 @@
---
id: kibDataViewsKeyConcepts
slug: /kibana-dev-docs/data-view-intro
slug: /kibana-dev-docs/key-concepts/data-view-intro
title: Data Views
summary: Data views are the central method of defining queryable data sets in Kibana
date: 2021-08-11
tags: ['kibana','dev', 'contributor', 'api docs']
tags: ['kibana', 'dev', 'contributor', 'api docs']
---
*Note: Kibana index patterns are currently being renamed to data views. There will be some naming inconsistencies until the transition is complete.*
_Note: Kibana index patterns are currently being renamed to data views. There will be some naming inconsistencies until the transition is complete._
Data views (formerly Kibana index patterns or KIPs) are the central method of describing sets of indices for queries. Usage is strongly recommended
as a number of high level <DocLink id="kibBuildingBlocks" text="building blocks"/> rely on them. Further, they provide a consistent view of data across
@ -20,8 +20,6 @@ on the data view via runtime fields. Schema-on-read functionality is provided by
![image](../assets/data_view_diagram.png)
The data view API is made available via the data plugin (`data.indexPatterns`, soon to be renamed) and most commonly used with <DocLink id="kibDevTutorialDataSearchAndSessions" section="high-level-search" text="SearchSource" />
(`data.search.search.SearchSource`) to perform queries. SearchSource will apply existing filters and queries from the search bar UI.
@ -29,4 +27,3 @@ Users can create data views via [Data view management](https://www.elastic.co/gu
Additionally, they can be created through the data view API.
Data views also allow formatters and custom labels to be defined for fields.

View file

@ -1,6 +1,6 @@
---
id: kibPlatformIntro
slug: /kibana-dev-docs/platform-intro
slug: /kibana-dev-docs/key-concepts/platform-intro
title: Plugins and the Kibana platform
summary: An introduction to the Kibana platform and how to use it to build a plugin.
date: 2021-01-06

View file

@ -1,6 +1,6 @@
---
id: kibDevPerformance
slug: /kibana-dev-docs/performance
slug: /kibana-dev-docs/key-concepts/performance
title: Performance
summary: Performance tips for Kibana development.
date: 2021-09-02
@ -9,13 +9,13 @@ tags: ['kibana', 'onboarding', 'dev', 'performance']
## Keep Kibana fast
*tl;dr*: Load as much code lazily as possible. Everyone loves snappy
_tl;dr_: Load as much code lazily as possible. Everyone loves snappy
applications with a responsive UI and hates spinners. Users deserve the
best experience whether they run Kibana locally or
in the cloud, regardless of their hardware and environment.
There are 2 main aspects of the perceived speed of an application: loading time
and responsiveness to user actions. Kibana loads and bootstraps *all*
and responsiveness to user actions. Kibana loads and bootstraps _all_
the plugins whenever a user lands on any page. It means that
every new application affects the overall _loading performance_, as plugin code is
loaded _eagerly_ to initialize the plugin and provide plugin API to dependent
@ -101,7 +101,7 @@ node scripts/build_kibana_platform_plugins.js --dist --no-examples --profile
Many OSS tools allow you to analyze the generated stats file:
* [An official tool](https://webpack.github.io/analyse/#modules) from
Webpack authors
* [webpack-visualizer](https://chrisbateman.github.io/webpack-visualizer/)
* [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)
- [An official tool](https://webpack.github.io/analyse/#modules) from
Webpack authors
- [webpack-visualizer](https://chrisbateman.github.io/webpack-visualizer/)
- [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer)

View file

@ -1,13 +1,13 @@
---
id: kibDevDocsPersistableStateIntro
slug: /kibana-dev-docs/persistable-state-intro
slug: /kibana-dev-docs/key-concepts/persistable-state-intro
title: Persistable State
summary: Persitable state is a key concept to understand when building a Kibana plugin.
date: 2021-02-02
tags: ['kibana','dev', 'contributor', 'api docs']
tags: ['kibana', 'dev', 'contributor', 'api docs']
---
“Persistable state” is developer-defined state that supports being persisted by a plugin other than the one defining it. Persistable State needs to be serializable and the owner can/should provide utilities to migrate it, extract and inject any <DocLink id="kibDevDocsSavedObjectsIntro" section="references" text="references to Saved Objects"/> it may contain, as well as telemetry collection utilities.
“Persistable state” is developer-defined state that supports being persisted by a plugin other than the one defining it. Persistable State needs to be serializable and the owner can/should provide utilities to migrate it, extract and inject any <DocLink id="kibDevDocsSavedObjectsIntro" section="references" text="references to Saved Objects"/> it may contain, as well as telemetry collection utilities.
## Exposing state that can be persisted
@ -29,6 +29,7 @@ stores a bunch of embeddable panels input in its saved object and URL. Embeddabl
interface and each `EmbeddableFactory` needs to implement `PersistableStateDefinition` interface.
Embeddable plugin exposes this interfaces:
```
// EmbeddableInput implements Serializable
@ -64,7 +65,11 @@ note: Currently there is no recommended way on how to store version in url and i
In order to support import and export, and space-sharing capabilities, Saved Objects need to explicitly list any references they contain to other Saved Objects.
To support persisting your state in saved objects owned by another plugin, the <DocLink id="kibKibanaUtilsPluginApi" section="def-common.PersistableState.extract" text="`extract`"/> and <DocLink id="kibKibanaUtilsPluginApi" section="def-common.PersistableState.inject" text="`inject`"/> methods of Persistable State interface should be implemented.
<DocLink id="kibDevTutorialSavedObject" section="references" text="Learn how to define Saved Object references"/>
<DocLink
id="kibDevTutorialSavedObject"
section="references"
text="Learn how to define Saved Object references"
/>
[See example embeddable providing extract/inject functions](https://github.com/elastic/kibana/blob/master/examples/embeddable_examples/public/migrations/migrations_embeddable_factory.ts)
@ -72,7 +77,7 @@ To support persisting your state in saved objects owned by another plugin, the <
As your plugin evolves, you may need to change your state in a breaking way. If that happens, you should write a migration to upgrade the state that existed prior to the change.
<DocLink id="kibDevTutorialSavedObject" section="migrations" text="How to write a migration"/>.
<DocLink id="kibDevTutorialSavedObject" section="migrations" text="How to write a migration" />.
[See an example saved object storing embeddable state implementing saved object migration function](https://github.com/elastic/kibana/blob/master/examples/embeddable_examples/server/searchable_list_saved_object.ts)

View file

@ -1,39 +1,42 @@
---
id: kibDevDocsSavedObjectsIntro
slug: /kibana-dev-docs/saved-objects-intro
slug: /kibana-dev-docs/key-concepts/saved-objects-intro
title: Saved Objects
summary: Saved Objects are a key concept to understand when building a Kibana plugin.
date: 2021-02-02
tags: ['kibana','dev', 'contributor', 'api docs']
tags: ['kibana', 'dev', 'contributor', 'api docs']
---
"Saved Objects" are developer defined, persisted entities, stored in the Kibana system index (which is also sometimes referred to as the `.kibana` index).
The Saved Objects service allows Kibana plugins to use Elasticsearch like a primary database. Think of it as an Object Document Mapper for Elasticsearch.
Some examples of Saved Object types are dashboards, lens, canvas workpads, index patterns, cases, ml jobs, and advanced settings. Some Saved Object types are
exposed to the user in the [Saved Object management UI](https://www.elastic.co/guide/en/kibana/current/managing-saved-objects.html), but not all.
Some examples of Saved Object types are dashboards, lens, canvas workpads, index patterns, cases, ml jobs, and advanced settings. Some Saved Object types are
exposed to the user in the [Saved Object management UI](https://www.elastic.co/guide/en/kibana/current/managing-saved-objects.html), but not all.
Developers create and manage their Saved Objects using the SavedObjectClient, while other data in Elasticsearch should be accessed via the data plugin's search
services.
![image](../assets/saved_object_vs_data_indices.png)
<DocLink id="kibDevTutorialSavedObject" text="Tutorial: Register a new Saved Object type"/>
<DocLink id="kibDevTutorialSavedObject" text="Tutorial: Register a new Saved Object type" />
## References
In order to support import and export, and space-sharing capabilities, Saved Objects need to explicitly list any references they contain to other Saved Objects.
The parent should have a reference to it's children, not the other way around. That way when a "parent" is exported (or shared to a space),
all the "children" will be automatically included. However, when a "child" is exported, it will not include all "parents".
all the "children" will be automatically included. However, when a "child" is exported, it will not include all "parents".
<DocLink id="kibDevTutorialSavedObject" section="references" text="Learn how to define Saved Object references"/>
<DocLink
id="kibDevTutorialSavedObject"
section="references"
text="Learn how to define Saved Object references"
/>
## Migrations and Backward compatibility
As your plugin evolves, you may need to change your Saved Object type in a breaking way (for example, changing the type of an attribtue, or removing
an attribute). If that happens, you should write a migration to upgrade the Saved Objects that existed prior to the change.
<DocLink id="kibDevTutorialSavedObject" section="migrations" text="How to write a migration"/>.
<DocLink id="kibDevTutorialSavedObject" section="migrations" text="How to write a migration" />.
## Security
@ -67,10 +70,10 @@ in Elasticsearch data indices.
## Saved Objects by value
Sometimes Saved Objects end up persisted inside another Saved Object. We call these Saved Objects “by value”, as opposed to "by
reference". If an end user creates a visualization and adds it to a dashboard without saving it to the visualization
library, the data ends up nested inside the dashboard Saved Object. This helps keep the visualization library smaller. It also avoids
issues with edits propagating - since an entity can only exist in a single place.
Note that from the end user stand point, we dont use these terms “by reference” and “by value”.
reference". If an end user creates a visualization and adds it to a dashboard without saving it to the visualization
library, the data ends up nested inside the dashboard Saved Object. This helps keep the visualization library smaller. It also avoids
issues with edits propagating - since an entity can only exist in a single place.
Note that from the end user stand point, we dont use these terms “by reference” and “by value”.
## Sharing Saved Objects
@ -80,7 +83,7 @@ on how it is registered.
If you are adding a **new** object type, when you register it:
1. Use `namespaceType: 'multiple-isolated'` to make these objects exist in exactly one space
2. Use `namespaceType: 'multiple'` to make these objects exist in one *or more* spaces
2. Use `namespaceType: 'multiple'` to make these objects exist in one _or more_ spaces
3. Use `namespaceType: 'agnostic'` if you want these objects to always exist in all spaces
If you have an **existing** "legacy" object type that is not shareable (using `namespaceType: 'single'`), see the [legacy developer guide

View file

@ -1,6 +1,6 @@
---
id: kibDevTutorialBuildingDistributable
slug: /kibana-dev-docs/tutorial/building-distributable
slug: /kibana-dev-docs/tutorials/building-distributable
title: Building a Kibana distributable
summary: Learn how to build a Kibana distributable
date: 2021-05-10

View file

@ -69,10 +69,10 @@ Note: The `data` plugin contains services to help you generate the `query` and `
The `search` method can throw several types of errors, for example:
- `EsError` for errors originating in Elasticsearch errors
- `PainlessError` for errors originating from a Painless script
- `AbortError` if the search was aborted via an `AbortController`
- `HttpError` in case of a network error
- `EsError` for errors originating in Elasticsearch errors
- `PainlessError` for errors originating from a Painless script
- `AbortError` if the search was aborted via an `AbortController`
- `HttpError` in case of a network error
To display the errors in the context of an application, use the helper method provided on the `data.search` service. These errors are shown in a toast message, using the `core.notifications` service.
@ -82,7 +82,7 @@ data.search.search(req).subscribe({
error: (e) => {
data.search.showError(e);
},
})
});
```
If you decide to handle errors by yourself, watch for errors coming from `Elasticsearch`. They have an additional `attributes` property that holds the raw error from `Elasticsearch`.
@ -95,7 +95,7 @@ data.search.search(req).subscribe({
showErrorReason(e.attributes);
}
},
})
});
```
#### Stop a running search
@ -106,9 +106,11 @@ The search service `search` method supports a second argument called `options`.
import { AbortError } from '../../src/data/public';
const abortController = new AbortController();
data.search.search(req, {
data.search
.search(req, {
abortSignal: abortController.signal,
}).subscribe({
})
.subscribe({
next: (result) => {
// handle result
},
@ -119,7 +121,7 @@ data.search.search(req, {
}
// handle error, for example a server hangup
},
});
});
// Abort the search request after a second
setTimeout(() => {
@ -135,13 +137,15 @@ For example, to run an EQL query using the `data.search` service, you should to
```ts
const req = getEqlRequest();
data.search.search(req, {
data.search
.search(req, {
strategy: EQL_SEARCH_STRATEGY,
}).subscribe({
})
.subscribe({
next: (result) => {
// handle EQL result
},
});
});
```
##### Custom search strategies
@ -161,11 +165,11 @@ export const mySearchStrategyProvider = (
): ISearchStrategy<IMyStrategyRequest, IMyStrategyResponse> => {
const preprocessRequest = (request: IMyStrategyRequest) => {
// Custom preprocessing
}
};
const formatResponse = (response: IMyStrategyResponse) => {
// Custom post-processing
}
};
// Get the default search strategy
const es = data.search.getSearchStrategy(ES_SEARCH_STRATEGY);
@ -179,11 +183,7 @@ export const mySearchStrategyProvider = (
```ts
// ./myPlugin/server/plugin.ts
import type {
CoreSetup,
CoreStart,
Plugin,
} from 'kibana/server';
import type { CoreSetup, CoreStart, Plugin } from 'kibana/server';
import { mySearchStrategyProvider } from './my_strategy';
@ -202,10 +202,7 @@ export interface MyPluginStartDeps {
* In your custom server side plugin, register the strategy from the setup contract
*/
export class MyPlugin implements Plugin {
public setup(
core: CoreSetup<MyPluginStartDeps>,
deps: MyPluginSetupDeps
) {
public setup(core: CoreSetup<MyPluginStartDeps>, deps: MyPluginSetupDeps) {
core.getStartServices().then(([_, depsStart]) => {
const myStrategy = mySearchStrategyProvider(depsStart.data);
deps.data.search.registerSearchStrategy('myCustomStrategy', myStrategy);
@ -217,13 +214,15 @@ export class MyPlugin implements Plugin {
```ts
// ./myPlugin/public/plugin.ts
const req = getRequest();
data.search.search(req, {
data.search
.search(req, {
strategy: 'myCustomStrategy',
}).subscribe({
})
.subscribe({
next: (result) => {
// handle result
},
});
});
```
##### Async search and custom async search strategies
@ -310,7 +309,7 @@ data.search.search(req).subscribe({
renderPartialResult(res);
}
},
})
});
// Skipping partial results
const finalResult = await data.search.search(req).toPromise();
@ -324,12 +323,12 @@ Search sessions are handy when you want to enable a user to run something asynch
Internally, any search run within a search session is saved into an object, allowing Kibana to manage their lifecycle. Most saved objects are deleted automatically after a short period of time, but if a user chooses to save the search session, the saved object is persisted, so that results can be restored in a later time.
Stored search sessions are listed in the *Management* application, under *Kibana > Search Sessions*, making it easy to find, manage, and restore them.
Stored search sessions are listed in the _Management_ application, under _Kibana > Search Sessions_, making it easy to find, manage, and restore them.
As a developer, you might encounter these two common, use cases:
* Running a search inside an existing search session
* Supporting search sessions in your application
- Running a search inside an existing search session
- Supporting search sessions in your application
#### Running a search inside an existing search session
@ -340,9 +339,7 @@ Because the Dashboard application is already managing a search session, all you
The search information will be added to the saved object for the search session.
```ts
export class SearchEmbeddable
extends Embeddable<MyInput, MyOutput> {
export class SearchEmbeddable extends Embeddable<MyInput, MyOutput> {
private async fetchData() {
// Every embeddable receives an optional `searchSessionId` input parameter.
const { searchSessionId } = this.input;
@ -355,9 +352,11 @@ export class SearchEmbeddable
this.updateOutput({ loading: true, error: undefined });
// Make the request, wait for the final result
const {rawResponse: resp} = await searchSource.fetch$({
const { rawResponse: resp } = await searchSource
.fetch$({
sessionId: searchSessionId,
}).toPromise();
})
.toPromise();
this.useSearchResult(resp);
@ -368,7 +367,6 @@ export class SearchEmbeddable
}
}
}
```
You can also retrieve the active `Search Session ID` from the `Search Service` directly:
@ -376,18 +374,21 @@ You can also retrieve the active `Search Session ID` from the `Search Service` d
```ts
async function fetchData(data: DataPublicPluginStart) {
try {
return await searchSource.fetch$({
return await searchSource
.fetch$({
sessionId: data.search.sessions.getSessionId(),
}).toPromise();
})
.toPromise();
} catch (e) {
// handle search errors
}
}
```
<DocCallOut title="Search Sessions with Server Side Search">
Search sessions are initiated by the client. If you are using a route that runs server side searches, you can send the `searchSessionId` to the server, and then pass it down to the server side `data.search` function call.
Search sessions are initiated by the client. If you are using a route that runs server side
searches, you can send the `searchSessionId` to the server, and then pass it down to the server
side `data.search` function call.
</DocCallOut>
#### Supporting search sessions in your application
@ -409,8 +410,8 @@ export class MyPlugin implements Plugin {
public start(core: CoreStart, { data }: MyPluginStartDependencies) {
const sessionRestorationDataProvider: SearchSessionInfoProvider = {
data,
getDashboard
}
getDashboard,
};
data.search.session.enableStorage({
getName: async () => {
@ -430,11 +431,16 @@ export class MyPlugin implements Plugin {
```
<DocCallOut title="Search sessions restore state">
The restore state of a search session may be different from the initial state used to create it. For example, where the initial state may contain relative dates, in the restore state, those must be converted to absolute dates. Read more about the [NowProvider]().
The restore state of a search session may be different from the initial state used to create it.
For example, where the initial state may contain relative dates, in the restore state, those must
be converted to absolute dates. Read more about the [NowProvider]().
</DocCallOut>
<DocCallOut color="danger" title="Search sessions indicator">
Calling `enableStorage` will also enable the `Search Session Indicator` component in the chrome component of your solution. The `Search Session Indicator` is a small button, used by default to engage users and save new search sessions. To implement your own UI, contact the Kibana application services team to decouple this behavior.
Calling `enableStorage` will also enable the `Search Session Indicator` component in the chrome
component of your solution. The `Search Session Indicator` is a small button, used by default to
engage users and save new search sessions. To implement your own UI, contact the Kibana
application services team to decouple this behavior.
</DocCallOut>
##### Start a new search session
@ -442,11 +448,9 @@ export class MyPlugin implements Plugin {
Make sure to call `start` when the **state** you previously defined changes.
```ts
function onSearchSessionConfigChange() {
this.searchSessionId = data.search.sessions.start();
}
```
Pass the `searchSessionId` to every `search` call inside your application. If you're using `Embeddables`, pass down the `searchSessionId` as `input`.
@ -455,7 +459,6 @@ If you can't pass the `searchSessionId` directly, you can retrieve it from the s
```ts
const currentSearchSessionId = data.search.sessions.getSessionId();
```
##### Clear search sessions
@ -466,7 +469,6 @@ Creating a new search session clears the previous one. You must explicitly `clea
function onDestroy() {
data.search.session.clear();
}
```
If you don't call `clear`, you will see a warning in the console while developing. However, when running in production, you will get a fatal error. This is done to avoid leakage of unrelated search requests into an existing search session left open by mistake.
@ -478,7 +480,6 @@ The last step of the integration is restoring an existing search session. The `
If you detect the presense of a `searchSessionId` parameter in the URL, call the `restore` method **instead** of calling `start`. The previous example would now become:
```ts
function onSearchSessionConfigChange(searchSessionIdFromUrl?: string) {
if (searchSessionIdFromUrl) {
data.search.sessions.restore(searchSessionIdFromUrl);
@ -486,7 +487,6 @@ function onSearchSessionConfigChange(searchSessionIdFromUrl?: string) {
data.search.sessions.start();
}
}
```
Once you `restore` the session, as long as all `search` requests run with the same `searchSessionId`, the search session should be seamlessly restored.

View file

@ -1,6 +1,6 @@
---
id: kibDevTutorialDebugging
slug: /kibana-dev-docs/tutorial/debugging
slug: /kibana-dev-docs/tutorials/debugging
title: Debugging in development
summary: Learn how to debug Kibana while running from source
date: 2021-04-26

View file

@ -1,6 +1,6 @@
---
id: kibDevTutorialSavedObject
slug: /kibana-dev-docs/tutorial/saved-objects
slug: /kibana-dev-docs/tutorials/saved-objects
title: Register a new saved object type
summary: Learn how to register a new saved object type.
date: 2021-02-05

View file

@ -1,6 +1,6 @@
---
id: kibDevTutorialSubmitPullRequest
slug: /kibana-dev-docs/tutorial/submit-pull-request
slug: /kibana-dev-docs/tutorials/submit-pull-request
title: Submitting a Kibana pull request
summary: Learn how to submit a Kibana pull request
date: 2021-06-24

View file

@ -1,6 +1,6 @@
---
id: kibDevTutorialTestingPlugins
slug: /kibana-dev-docs/tutorial/testing-plugins
slug: /kibana-dev-docs/tutorials/testing-plugins
title: Testing Kibana Plugins
summary: Learn how to test different aspects of Kibana plugins
date: 2021-07-05

View file

@ -1,3 +1,3 @@
# Kibana RFCs
We no longer follow this RFC process. Internal developers should review the new RFC process in our [internal developer guide](https://docs.elastic.dev/kibana-team/rfc-process)
We no longer follow this RFC process. Internal developers should review the new RFC process in our [internal developer guide](https://docs.elastic.dev/kibana-dev-docs/contributing/rfc-process)

View file

@ -1,6 +1,6 @@
---
id: kibDataPlugin
slug: /kibana-dev-docs/services/data-plugin
slug: /kibana-dev-docs/key-concepts/data-plugin
title: Data services
image: https://source.unsplash.com/400x175/?Search
summary: The data plugin contains services for searching, querying and filtering.

View file

@ -1,6 +1,6 @@
---
id: kibUsageCollectionPlugin
slug: /kibana-dev-docs/services/usage-collection-plugin
slug: /kibana-dev-docs/key-concepts/usage-collection-plugin
title: Usage collection service
summary: The Usage Collection Service defines a set of APIs for other plugins to report the usage of their features.
date: 2021-02-24