-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Developer guide - index patterns key concepts #96017
Merged
mattkime
merged 13 commits into
elastic:master
from
mattkime:key_concept_index_pattern_docs
Aug 15, 2021
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6f89a91
add index patterns key concepts
mattkime ffb2aa3
Merge branch 'master' into key_concept_index_pattern_docs
mattkime 7d1bde4
Merge branch 'master' into key_concept_index_pattern_docs
mattkime 24718f1
Merge branch 'master' into key_concept_index_pattern_docs
mattkime cca31ff
updated text
mattkime f432128
Merge branch 'master' into key_concept_index_pattern_docs
mattkime ab7e35b
add index pattern docs
mattkime b55513b
update docs
mattkime fa52479
remove unused graphic
mattkime 195b1b0
Merge branch 'master' into key_concept_index_pattern_docs
kibanamachine 514214e
Merge branch 'master' into key_concept_index_pattern_docs
mattkime b5fa86d
remove rest examples
mattkime 1c9f3a0
Merge branch 'key_concept_index_pattern_docs' of github.com:mattkime/…
mattkime File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should delete this completely? (also delete from plugin readme)
tutorials