Skip to content

Commit

Permalink
Merge branch 'master' into add-savedobject-migrations-part-2
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Aug 16, 2021
2 parents 8395976 + a4ba1c9 commit ff1bd2a
Show file tree
Hide file tree
Showing 424 changed files with 12,107 additions and 6,284 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
/examples/ui_actions_explorer/ @elastic/kibana-app-services
/examples/url_generators_examples/ @elastic/kibana-app-services
/examples/url_generators_explorer/ @elastic/kibana-app-services
/examples/field_formats_example/ @elastic/kibana-app-services
/packages/elastic-datemath/ @elastic/kibana-app-services
/packages/kbn-interpreter/ @elastic/kibana-app-services
/src/plugins/bfetch/ @elastic/kibana-app-services
Expand Down
Binary file added dev_docs/assets/data_view_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions dev_docs/key_concepts/data_views.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
id: kibDataViewsKeyConcepts
slug: /kibana-dev-docs/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']
---

*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
a variety Kibana apps.

Data views are defined by a wildcard string (an index pattern) which matches indices, data streams, and index aliases, optionally specify a
timestamp field for time series data, and are stored as a <DocLink id="kibDevDocsSavedObjectsIntro"
text="saved object"/>. They have a field list which comprises all the fields in matching indices plus fields defined specifically
on the data view via runtime fields. Schema-on-read functionality is provided by data view defined runtime fields.

