Skip to content

Commit 65cbbfe

Browse files
Merge branch '7.x' into backport/7.x/pr-59312
2 parents d00e2c7 + 50a84e3 commit 65cbbfe

83 files changed

Lines changed: 1809 additions & 732 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ kibanaPipeline(timeoutMinutes: 135) {
4040
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
4141
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
4242
'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
43+
'xpack-siemCypress': kibanaPipeline.functionalTestProcess('xpack-siemCypress', './test/scripts/jenkins_siem_cypress.sh'),
4344
// 'xpack-visualRegression': kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh'),
4445
]),
4546
])
84.5 KB
Loading

docs/management/snapshot-restore/index.asciidoc

Lines changed: 67 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
[[snapshot-repositories]]
33
== Snapshot and Restore
44

5-
*Snapshot and Restore* enables you to backup your {es}
6-
indices and clusters using data and state snapshots.
7-
Snapshots are important because they provide a copy of your data in case
5+
*Snapshot and Restore* enables you to backup your {es}
6+
indices and clusters using data and state snapshots.
7+
Snapshots are important because they provide a copy of your data in case
88
something goes wrong. If you need to roll back to an older version of your data,
99
you can restore a snapshot from the repository.
1010

11-
You’ll find *Snapshot and Restore* under *Management > Elasticsearch*.
11+
You’ll find *Snapshot and Restore* under *Management > Elasticsearch*.
1212
With this UI, you can:
1313

1414
* Register a repository for storing your snapshots
@@ -20,29 +20,42 @@ With this UI, you can:
2020
[role="screenshot"]
2121
image:management/snapshot-restore/images/snapshot_list.png["Snapshot list"]
2222

23-
Before using this feature, you should be familiar with how snapshots work.
24-
{ref}/snapshot-restore.html[Snapshot and Restore] is a good source for
23+
Before using this feature, you should be familiar with how snapshots work.
24+
{ref}/snapshot-restore.html[Snapshot and Restore] is a good source for
2525
more detailed information.
2626

27+
[float]
28+
[[snapshot-permissions]]
29+
=== Required permissions
30+
The minimum required permissions to access *Snapshot and Restore* include:
31+
32+
* Cluster privileges: `monitor`, `manage_slm`, `cluster:admin/snapshot`, and `cluster:admin/repository`
33+
* Index privileges: `all` on the `monitor` index if you want to access content in the *Restore Status* tab
34+
35+
You can add these privileges in *Management > Security > Roles*.
36+
37+
[role="screenshot"]
38+
image:management/snapshot-restore/images/snapshot_permissions.png["Edit Role"]
39+
2740
[float]
2841
[[kib-snapshot-register-repository]]
2942
=== Register a repository
30-
A repository is where your snapshots live. You must register a snapshot
31-
repository before you can perform snapshot and restore operations.
43+
A repository is where your snapshots live. You must register a snapshot
44+
repository before you can perform snapshot and restore operations.
3245

33-
If you don't have a repository, Kibana walks you through the process of
34-
registering one.
46+
If you don't have a repository, Kibana walks you through the process of
47+
registering one.
3548
{kib} supports three repository types
36-
out of the box: shared file system, read-only URL, and source-only.
37-
For more information on these repositories and their settings,
49+
out of the box: shared file system, read-only URL, and source-only.
50+
For more information on these repositories and their settings,
3851
see {ref}/snapshots-register-repository.html[Repositories].
39-
To use other repositories, such as S3, see
52+
To use other repositories, such as S3, see
4053
{ref}/snapshots-register-repository.html#snapshots-repository-plugins[Repository plugins].
4154

4255

43-
Once you create a repository, it is listed in the *Repositories*
44-
view.
45-
Click a repository name to view its type, number of snapshots, and settings,
56+
Once you create a repository, it is listed in the *Repositories*
57+
view.
58+
Click a repository name to view its type, number of snapshots, and settings,
4659
and to verify status.
4760

4861
[role="screenshot"]
@@ -53,46 +66,46 @@ image:management/snapshot-restore/images/repository_list.png["Repository list"]
5366
[[kib-view-snapshot]]
5467
=== View your snapshots
5568

56-
A snapshot is a backup taken from a running {es} cluster. You'll find an overview of
57-
your snapshots in the *Snapshots* view, and you can drill down
69+
A snapshot is a backup taken from a running {es} cluster. You'll find an overview of
70+
your snapshots in the *Snapshots* view, and you can drill down
5871
into each snapshot for further investigation.
5972

