Skip to content

Commit 21b05ae

Browse files
authored
Merge branch 'main' into siem-ea-11005
2 parents de2d156 + 7b81bcf commit 21b05ae

161 files changed

Lines changed: 1268 additions & 8084 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.

docs/api/synthetics/monitors/delete-monitor-api.asciidoc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@ Deletes one or more monitors from the Synthetics app.
1717
You must have `all` privileges for the *Synthetics* feature in the *{observability}* section of the
1818
<<kibana-feature-privileges,{kib} feature privileges>>.
1919

20-
You must have `all` privileges for the *Synthetics* feature in the *{observability}* section of the
21-
<<kibana-feature-privileges,{kib} feature privileges>>.
22-
2320

2421
[[delete-monitor-api-path-params]]
2522
=== {api-path-parms-title}
2623

2724
`config_id`::
2825
(Required, string) The ID of the monitor that you want to delete.
2926

30-
3127
Here is an example of a DELETE request to delete a monitor by ID:
3228

3329
[source,sh]
@@ -37,7 +33,7 @@ DELETE /api/synthetics/monitors/monitor1-id
3733

3834
==== Bulk Delete Monitors
3935

40-
You can delete multiple monitors by sending a list of config ids to a DELETE request to the `/api/synthetics/monitors` endpoint.
36+
You can delete multiple monitors by sending a list of config ids to a POST request to the `/api/synthetics/monitors/_bulk_delete` endpoint.
4137

4238

4339
[[monitors-delete-request-body]]
@@ -49,11 +45,11 @@ The request body should contain an array of monitors IDs that you want to delete
4945
(Required, array of strings) An array of monitor IDs to delete.
5046

5147

52-
Here is an example of a DELETE request to delete a list of monitors by ID:
48+
Here is an example of a POST request to delete a list of monitors by ID:
5349