![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.

Users can create data views via [Data view management](https://www.elastic.co/guide/en/kibana/current/index-patterns.html).
Additionally, they can be created through the data view API.

Data views also allow formatters and custom labels to be defined for fields.

86 changes: 86 additions & 0 deletions dev_docs/tutorials/data_views.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
id: kibDevTutorialDataViews
slug: /kibana-dev-docs/tutorials/data-views
title: Data views API
summary: Data views API
date: 2021-08-11
tags: ['kibana', 'onboarding', 'dev', 'architecture']
---

*Note: Kibana index patterns are currently being renamed to data views. There will be some naming inconsistencies until the transition is complete.*

### Data views API

- Get list of data views
- Get default data view and examine fields
- Get data view by id
- Find data view by title
- Create data view
- Create data view and save it
- Modify data view and save it
- Delete data view

#### Get list of data view titles and ids

```
const idsAndTitles = await data.indexPatterns.getIdsWithTitle();
idsAndTitles.forEach(({id, title}) => console.log(`Data view id: ${id} title: ${title}`));
```

#### Get default data view and examine fields

```
const defaultDataView = await data.indexPatterns.getDefault();
defaultDataView.fields.forEach(({name}) => { console.log(name); })
```

#### Get data view by id

```
const id = 'xxxxxx-xxx-xxxxxx';
const dataView = await data.indexPatterns.get(id);
```

#### Find data view by title

```
const title = 'kibana-*';
const [dataView] = await data.indexPatterns.find(title);
```

#### Create data view

```
const dataView = await data.indexPatterns.create({ title: 'kibana-*' });
```

#### Create data view and save it immediately

```
const dataView = await data.indexPatterns.createAndSave({ title: 'kibana-*' });
```

#### Create data view, modify, and save

```
const dataView = await data.indexPatterns.create({ title: 'kibana-*' });
dataView.setFieldCustomLabel('customer_name', 'Customer Name');
data.indexPatterns.createSavedObject(dataView);
```

#### Modify data view and save it

```
dataView.setFieldCustomLabel('customer_name', 'Customer Name');
await data.indexPatterns.updateSavedObject(dataView);
```

#### Delete index pattern

```
await data.indexPatterns.delete(dataViewId);
```

### Data view HTTP API

Rest-like HTTP CRUD+ API - [docs](https://www.elastic.co/guide/en/kibana/master/index-patterns-api.html)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsClient](./kibana-plugin-core-server.deprecationsclient.md) &gt; [getAllDeprecations](./kibana-plugin-core-server.deprecationsclient.getalldeprecations.md)

## DeprecationsClient.getAllDeprecations property

<b>Signature:</b>

```typescript
getAllDeprecations: () => Promise<DomainDeprecationDetails[]>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsClient](./kibana-plugin-core-server.deprecationsclient.md)

## DeprecationsClient interface

Server-side client that provides access to fetch all Kibana deprecations

<b>Signature:</b>

```typescript
export interface DeprecationsClient
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [getAllDeprecations](./kibana-plugin-core-server.deprecationsclient.getalldeprecations.md) | <code>() =&gt; Promise&lt;DomainDeprecationDetails[]&gt;</code> | |

1 change: 1 addition & 0 deletions docs/development/core/server/kibana-plugin-core-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [DeprecationAPIClientParams](./kibana-plugin-core-server.deprecationapiclientparams.md) | |
| [DeprecationAPIResponse](./kibana-plugin-core-server.deprecationapiresponse.md) | |
| [DeprecationInfo](./kibana-plugin-core-server.deprecationinfo.md) | |
| [DeprecationsClient](./kibana-plugin-core-server.deprecationsclient.md) | Server-side client that provides access to fetch all Kibana deprecations |
| [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) | |
| [DeprecationSettings](./kibana-plugin-core-server.deprecationsettings.md) | UiSettings deprecation field options. |
| [DeprecationsServiceSetup](./kibana-plugin-core-server.deprecationsservicesetup.md) | The deprecations service provides a way for the Kibana platform to communicate deprecated features and configs with its users. These deprecations are only communicated if the deployment is using these features. Allowing for a user tailored experience for upgrading the stack version.<!-- -->The Deprecation service is consumed by the upgrade assistant to assist with the upgrade experience.<!-- -->If a deprecated feature can be resolved without manual user intervention. Using correctiveActions.api allows the Upgrade Assistant to use this api to correct the deprecation upon a user trigger. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ core: {
uiSettings: {
client: IUiSettingsClient;
};
deprecations: {
client: DeprecationsClient;
};
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ export interface RequestHandlerContext

| Property | Type | Description |
| --- | --- | --- |
| [core](./kibana-plugin-core-server.requesthandlercontext.core.md) | <code>{</code><br/><code> savedObjects: {</code><br/><code> client: SavedObjectsClientContract;</code><br/><code> typeRegistry: ISavedObjectTypeRegistry;</code><br/><code> getClient: (options?: SavedObjectsClientProviderOptions) =&gt; SavedObjectsClientContract;</code><br/><code> getExporter: (client: SavedObjectsClientContract) =&gt; ISavedObjectsExporter;</code><br/><code> getImporter: (client: SavedObjectsClientContract) =&gt; ISavedObjectsImporter;</code><br/><code> };</code><br/><code> elasticsearch: {</code><br/><code> client: IScopedClusterClient;</code><br/><code> legacy: {</code><br/><code> client: ILegacyScopedClusterClient;</code><br/><code> };</code><br/><code> };</code><br/><code> uiSettings: {</code><br/><code> client: IUiSettingsClient;</code><br/><code> };</code><br/><code> }</code> | |
| [core](./kibana-plugin-core-server.requesthandlercontext.core.md) | <code>{</code><br/><code> savedObjects: {</code><br/><code> client: SavedObjectsClientContract;</code><br/><code> typeRegistry: ISavedObjectTypeRegistry;</code><br/><code> getClient: (options?: SavedObjectsClientProviderOptions) =&gt; SavedObjectsClientContract;</code><br/><code> getExporter: (client: SavedObjectsClientContract) =&gt; ISavedObjectsExporter;</code><br/><code> getImporter: (client: SavedObjectsClientContract) =&gt; ISavedObjectsImporter;</code><br/><code> };</code><br/><code> elasticsearch: {</code><br/><code> client: IScopedClusterClient;</code><br/><code> legacy: {</code><br/><code> client: ILegacyScopedClusterClient;</code><br/><code> };</code><br/><code> };</code><br/><code> uiSettings: {</code><br/><code> client: IUiSettingsClient;</code><br/><code> };</code><br/><code> deprecations: {</code><br/><code> client: DeprecationsClient;</code><br/><code> };</code><br/><code> }</code> | |

10 changes: 10 additions & 0 deletions examples/field_formats_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Field formats example

Field formats is a service used by index patterns for applying custom formatting to values in a document.
Field formats service can also be used separately from index patterns.

This example plugin shows:

1. How field formats can be used for formatting values
2. How to create a custom field format and make it available in index pattern field editor
3. How to create a custom editor for a custom field formatter
12 changes: 12 additions & 0 deletions examples/field_formats_example/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"id": "fieldFormatsExample",
"version": "1.0.0",
"kibanaVersion": "kibana",
"ui": true,
"owner": {
"name": "App Services",
"githubTeam": "kibana-app-services"
},
"description": "A plugin that demonstrates field formats usage",
"requiredPlugins": ["developerExamples", "fieldFormats", "indexPatternFieldEditor", "data"]
}
Loading

0 comments on commit ff1bd2a

Please sign in to comment.