6073
[role="screenshot"]
6174
image:management/snapshot-restore/images/snapshot_details.png["Snapshot details"]
6275

63-
If you don’t have any snapshots, you can create them from the {kib} <<console-kibana, Console>>. The
76+
If you don’t have any snapshots, you can create them from the {kib} <<console-kibana, Console>>. The
6477
{ref}/snapshots-take-snapshot.html[snapshot API]
65-
takes the current state and data in your index or cluster, and then saves it to a
66-
shared repository.
78+
takes the current state and data in your index or cluster, and then saves it to a
79+
shared repository.
6780

68-
The snapshot process is "smart." Your first snapshot is a complete copy of
81+
The snapshot process is "smart." Your first snapshot is a complete copy of
6982
the data in your index or cluster.
70-
All subsequent snapshots save the changes between the existing snapshots and
83+
All subsequent snapshots save the changes between the existing snapshots and
7184
the new data.
7285

7386
[float]
7487
[[kib-restore-snapshot]]
7588
=== Restore a snapshot
7689

77-
The information stored in a snapshot is not tied to a specific
90+
The information stored in a snapshot is not tied to a specific
7891
cluster or a cluster name. This enables you to
79-
restore a snapshot made from one cluster to another cluster. You might
92+
restore a snapshot made from one cluster to another cluster. You might
8093
use the restore operation to:
8194

8295
* Recover data lost due to a failure
8396
* Migrate a current Elasticsearch cluster to a new version
8497
* Move data from one cluster to another cluster
8598

86-
To get started, go to the *Snapshots* view, find the
87-
snapshot, and click the restore icon in the *Actions* column.
99+
To get started, go to the *Snapshots* view, find the
100+
snapshot, and click the restore icon in the *Actions* column.
88101
The Restore wizard presents
89-
options for the restore operation, including which
102+
options for the restore operation, including which
90103
indices to restore and whether to modify the index settings.
91-
You can restore an existing index only if it’s closed and has the same
104+
You can restore an existing index only if it’s closed and has the same
92105
number of shards as the index in the snapshot.
93106

94107
Once you initiate the restore, you're navigated to the *Restore Status* view,
95-
where you can track the current state for each shard in the snapshot.
108+
where you can track the current state for each shard in the snapshot.
96109