5450
[source,sh]
5551
--------------------------------------------------
56-
DELETE /api/synthetics/monitors
52+
POST /api/synthetics/monitors/_bulk_delete
5753
{
5854
"ids": [
5955
"monitor1-id",

docs/api/synthetics/params/delete-param.asciidoc

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Deletes one or more parameters from the Synthetics app.
88

99
=== {api-request-title}
1010

11-
`DELETE <kibana host>:<port>/api/synthetics/params`
11+
`DELETE <kibana host>:<port>/api/synthetics/params/<param_id>`
1212

13-
`DELETE <kibana host>:<port>/s/<space_id>/api/synthetics/params`
13+
`DELETE <kibana host>:<port>/s/<space_id>/api/synthetics/params/<param_id>`
1414

1515
=== {api-prereq-title}
1616

@@ -20,26 +20,19 @@ You must have `all` privileges for the *Synthetics* feature in the *{observabili
2020
You must have `all` privileges for the *Synthetics* feature in the *{observability}* section of the
2121
<<kibana-feature-privileges,{kib} feature privileges>>.
2222

23-
[[parameters-delete-request-body]]
24-
==== Request Body
23+
[[parameters-delete-path-param]]
24+
==== Path Parameters
2525

2626
The request body should contain an array of parameter IDs that you want to delete.
2727

28-
`ids`::
29-
(Required, array of strings) An array of parameter IDs to delete.
28+
`param_id`::
29+
(Required, string) An id of parameter to delete.
3030

31-
32-
Here is an example of a DELETE request to delete a list of parameters by ID:
31+
Here is an example of a DELETE request to delete a parameter by its ID:
3332

3433
[source,sh]
3534
--------------------------------------------------
36-
DELETE /api/synthetics/params
37-
{
38-
"ids": [
39-
"param1-id",
40-
"param2-id"
41-
]
42-
}
35+
DELETE /api/synthetics/params/param_id1
4336
--------------------------------------------------
4437

4538
[[parameters-delete-response-example]]
@@ -58,10 +51,21 @@ Here's an example response for deleting multiple parameters:
5851
{
5952
"id": "param1-id",
6053
"deleted": true
61-
},
62-
{
63-
"id": "param2-id",
64-
"deleted": true
6554
}
6655
]
67-
--------------------------------------------------
56+
--------------------------------------------------
57+
58+
==== Bulk delete parameters
59+
To delete multiple parameters, you can send a POST request to `/api/synthetics/params/_bulk_delete` with an array of parameter IDs to delete via body.
60+
61+
Here is an example of a POST request to delete multiple parameters:
62+
63+
[source,sh]
64+
--------------------------------------------------
65+
POST /api/synthetics/params/_bulk_delete
66+
{
67+
"ids": ["param1-id", "param2-id"]
68+
}
69+
--------------------------------------------------
70+
71+

docs/management/connectors/action-types/jira.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The Jira connector uses the https://developer.atlassian.com/cloud/jira/platform/
1414
[[jira-compatibility]]
1515
=== Compatibility
1616

17-
Jira on-premise deployments (Server and Data Center) are not supported.
17+
Jira Cloud and Jira Data Center are supported. Jira on-premise deployments are not supported.
1818

1919
[float]
2020
[[define-jira-ui]]
@@ -37,7 +37,7 @@ Name:: The name of the connector.
3737
URL:: Jira instance URL.
3838
Project key:: Jira project key.
3939
Email:: The account email for HTTP Basic authentication.
40-
API token:: Jira API authentication token for HTTP Basic authentication.
40+
API token:: Jira API authentication token for HTTP Basic authentication. For Jira Data Center, this value should be the password associated with the email owner.
4141

4242
[float]
4343
[[jira-action-configuration]]

packages/kbn-search-types/src/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ export interface ISearchOptions {
114114
* To pass an abort signal, use {@link ISearchOptions.abortSignal}
115115
*/
116116
transport?: Omit<TransportRequestOptions, 'signal'>;
117+
118+
/**
119+
* When set es results are streamed back to the caller without any parsing of the content.
120+
*/
121+
stream?: boolean;
117122
}
118123

119124
/**
@@ -130,4 +135,5 @@ export type ISearchOptionsSerializable = Pick<
130135
| 'isRestore'
131136
| 'retrieveResults'
132137
| 'executionContext'
138+
| 'stream'
133139
>;

src/plugins/data/common/search/strategies/es_search/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
*/
99

1010
export * from './types';
11+
export * from './response_utils';

src/plugins/data/server/search/strategies/es_search/response_utils.test.ts renamed to src/plugins/data/common/search/strategies/es_search/response_utils.test.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import { getTotalLoaded, toKibanaSearchResponse, shimHitsTotal } from './response_utils';
10+
import { getTotalLoaded, shimHitsTotal } from './response_utils';
1111
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
1212

1313
describe('response utils', () => {
@@ -29,34 +29,6 @@ describe('response utils', () => {
2929
});
3030
});
3131

32-
describe('toKibanaSearchResponse', () => {
33-
it('returns rawResponse, isPartial, isRunning, total, and loaded', () => {
34-
const result = toKibanaSearchResponse({
35-
_shards: {
36-
successful: 10,
37-
failed: 5,
38-
skipped: 5,
39-
total: 100,
40-
},
41-
} as unknown as estypes.SearchResponse<unknown>);
42-
43-
expect(result).toEqual({
44-
rawResponse: {
45-
_shards: {
46-
successful: 10,
47-
failed: 5,
48-
skipped: 5,
49-
total: 100,
50-
},
51-
},
52-
isRunning: false,
53-
isPartial: false,
54-
total: 100,
55-
loaded: 15,
56-
});
57-
});
58-
});
59-
6032
describe('shimHitsTotal', () => {
6133
test('returns the total if it is already numeric', () => {
6234
const result = shimHitsTotal({

src/plugins/data/server/search/strategies/es_search/response_utils.ts renamed to src/plugins/data/common/search/strategies/es_search/response_utils.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import type { ConnectionRequestParams } from '@elastic/transport';
1110
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
1211
import { ISearchOptions } from '@kbn/search-types';
13-
import { sanitizeRequestParams } from '../../sanitize_request_params';
1412

1513
/**
1614
* Get the `total`/`loaded` for this response (see `IKibanaSearchResponse`). Note that `skipped` is
@@ -23,23 +21,6 @@ export function getTotalLoaded(response: estypes.SearchResponse<unknown>) {
2321
return { total, loaded };
2422
}
2523

26-
/**
27-
* Get the Kibana representation of this response (see `IKibanaSearchResponse`).
28-
* @internal
29-
*/
30-
export function toKibanaSearchResponse(
31-
rawResponse: estypes.SearchResponse<unknown>,
32-
requestParams?: ConnectionRequestParams
33-
) {
34-
return {
35-
rawResponse,
36-
isPartial: false,
37-
isRunning: false,
38-
...(requestParams ? { requestParams: sanitizeRequestParams(requestParams) } : {}),
39-
...getTotalLoaded(rawResponse),
40-
};
41-
}
42-
4324
/**
4425
* Temporary workaround until https://github.com/elastic/kibana/issues/26356 is addressed.
4526
* Since we are setting `track_total_hits` in the request, `hits.total` will be an object

src/plugins/data/common/search/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ import { AggTypesDependencies } from '..';
1717
/**
1818
* @returns true if response is abort
1919
*/
20-
export const isAbortResponse = (response?: IKibanaSearchResponse) => {
21-
return !response || !response.rawResponse;
20+
export const isAbortResponse = (
21+
response?: IKibanaSearchResponse | { response: IKibanaSearchResponse }
22+
) => {
23+
return !response || !('rawResponse' in response || 'response' in response);
2224
};
2325

2426
/**

src/plugins/data/public/search/search_interceptor/search_interceptor.ts

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,19 @@ import type {
6060
} from '@kbn/search-types';
6161
import { createEsError, isEsError, renderSearchError } from '@kbn/search-errors';
6262
import type { IKibanaSearchResponse, ISearchOptions } from '@kbn/search-types';
63+
import {
64+
AsyncSearchGetResponse,
65+
ErrorResponseBase,
66+
SqlGetAsyncResponse,
67+
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
6368
import {
6469
ENHANCED_ES_SEARCH_STRATEGY,
70+
ESQL_ASYNC_SEARCH_STRATEGY,
71+
getTotalLoaded,
6572
IAsyncSearchOptions,
6673
isRunningResponse,
6774
pollSearch,
75+
shimHitsTotal,
6876
UI_SETTINGS,
6977
} from '../../../common';
7078
import { SearchUsageCollector } from '../collectors';
@@ -445,14 +453,75 @@ export class SearchInterceptor {
445453
if (this.bFetchDisabled) {
446454
const { executionContext, strategy, ...searchOptions } = this.getSerializableOptions(options);
447455
return this.deps.http
448-
.post(`/internal/search/${strategy}${request.id ? `/${request.id}` : ''}`, {
449-
version: '1',
450-
signal: abortSignal,
451-
context: executionContext,
452-
body: JSON.stringify({
453-
...request,
454-
...searchOptions,
455-
}),
456+
.post<IKibanaSearchResponse | ErrorResponseBase>(
457+
`/internal/search/${strategy}${request.id ? `/${request.id}` : ''}`,
458+
{
459+
version: '1',
460+
signal: abortSignal,
461+
context: executionContext,
462+
body: JSON.stringify({
463+
...request,
464+
...searchOptions,
465+
stream:
466+
strategy === ESQL_ASYNC_SEARCH_STRATEGY ||
467+
strategy === ENHANCED_ES_SEARCH_STRATEGY ||
468+
strategy === undefined, // undefined strategy is treated as enhanced ES
469+
}),
470+
asResponse: true,
471+
}
472+
)
473+
.then((rawResponse) => {
474+
const warning = rawResponse.response?.headers.get('warning');
475+
const requestParams =
476+
rawResponse.body && 'requestParams' in rawResponse.body
477+
? rawResponse.body.requestParams
478+
: JSON.parse(rawResponse.response?.headers.get('kbn-search-request-params') || '{}');
479+
const isRestored =
480+
rawResponse.body && 'isRestored' in rawResponse.body
481+
? rawResponse.body.isRestored
482+
: rawResponse.response?.headers.get('kbn-search-is-restored') === '?1';
483+
484+
if (rawResponse.body && 'error' in rawResponse.body) {
485+
// eslint-disable-next-line no-throw-literal
486+
throw {
487+
attributes: {
488+
error: rawResponse.body.error,
489+
rawResponse: rawResponse.body,
490+
requestParams,
491+
isRestored,
492+
},
493+
};
494+
}
495+
496+
switch (strategy) {
497+
case ENHANCED_ES_SEARCH_STRATEGY:
498+
if (rawResponse.body?.rawResponse) return rawResponse.body;
499+
const typedResponse = rawResponse.body as unknown as AsyncSearchGetResponse;
500+
const shimmedResponse = shimHitsTotal(typedResponse.response, {
501+
legacyHitsTotal: searchOptions.legacyHitsTotal,
502+
});
503+
return {
504+
id: typedResponse.id,
505+
isPartial: typedResponse.is_partial,
506+
isRunning: typedResponse.is_running,
507+
rawResponse: shimmedResponse,
508+
warning,
509+
requestParams,
510+
isRestored,
511+
...getTotalLoaded(shimmedResponse),
512+
};
513+
case ESQL_ASYNC_SEARCH_STRATEGY:
514+
const esqlResponse = rawResponse.body as unknown as SqlGetAsyncResponse;
515+
return {
516+
id: esqlResponse.id,
517+
rawResponse: esqlResponse,
518+
isPartial: esqlResponse.is_partial,
519+
isRunning: esqlResponse.is_running,
520+
warning,
521+
};
522+
default:
523+
return rawResponse.body;
524+
}
456525
})
457526
.catch((e: IHttpFetchError<KibanaServerError>) => {
458527
if (e?.body) {

src/plugins/data/server/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ export type {
6868
AsyncSearchStatusResponse,
6969
} from './search';
7070
export {
71-
shimHitsTotal,
7271
SearchSessionService,
7372
NoSearchIdInSessionError,
7473
INITIAL_SEARCH_SESSION_REST_VERSION,
7574
} from './search';
7675

76+
export { shimHitsTotal } from '../common/search';
77+
7778
// Search namespace
7879
export const search = {
7980
aggs: {

0 commit comments

Comments
 (0)