Skip to content

Commit 3fdecf1

Browse files
lizozomelasticmachinegchaps
authored andcommitted
Data plugin README (#78750)
* data readme * Delete old readme (other folders don't have a README of their own. * generate asciidoc * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update README.md * Update plugin-list.asciidoc * gen plugin list * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> * Update src/plugins/data/README.md Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com> # Conflicts: # src/plugins/data/README.md
1 parent 6490428 commit 3fdecf1

4 files changed

Lines changed: 172 additions & 44 deletions

File tree

docs/developer/architecture/code-exploration.asciidoc

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Contains the dashboard application.
6565
6666
- {kib-repo}blob/{branch}/src/plugins/data/README.md[data]
6767
68-
data plugin provides common data access services.
68+
The data plugin provides common data access services, such as search and query, for solutions and application developers.
6969
7070
7171
- {kib-repo}blob/{branch}/src/plugins/dev_tools/README.md[devTools]
@@ -86,9 +86,9 @@ Contains the Discover application and the saved search embeddable.
8686
Embeddables are re-usable widgets that can be rendered in any environment or plugin. Developers can embed them directly in their plugin. End users can dynamically add them to any embeddable containers.
8787
8888
89-
- {kib-repo}blob/{branch}/src/plugins/es_ui_shared/README.md[esUiShared]
89+
- {kib-repo}blob/{branch}/src/plugins/es_ui_shared[esUiShared]
9090
91-
This plugin contains reusable code in the form of self-contained modules (or libraries). Each of these modules exports a set of functionality relevant to the domain of the module.
91+
WARNING: Missing README.
9292
9393
9494
- {kib-repo}blob/{branch}/src/plugins/expressions/README.md[expressions]
@@ -122,7 +122,7 @@ in Kibana, e.g. visualizations. It has the form of a flyout panel.
122122
123123
- {kib-repo}blob/{branch}/src/plugins/kibana_legacy/README.md[kibanaLegacy]
124124
125-
This plugin will contain several helpers and services to integrate pieces of the legacy Kibana app with the new Kibana platform.
125+
This plugin contains several helpers and services to integrate pieces of the legacy Kibana app with the new Kibana platform.
126126
127127
128128
- {kib-repo}blob/{branch}/src/plugins/kibana_react/README.md[kibanaReact]
@@ -217,12 +217,24 @@ which also contains the timelion APIs and backend, look at the vis_type_timelion
217217
An API for:
218218
219219
220+
- {kib-repo}blob/{branch}/src/plugins/url_forwarding/README.md[urlForwarding]
221+
222+
This plugins contains helpers to redirect legacy URLs. It can be used to forward old URLs to their new counterparts.
223+
224+
220225
- {kib-repo}blob/{branch}/src/plugins/usage_collection/README.md[usageCollection]
221226
222227
Usage Collection allows collecting usage data for other services to consume (telemetry and monitoring).
223228
To integrate with the telemetry services for usage collection of your feature, there are 2 steps:
224229
225230
231+
- {kib-repo}blob/{branch}/src/plugins/vis_default_editor/README.md[visDefaultEditor]
232+
233+
The default editor is used in most primary visualizations, e.x. Area, Data table, Pie, etc.
234+
It acts as a container for a particular visualization and options tabs. Contains the default "Data" tab in public/components/sidebar/data_tab.tsx.
235+
The plugin exposes the static DefaultEditorController class to consume.
236+
237+
226238
- {kib-repo}blob/{branch}/src/plugins/vis_type_markdown/README.md[visTypeMarkdown]
227239
228240
The markdown visualization that can be used to place text panels on dashboards.
@@ -349,9 +361,9 @@ WARNING: Missing README.
349361
You can run a local cluster and simulate a remote cluster within a single Kibana directory.
350362
351363
352-
- {kib-repo}blob/{branch}/x-pack/plugins/dashboard_enhanced/README.md[dashboardEnhanced]
364+
- {kib-repo}blob/{branch}/x-pack/plugins/dashboard_enhanced[dashboardEnhanced]
353365
354-
Contains the enhancements to the OSS dashboard app.
366+
WARNING: Missing README.
355367
356368
357369
- {kib-repo}blob/{branch}/x-pack/plugins/dashboard_mode/README.md[dashboardMode]
@@ -423,17 +435,20 @@ WARNING: Missing README.
423435
This is the main source folder of the Graph plugin. It contains all of the Kibana server and client source code. x-pack/test/functional/apps/graph contains additional functional tests.
424436
425437
426-
- {kib-repo}blob/{branch}/x-pack/plugins/grokdebugger/README.md[grokdebugger]
438+
- {kib-repo}blob/{branch}/x-pack/plugins/grokdebugger[grokdebugger]
439+
440+
WARNING: Missing README.
441+
427442
428443
- {kib-repo}blob/{branch}/x-pack/plugins/index_lifecycle_management/README.md[indexLifecycleManagement]
429444
430445
You can test that the Frozen badge, phase filtering, and lifecycle information is surfaced in
431446
Index Management by running this series of requests in Console:
432447
433448
434-
- {kib-repo}blob/{branch}/x-pack/plugins/index_management[indexManagement]
449+
- {kib-repo}blob/{branch}/x-pack/plugins/index_management/README.md[indexManagement]
435450
436-
WARNING: Missing README.
451+
Create a data stream using Console and you'll be able to view it in the UI:
437452
438453
439454
- {kib-repo}blob/{branch}/x-pack/plugins/infra/README.md[infra]
@@ -503,11 +518,6 @@ WARNING: Missing README.
503518
This plugin provides shared components and services for use across observability solutions, as well as the observability landing page UI.
504519
505520
506-
- {kib-repo}blob/{branch}/x-pack/plugins/oss_telemetry[ossTelemetry]
507-
508-
WARNING: Missing README.
509-
510-
511521
- {kib-repo}blob/{branch}/x-pack/plugins/painless_lab[painlessLab]
512522
513523
WARNING: Missing README.
@@ -581,6 +591,9 @@ As a developer you can reuse and extend built-in alerts and actions UI functiona
581591
582592
- {kib-repo}blob/{branch}/x-pack/plugins/ui_actions_enhanced/README.md[uiActionsEnhanced]
583593
594+
Registers commercially licensed generic actions like per panel time range and contains some code that supports drilldown work.
595+
596+
584597
- {kib-repo}blob/{branch}/x-pack/plugins/upgrade_assistant[upgradeAssistant]
585598
586599
WARNING: Missing README.
@@ -596,3 +609,13 @@ in their infrastructure.
596609
597610
This plugins adopts some conventions in addition to or in place of conventions in Kibana (at the time of the plugin's creation):
598611
612+
613+
- {kib-repo}blob/{branch}/x-pack/plugins/xpack_legacy/README.md[xpackLegacy]
614+
615+
Contains HTTP endpoints and UiSettings that are slated for removal.
616+
617+
618+
- {kib-repo}blob/{branch}/x-pack/plugins/drilldowns/url_drilldown/README.md[urlDrilldown]
619+
620+
NOTE: This plugin contains implementation of URL drilldown. For drilldowns infrastructure code refer to ui_actions_enhanced plugin.
621+

docs/developer/plugin-list.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ NOTE:
4848
4949
5050
|{kib-repo}blob/{branch}/src/plugins/data/README.md[data]
51-
|data plugin provides common data access services.
51+
|The data plugin provides common data access services, such as search and query, for solutions and application developers.
5252
5353
5454
|{kib-repo}blob/{branch}/src/plugins/dev_tools/README.md[devTools]

src/plugins/data/README.md

Lines changed: 134 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,137 @@
11
# data
22

3-
`data` plugin provides common data access services.
3+
The data plugin provides common data access services, such as `search` and `query`, for solutions and application developers.
44

5-
- `expressions` &mdash; run pipeline functions and render results.
6-
- `filter`
7-
- `index_patterns`
8-
- `query`
9-
- `search`
5+
## Autocomplete
6+
7+
The autocomplete service provides suggestions for field names and values.
8+
9+
It is wired into the `TopNavMenu` component, but can be used independently.
10+
11+
### Fetch Query Suggestions
12+
13+
The `getQuerySuggestions` function helps to construct a query.
14+
KQL suggestion functions are registered in X-Pack, so this API does not return results in OSS.
15+
16+
```.ts
17+
18+
// `inputValue` is the user input
19+
const querySuggestions = await autocomplete.getQuerySuggestions({
20+
language: 'kuery',
21+
indexPatterns: [indexPattern],
22+
query: inputValue,
23+
});
24+
25+
```
26+
27+
### Fetch Value Suggestions
28+
29+
The `getValueSuggestions` function returns suggestions for field values.
30+
This is helpful when you want to provide a user with options, for example when constructing a filter.
31+
32+
```.ts
33+
34+
// `inputValue` is the user input
35+
const valueSuggestions = await autocomplete.getValueSuggestions({
36+
indexPattern,
37+
field,
38+
query: inputValue,
39+
});
40+
41+
```
42+
43+
## Field Formats
44+
45+
Coming soon.
46+
47+
## Index Patterns
48+
49+
Coming soon.
50+
51+
## Query
52+
53+
The query service is responsible for managing the configuration of a search query (`QueryState`): filters, time range, query string, and settings such as the auto refresh behavior and saved queries.
54+
55+
It contains sub-services for each of those configurations:
56+
- `data.query.filterManager` - Manages the `filters` component of a `QueryState`. The global filter state (filters that are persisted between applications) are owned by this service.
57+
- `data.query.timefilter` - Responsible for the time range filter and the auto refresh behavior settings.
58+
- `data.query.queryString` - Responsible for the query string and query language settings.
59+
- `data.query.savedQueries` - Responsible for persisting a `QueryState` into a `SavedObject`, so it can be restored and used by other applications.
60+
61+
Any changes to the `QueryState` are published on the `data.query.state$`, which is useful when wanting to persist global state or run a search upon data changes.
62+
63+
A simple use case is:
64+
65+
```.ts
66+
function searchOnChange(indexPattern: IndexPattern, aggConfigs: AggConfigs) {
67+
data.query.state$.subscribe(() => {
68+
69+
// Constuct the query portion of the search request
70+
const query = data.query.getEsQuery(indexPattern);
71+
72+
// Construct a request
73+
const request = {
74+
params: {
75+
index: indexPattern.title,
76+
body: {
77+
aggs: aggConfigs.toDsl(),
78+
query,
79+
},
80+
},
81+
};
82+
83+
// Search with the `data.query` config
84+
const search$ = data.search.search(request);
85+
86+
...
87+
});
88+
}
89+
90+
```
91+
92+
## Search
93+
94+
Provides access to Elasticsearch using the high-level `SearchSource` API or low-level `Search Strategies`.
95+
96+
### SearchSource
97+
98+
The `SearchSource` API is a convenient way to construct and run an Elasticsearch search query.
99+
100+
```.tsx
101+
102+
const searchSource = await data.search.searchSource.create();
103+
const searchResponse = await searchSource
104+
.setParent(undefined)
105+
.setField('index', indexPattern)
106+
.setField('filter', filters)
107+
.fetch();
108+
109+
```
110+
111+
### Low-level search
112+
113+
#### Default Search Strategy
114+
115+
One benefit of using the low-level search API, is partial response support in X-Pack, allowing for a better and more responsive user experience.
116+
In OSS only the final result is returned.
117+
118+
```.ts
119+
import { isCompleteResponse } from '../plugins/data/public';
120+
121+
const search$ = data.search.search(request)
122+
.subscribe({
123+
next: (response) => {
124+
if (isCompleteResponse(response)) {
125+
// Final result
126+
search$.unsubscribe();
127+
} else {
128+
// Partial result - you can update the UI, but data is still loading
129+
}
130+
},
131+
error: (e: Error) => {
132+
// Show customized toast notifications.
133+
// You may choose to handle errors differently if you prefer.
134+
data.search.showError(e);
135+
},
136+
});
137+
```

src/plugins/data/public/search/README.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)