97110
[role="screenshot"]
98111
image:management/snapshot-restore/images/snapshot-restore.png["Snapshot details"]
@@ -102,26 +115,26 @@ image:management/snapshot-restore/images/snapshot-restore.png["Snapshot details"
102115
[[kib-snapshot-policy]]
103116
=== Create a snapshot lifecycle policy
104117

105-
Use a {ref}/snapshot-lifecycle-management-api.html[snapshot lifecycle policy]
106-
to automate the creation and deletion
118+
Use a {ref}/snapshot-lifecycle-management-api.html[snapshot lifecycle policy]
119+
to automate the creation and deletion
107120
of cluster snapshots. Taking automatic snapshots:
108121

109122
* Ensures your {es} indices and clusters are backed up on a regular basis
110-
* Ensures a recent and relevant snapshot is available if a situation
123+
* Ensures a recent and relevant snapshot is available if a situation
111124
arises where a cluster needs to be recovered
112-
* Allows you to manage your snapshots in {kib}, instead of using a
125+
* Allows you to manage your snapshots in {kib}, instead of using a
113126
third-party tool
114-
115-
If you don’t have any snapshot policies, follow the
116-
*Create policy* wizard. It walks you through defining
117-
when and where to take snapshots, the settings you want,
127+
128+
If you don’t have any snapshot policies, follow the
129+
*Create policy* wizard. It walks you through defining
130+
when and where to take snapshots, the settings you want,
118131
and how long to retain snapshots.
119132

120133
[role="screenshot"]
121134
image:management/snapshot-restore/images/snapshot-retention.png["Snapshot details"]
122135

123136
An overview of your policies is on the *Policies* view.
124-
You can drill down into each policy to examine its settings and last successful and failed run.
137+
You can drill down into each policy to examine its settings and last successful and failed run.
125138

126139
You can perform the following actions on a snapshot policy:
127140

@@ -139,8 +152,8 @@ image:management/snapshot-restore/images/create-policy.png["Snapshot details"]
139152
=== Delete a snapshot
140153

141154
Delete snapshots to manage your repository storage space.
142-
Find the snapshot in the *Snapshots* view and click the trash icon in the
143-
*Actions* column. To delete snapshots in bulk, select their checkboxes,
155+
Find the snapshot in the *Snapshots* view and click the trash icon in the
156+
*Actions* column. To delete snapshots in bulk, select their checkboxes,
144157
and then click *Delete snapshots*.
145158

146159
[[snapshot-repositories-example]]
@@ -159,10 +172,10 @@ Ready to try *Snapshot and Restore*? In this tutorial, you'll learn to:
159172

160173
==== Before you begin
161174

162-
This example shows you how to register a shared file system repository
175+
This example shows you how to register a shared file system repository
163176
and store snapshots.
164-
Before you begin, you must register the location of the repository in the
165-
{ref}/snapshots-register-repository.html#snapshots-filesystem-repository[path.repo] setting on
177+
Before you begin, you must register the location of the repository in the
178+
{ref}/snapshots-register-repository.html#snapshots-filesystem-repository[path.repo] setting on
166179
your master and data nodes. You can do this in one of two ways:
167180

168181
* Edit your `elasticsearch.yml` to include the `path.repo` setting.
@@ -175,14 +188,14 @@ your master and data nodes. You can do this in one of two ways:
175188
[[register-repo-example]]
176189
==== Register a repository
177190

178-
Use *Snapshot and Restore* to register the repository where your snapshots
179-
will live.
191+
Use *Snapshot and Restore* to register the repository where your snapshots
192+
will live.
180193

181194
. Go to *Management > Elasticsearch > Snapshot and Restore*.
182195
. Click *Register a repository* in either the introductory message or *Repository view*.
183196
. Enter a name for your repository, for example, `my_backup`.
184197
. Select *Shared file system*.
185-
+
198+
+
186199
[role="screenshot"]
187200
image:management/snapshot-restore/images/register_repo.png["Register repository"]
188201

@@ -205,13 +218,13 @@ Use the {ref}/snapshots-take-snapshot.html[snapshot API] to create a snapshot.
205218
[source,js]
206219
PUT /_snapshot/my_backup/2019-04-25_snapshot?wait_for_completion=true
207220
+
208-
In this example, the snapshot name is `2019-04-25_snapshot`. You can also
221+
In this example, the snapshot name is `2019-04-25_snapshot`. You can also
209222
use {ref}/date-math-index-names.html[date math expression] for the snapshot name.
210223
+
211224
[role="screenshot"]
212225
image:management/snapshot-restore/images/create_snapshot.png["Create snapshot"]
213226

214-
. Return to *Snapshot and Restore*.
227+
. Return to *Snapshot and Restore*.
215228
+
216229
Your new snapshot is available in the *Snapshots* view.
217230

@@ -223,7 +236,7 @@ using the repository created in the previous example.
223236

224237
. Open the *Policies* view.
225238
. Click *Create a policy*.
226-
+
239+
+
227240
[role="screenshot"]
228241
image:management/snapshot-restore/images/create-policy-example.png["Create policy wizard"]
229242

@@ -288,17 +301,16 @@ Finally, you'll restore indices from an existing snapshot.
288301
|*Index&nbsp;settings* |
289302

290303
|Modify&nbsp;index&nbsp;settings
291-
|Toggle to overwrite index settings when they are restored,
304+
|Toggle to overwrite index settings when they are restored,
292305
or leave in place to keep existing settings.
293306

294307
|Reset&nbsp;index&nbsp;settings
295-
|Toggle to reset index settings back to the default when they are restored,
308+
|Toggle to reset index settings back to the default when they are restored,
296309
or leave in place to keep existing settings.
297310
|===
298311

299312
. Review your restore settings, and then click *Restore snapshot*.
300313
+
301-
The operation loads for a few seconds,
302-
and then you’re navigated to *Restore Status*,
314+
The operation loads for a few seconds,
315+
and then you’re navigated to *Restore Status*,
303316
where you can monitor the status of your restored indices.
304-

docs/setup/settings.asciidoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,6 @@ deprecation warning at startup. This setting cannot end in a slash (`/`).
331331
proxy sitting in front of it. This determines whether HTTP compression may be used for responses, based on the request's `Referer` header.
332332
This setting may not be used when `server.compression.enabled` is set to `false`.
333333

334-
[[server-cors]]`server.cors:`:: *Default: `false`* Set to `true` to enable CORS support. This setting is required to configure `server.cors.origin`.
335-
336-
`server.cors.origin:`:: *Default: none* Specifies origins. “origin” must be an array. To use this setting, you must set `server.cors` to `true`. To accept all origins, use `server.cors.origin: ["*"]`.
337-
338334
`server.customResponseHeaders:`:: *Default: `{}`* Header names and values to
339335
send on all responses to the client from the {kib} server.
340336

src/core/public/http/fetch.test.ts

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import fetchMock from 'fetch-mock/es5/client';
2222
import { readFileSync } from 'fs';
2323
import { join } from 'path';
24+
import { first } from 'rxjs/operators';
2425

2526
import { Fetch } from './fetch';
2627
import { BasePath } from './base_path';
@@ -30,16 +31,91 @@ function delay<T>(duration: number) {
3031
return new Promise<T>(r => setTimeout(r, duration));
3132
}
3233

34+
const BASE_PATH = 'http://localhost/myBase';
35+
3336
describe('Fetch', () => {
3437
const fetchInstance = new Fetch({
35-
basePath: new BasePath('http://localhost/myBase'),
38+
basePath: new BasePath(BASE_PATH),
3639
kibanaVersion: 'VERSION',
3740
});
3841
afterEach(() => {
3942
fetchMock.restore();
4043
fetchInstance.removeAllInterceptors();
4144
});
4245

46+
describe('getRequestCount$', () => {
47+
const getCurrentRequestCount = () =>
48+
fetchInstance
49+
.getRequestCount$()
50+
.pipe(first())
51+
.toPromise();
52+
53+
it('should increase and decrease when request receives success response', async () => {
54+
fetchMock.get('*', 200);
55+
56+
const fetchResponse = fetchInstance.fetch('/path');
57+
expect(await getCurrentRequestCount()).toEqual(1);
58+
59+
await expect(fetchResponse).resolves.not.toThrow();
60+
expect(await getCurrentRequestCount()).toEqual(0);
61+
});
62+
63+
it('should increase and decrease when request receives error response', async () => {
64+
fetchMock.get('*', 500);
65+
66+
const fetchResponse = fetchInstance.fetch('/path');
67+
expect(await getCurrentRequestCount()).toEqual(1);
68+
69+
await expect(fetchResponse).rejects.toThrow();
70+
expect(await getCurrentRequestCount()).toEqual(0);
71+
});
72+
73+
it('should increase and decrease when request fails', async () => {
74+
fetchMock.get('*', Promise.reject('Network!'));
75+
76+
const fetchResponse = fetchInstance.fetch('/path');
77+
expect(await getCurrentRequestCount()).toEqual(1);
78+
79+
await expect(fetchResponse).rejects.toThrow();
80+
expect(await getCurrentRequestCount()).toEqual(0);
81+
});
82+
83+
it('should change for multiple requests', async () => {
84+
fetchMock.get(`${BASE_PATH}/success`, 200);
85+
fetchMock.get(`${BASE_PATH}/fail`, 400);
86+
fetchMock.get(`${BASE_PATH}/network-fail`, Promise.reject('Network!'));
87+
88+
const requestCounts: number[] = [];
89+
const subscription = fetchInstance
90+
.getRequestCount$()
91+
.subscribe(count => requestCounts.push(count));
92+
93+
const success1 = fetchInstance.fetch('/success');
94+
const success2 = fetchInstance.fetch('/success');
95+
const failure1 = fetchInstance.fetch('/fail');
96+
const failure2 = fetchInstance.fetch('/fail');
97+
const networkFailure1 = fetchInstance.fetch('/network-fail');
98+
const success3 = fetchInstance.fetch('/success');
99+
const failure3 = fetchInstance.fetch('/fail');
100+
const networkFailure2 = fetchInstance.fetch('/network-fail');
101+
102+
const swallowError = (p: Promise<any>) => p.catch(() => {});
103+
await Promise.all([
104+
success1,
105+
success2,
106+
success3,
107+
swallowError(failure1),
108+
swallowError(failure2),
109+
swallowError(failure3),
110+
swallowError(networkFailure1),
111+
swallowError(networkFailure2),
112+
]);
113+
114+
expect(requestCounts).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0]);
115+
subscription.unsubscribe();
116+
});
117+
});
118+
43119
describe('http requests', () => {
44120
it('should fail with invalid arguments', async () => {
45121
fetchMock.get('*', {});

0 commit comments

Comments
 (0)