Skip to content

Commit 8e41038

Browse files
Merge branch '7.12' into backport/7.12/pr-92281
2 parents a821346 + 3f19221 commit 8e41038

34 files changed

Lines changed: 758 additions & 312 deletions

File tree

docs/api/using-api.asciidoc

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

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternselectprops.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ export declare type IndexPatternSelectProps = Required<Omit<EuiComboBoxProps<any
1212
indexPatternId: string;
1313
fieldTypes?: string[];
1414
onNoIndexPatterns?: () => void;
15+
maxIndexPatterns?: number;
1516
};
1617
```

docs/user/api.asciidoc

Lines changed: 82 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,99 @@
11
[[api]]
22
= REST API
33

4-
[partintro]
5-
--
64
Some {kib} features are provided via a REST API, which is ideal for creating an
75
integration with {kib}, or automating certain aspects of configuring and
86
deploying {kib}.
97

10-
Each API is experimental and can include breaking changes in any version of
11-
{kib}, or might be entirely removed from {kib}.
8+
[float]
9+
[[using-apis]]
10+
== Using the APIs
1211

13-
////
14-
Each API has one of the following labels:
12+
Interact with the {kib} APIs through the `curl` command and HTTP and HTTPs protocols.
1513

16-
* *Stable* APIs should be safe to use extensively in production. Any breaking
17-
changes to these APIs should only occur in major versions and will be
18-
clearly documented in the breaking changes documentation for that release.
14+
It is recommended that you use HTTPs on port 5601 because it is more secure.
1915

20-
* *Beta* APIs are on track to become stable, permanent features of {kib}.
21-
Caution should be exercised in their use since it is possible we'd have to make
22-
a breaking change to these APIs in a minor version, but we'll avoid this
23-
wherever possible.
16+
NOTE: The {kib} Console supports only Elasticsearch APIs. You are unable to interact with the {kib} APIs with the Console and must use `curl` or another HTTP tool instead. For more information, refer to <<console-kibana,Console>>.
2417

25-
* *Experimental* APIs are just that - an experiment. An experimental API might
26-
have breaking changes in any version of {kib}, or it might even be removed
27-
entirely.
18+
[float]
19+
[[api-authentication]]
20+
=== Authentication
21+
The {kib} APIs support key- and token-based authentication.
2822

29-
If a label is missing from an API, it is considered `experimental`.
30-
////
23+
[float]
24+
[[token-api-authentication]]
25+
==== Token-based authentication
26+
27+
To use token-based authentication, you use the same username and password that you use to log into Elastic.
28+
In a given HTTP tool, and when available, you can select to use its 'Basic Authentication' option,
29+
which is where the username and password are stored in order to be passed as part of the call.
30+
31+
[float]
32+
[[key-authentication]]
33+
==== Key-based authentication
34+
35+
To use key-based authentication, you create an API key using the Elastic Console, then specify the key in the header of your API calls.
36+
37+
For information about API keys, refer to <<api-keys,API keys>>.
38+
39+
[float]
40+
[[api-calls]]
41+
=== API calls
42+
API calls are stateless. Each request that you make happens in isolation from other calls and must include all of the necessary information for {kib} to fulfill the request. API requests return JSON output, which is a format that is machine-readable and works well for automation.
43+
44+
Calls to the API endpoints require different operations. To interact with the {kib} APIs, use the following operations:
45+
46+
* *GET* - Fetches the information.
47+
48+
* *POST* - Adds new information.
49+
50+
* *PUT* - Updates the existing information.
51+
52+
* *DELETE* - Removes the information.
53+
54+
For example, the following `curl` command exports a dashboard:
55+
56+
[source,sh]
57+
--------------------------------------------
58+
curl -X POST api/kibana/dashboards/export?dashboard=942dcef0-b2cd-11e8-ad8e-85441f0c2e5c
59+
--------------------------------------------
60+
// KIBANA
61+
62+
[float]
63+
[[api-request-headers]]
64+
=== Request headers
65+
66+
For all APIs, you must use a request header. The {kib} APIs support the `kbn-xsrf` and `Content-Type` headers.
67+
68+
`kbn-xsrf: true`::
69+
By default, you must use `kbn-xsrf` for all API calls, except in the following scenarios:
70+
71+
* The API endpoint uses the `GET` or `HEAD` operations
72+
* The path is allowed using the <<settings-xsrf-allowlist, `server.xsrf.allowlist`>> setting
73+
* XSRF protections are disabled using the <<settings-xsrf-disableProtection, `server.xsrf.disableProtection`>> setting
74+
75+
`Content-Type: application/json`::
76+
Applicable only when you send a payload in the API request. {kib} API requests and responses use JSON.
77+
Typically, if you include the `kbn-xsrf` header, you must also include the `Content-Type` header.
78+
79+
Request header example:
80+
81+
[source,sh]
82+
--------------------------------------------
83+
curl -X POST \
84+
http://localhost:5601/api/spaces/space \
85+
-H 'Content-Type: application/json' \
86+
-H 'kbn-xsrf: true' \
87+
-d '{
88+
"id": "sales",
89+
"name": "Sales",
90+
"description": "This is your Sales Space!",
91+
"disabledFeatures": []
92+
}
93+
'
94+
--------------------------------------------
3195

32-
--
3396

34-
include::{kib-repo-dir}/api/using-api.asciidoc[]
3597
include::{kib-repo-dir}/api/features.asciidoc[]
3698
include::{kib-repo-dir}/api/spaces-management.asciidoc[]
3799
include::{kib-repo-dir}/api/role-management.asciidoc[]

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@
7171
"**/cross-fetch/node-fetch": "^2.6.1",
7272
"**/deepmerge": "^4.2.2",
7373
"**/fast-deep-equal": "^3.1.1",
74-
"**/graphql-toolkit/lodash": "^4.17.15",
74+
"**/graphql-toolkit/lodash": "^4.17.21",
7575
"**/hoist-non-react-statics": "^3.3.2",
7676
"**/isomorphic-fetch/node-fetch": "^2.6.1",
7777
"**/istanbul-instrumenter-loader/schema-utils": "1.0.0",
78-
"**/load-grunt-config/lodash": "^4.17.20",
78+
"**/load-grunt-config/lodash": "^4.17.21",
7979
"**/minimist": "^1.2.5",
8080
"**/node-jose/node-forge": "^0.10.0",
8181
"**/prismjs": "1.22.0",
@@ -231,7 +231,7 @@
231231
"json-stringify-safe": "5.0.1",
232232
"jsonwebtoken": "^8.5.1",
233233
"load-json-file": "^6.2.0",
234-
"lodash": "^4.17.20",
234+
"lodash": "^4.17.21",
235235
"lru-cache": "^4.1.5",
236236
"markdown-it": "^10.0.0",
237237
"md5": "^2.1.0",

src/core/server/saved_objects/service/lib/search_dsl/search_dsl.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ describe('getSearchDsl', () => {
9696
mappings,
9797
opts.type,
9898
opts.sortField,
99-
opts.sortOrder,
100-
opts.pit
99+
opts.sortOrder
101100
);
102101
});
103102

src/core/server/saved_objects/service/lib/search_dsl/search_dsl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function getSearchDsl(
7878
hasReferenceOperator,
7979
kueryNode,
8080
}),
81-
...getSortingParams(mappings, type, sortField, sortOrder, pit),
81+
...getSortingParams(mappings, type, sortField, sortOrder),
8282
...(pit ? getPitParams(pit) : {}),
8383
...(searchAfter ? { search_after: searchAfter } : {}),
8484
};

src/core/server/saved_objects/service/lib/search_dsl/sorting_params.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ describe('searchDsl/getSortParams', () => {
7979
],
8080
});
8181
});
82-
it('appends tiebreaker when PIT is provided', () => {
83-
expect(getSortingParams(MAPPINGS, 'saved', 'title', undefined, { id: 'abc' }).sort).toEqual(
84-
expect.arrayContaining([{ _shard_doc: 'asc' }])
85-
);
86-
});
8782
});
8883
describe('sortField is simple root property with multiple types', () => {
8984
it('returns correct params', () => {
@@ -98,11 +93,6 @@ describe('searchDsl/getSortParams', () => {
9893
],
9994
});
10095
});
101-
it('appends tiebreaker when PIT is provided', () => {
102-
expect(
103-
getSortingParams(MAPPINGS, ['saved', 'pending'], 'type', undefined, { id: 'abc' }).sort
104-
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
105-
});
10696
});
10797
describe('sortField is simple non-root property with multiple types', () => {
10898
it('returns correct params', () => {
@@ -124,11 +114,6 @@ describe('searchDsl/getSortParams', () => {
124114
],
125115
});
126116
});
127-
it('appends tiebreaker when PIT is provided', () => {
128-
expect(
129-
getSortingParams(MAPPINGS, 'saved', 'title.raw', undefined, { id: 'abc' }).sort
130-
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
131-
});
132117
});
133118
describe('sortField is multi-field with single type as array', () => {
134119
it('returns correct params', () => {
@@ -143,11 +128,6 @@ describe('searchDsl/getSortParams', () => {
143128
],
144129
});
145130
});
146-
it('appends tiebreaker when PIT is provided', () => {
147-
expect(
148-
getSortingParams(MAPPINGS, ['saved'], 'title.raw', undefined, { id: 'abc' }).sort
149-
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
150-
});
151131
});
152132
describe('sortField is root multi-field with multiple types', () => {
153133
it('returns correct params', () => {
@@ -162,12 +142,6 @@ describe('searchDsl/getSortParams', () => {
162142
],
163143
});
164144
});
165-
it('appends tiebreaker when PIT is provided', () => {
166-
expect(
167-
getSortingParams(MAPPINGS, ['saved', 'pending'], 'type.raw', undefined, { id: 'abc' })
168-
.sort
169-
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
170-
});
171145
});
172146
describe('sortField is not-root multi-field with multiple types', () => {
173147
it('returns correct params', () => {

src/core/server/saved_objects/service/lib/search_dsl/sorting_params.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,14 @@
88

99
import Boom from '@hapi/boom';
1010
import { getProperty, IndexMapping } from '../../../mappings';
11-
import { SavedObjectsPitParams } from '../../../types';
12-
13-
// TODO: The plan is for ES to automatically add this tiebreaker when
14-
// using PIT. We should remove this logic once that is resolved.
15-
// https://github.com/elastic/elasticsearch/issues/56828
16-
const ES_PROVIDED_TIEBREAKER = { _shard_doc: 'asc' };
1711

1812
const TOP_LEVEL_FIELDS = ['_id', '_score'];
1913

2014
export function getSortingParams(
2115
mappings: IndexMapping,
2216
type: string | string[],
2317
sortField?: string,
24-
sortOrder?: string,
25-
pit?: SavedObjectsPitParams
18+
sortOrder?: string
2619
) {
2720
if (!sortField) {
2821
return {};
@@ -38,7 +31,6 @@ export function getSortingParams(
3831
order: sortOrder,
3932
},
4033
},
41-
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
4234
],
4335
};
4436
}
@@ -59,7 +51,6 @@ export function getSortingParams(
5951
unmapped_type: rootField.type,
6052
},
6153
},
62-
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
6354
],
6455
};
6556
}
@@ -84,7 +75,6 @@ export function getSortingParams(
8475
unmapped_type: field.type,
8576
},
8677
},
87-
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
8878
],
8979
};
9080
}

src/plugins/data/public/public.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,7 @@ export type IndexPatternSelectProps = Required<Omit<EuiComboBoxProps<any>, 'isLo
15371537
indexPatternId: string;
15381538
fieldTypes?: string[];
15391539
onNoIndexPatterns?: () => void;
1540+
maxIndexPatterns?: number;
15401541
};
15411542

15421543
// Warning: (ae-missing-release-tag) "IndexPatternSpec" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)

0 commit comments

Comments
 (0)