Skip to content
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

Upgrade ES client to 9.0.0-alpha.3 #208776

Merged
merged 78 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
030c51b
Upgrade ES client to `9.0.0-alpha.2`
afharo Jan 29, 2025
a12b52b
Fix imports
afharo Jan 29, 2025
3751ddd
Type fixes: first wave
afharo Jan 29, 2025
59e7996
Type fixes: 2nd wave
afharo Jan 29, 2025
926661a
Type fixes: 3rd wave
afharo Jan 29, 2025
640c0fd
Type fixes: 4th wave
afharo Jan 29, 2025
851302c
Type fixes: 5th wave
afharo Jan 30, 2025
5499e4d
Type fixes: 6th wave
afharo Jan 31, 2025
9a152f9
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Jan 31, 2025
5c72456
Type fixes: 7th wave
afharo Jan 31, 2025
9a9141b
Address Jest errors
afharo Jan 31, 2025
8c610c2
Fix type
afharo Jan 31, 2025
3d737a5
Jest tests 2nd wave
afharo Feb 1, 2025
c95bb5d
indices.putMappings use `body` for now
afharo Feb 1, 2025
cc7da48
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 3, 2025
f8f6914
client.create goes with document
afharo Feb 3, 2025
15bf6a3
Fix jest tests
afharo Feb 3, 2025
2645825
Fix time_series_query body search
afharo Feb 3, 2025
6b98d6c
Update vega docs
afharo Feb 3, 2025
0818c90
Bump to alpha.3
afharo Feb 3, 2025
f5c6882
`data.search` body removals
afharo Feb 3, 2025
ea1fd38
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 3, 2025
44a0a67
Remove body usage via find (1st wave)
afharo Feb 3, 2025
de67d8d
Fix types
afharo Feb 3, 2025
c7b1dd1
Fix more types
afharo Feb 3, 2025
26d23ff
Fix repository and data.search calls
afharo Feb 4, 2025
55fc678
Fix import issue
afharo Feb 4, 2025
a862199
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 4, 2025
01b8529
Fix merge conflicts
afharo Feb 4, 2025
1a8799d
Add MessagePort polyfill
afharo Feb 5, 2025
f41988e
Force HttpConnection and requestTimeout
afharo Feb 5, 2025
36b1832
ML data_frame_analytics: missing _meta in the spec
afharo Feb 5, 2025
cb83caf
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 5, 2025
313e8dc
Fix jest tests
afharo Feb 5, 2025
efaad60
Fix timeseries queries
afharo Feb 5, 2025
b3f1676
TaskManager: updateByQuery using body
afharo Feb 5, 2025
b275942
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 6, 2025
74525af
Chasing bugs
afharo Feb 6, 2025
c3d8e59
Fun with FTRs
afharo Feb 6, 2025
950f743
More FTR fun
afharo Feb 7, 2025
e7dbc3a
Fix FTRs
afharo Feb 7, 2025
24975c6
Fix security.grantApiKey test
afharo Feb 10, 2025
9d57bdf
Remove linting from bucket_script (causing ES to refuse it)
afharo Feb 10, 2025
772e745
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 10, 2025
13432f4
Resolve new issues after merge rebase
afharo Feb 10, 2025
72c641f
Revert spaces in critical_path aggregation bucket_script
afharo Feb 10, 2025
32f4384
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 11, 2025
5ce656f
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 11, 2025
06d8bf2
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 12, 2025
36db4b7
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 12, 2025
d0253de
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 13, 2025
a079dca
Fixes after merge from main
afharo Feb 13, 2025
0742b70
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 14, 2025
fe6f67f
Add comment based on feedback
afharo Feb 14, 2025
c9a7c52
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 14, 2025
8a8446a
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 17, 2025
7282412
Remove additional use of `body`
afharo Feb 17, 2025
e9f41a7
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 17, 2025
818c0ae
preparing for security solution MKI test execution
MadameSheema Feb 17, 2025
6742816
more changes to prepare the override
MadameSheema Feb 17, 2025
e1c95f5
finalizing preparation for MKI security solution test execution
MadameSheema Feb 17, 2025
71e73ee
Revert "preparing for security solution MKI test execution"
MadameSheema Feb 17, 2025
e9ed575
Revert "more changes to prepare the override"
MadameSheema Feb 17, 2025
8c64a08
Revert "finalizing preparation for MKI security solution test execution"
MadameSheema Feb 17, 2025
3888074
Fix type `SearchHit`
afharo Feb 17, 2025
8c13e77
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 17, 2025
2c3b6f7
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 18, 2025
a79c480
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 18, 2025
ec78f86
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 19, 2025
a7e295f
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 19, 2025
734cac2
Fix types after rebase from `main`
afharo Feb 19, 2025
b4d6e2a
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 19, 2025
6a2b043
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 20, 2025
70fa30a
Fix types
afharo Feb 20, 2025
ee64ba0
Merge branch 'main' of github.com:elastic/kibana into es-9.0.0-alpha.2
afharo Feb 24, 2025
9d2eea7
prepares for MKI execution
MadameSheema Feb 25, 2025
5594037
Revert "prepares for MKI execution"
MadameSheema Feb 25, 2025
7a643b4
Merge branch 'main' into es-9.0.0-alpha.2
afharo Feb 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion examples/eso_model_version_example/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export class EsoModelVersionExample
const objectsCreated = await Promise.all(
documentVersionConstants.map(async (obj) => {
const createdDoc: WriteResponseBase =
await elasticsearch.client.asInternalUser.create(obj);
await elasticsearch.client.asInternalUser.create<unknown>(obj);
const parts = createdDoc._id.split(':', 2);
return { type: parts[0], id: parts[1] };
})
Expand Down
12 changes: 7 additions & 5 deletions examples/search_examples/public/search/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,15 @@ export const SearchExamplesApp = ({
const aggs = [{ type: metricAggType, params: { field: selectedNumericField!.name } }];
const aggsDsl = data.search.aggs.createAggConfigs(dataView, aggs).toDsl();

const body = {
aggs: aggsDsl,
query,
};

const req = {
params: {
index: dataView.title,
body: {
aggs: aggsDsl,
query,
},
...body,
},
// Add a custom request parameter to be consumed by `MyStrategy`.
...(strategy ? { get_cool: getCool } : {}),
Expand All @@ -197,7 +199,7 @@ export const SearchExamplesApp = ({
setAbortController(abortController);

// Submit the search request using the `data.search` service.
setRequest(req.params.body);
setRequest(body);
setRawResponse({});
setWarningContents([]);
setIsLoading(true);
Expand Down
6 changes: 2 additions & 4 deletions examples/search_examples/public/search_sessions/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,8 @@ function doSearch(
const req = {
params: {
index: dataView.title,
body: {
aggs: aggsDsl,
query,
},
aggs: aggsDsl,
query,
},
};

Expand Down
10 changes: 4 additions & 6 deletions examples/search_examples/server/routes/server_search_route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ export function registerServerSearchRoute(router: IRouter<DataRequestHandlerCont
{
params: {
index,
body: {
aggs: {
'1': {
avg: {
field,
},
aggs: {
'1': {
avg: {
field,
},
},
},
Expand Down
6 changes: 2 additions & 4 deletions examples/unified_doc_viewer/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ function UnifiedDocViewerExamplesApp({ data }: { data: DataPublicPluginStart })
.search({
params: {
index: dataView?.getIndexPattern(),
body: {
fields: ['*'],
_source: false,
},
fields: ['*'],
_source: false,
},
})
.toPromise();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/ebt": "^1.1.1",
"@elastic/ecs": "^8.11.5",
"@elastic/elasticsearch": "^8.17.0",
"@elastic/elasticsearch": "9.0.0-alpha.3",
"@elastic/ems-client": "8.6.3",
"@elastic/eui": "99.2.0-borealis.0",
"@elastic/eui-theme-borealis": "0.0.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { Client } from '@elastic/elasticsearch';
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { ApmSynthtraceEsClient } from '../../..';
import { Logger } from '../../lib/utils/create_logger';
import { RunOptions } from './parse_run_cli_flags';
Expand All @@ -26,6 +26,8 @@ export function getApmEsClient({
const client = new Client({
node: target,
tls: getEsClientTlsSettings(target),
Connection: HttpConnection,
requestTimeout: 30_000,
});

const apmEsClient = new ApmSynthtraceEsClient({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { Client } from '@elastic/elasticsearch';
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { EntitiesSynthtraceEsClient } from '../../lib/entities/entities_synthtrace_es_client';
import { Logger } from '../../lib/utils/create_logger';
import { RunOptions } from './parse_run_cli_flags';
Expand All @@ -24,6 +24,8 @@ export function getEntitiesEsClient({
const client = new Client({
node: target,
tls: getEsClientTlsSettings(target),
Connection: HttpConnection,
requestTimeout: 30_000,
});

return new EntitiesSynthtraceEsClient({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { Client } from '@elastic/elasticsearch';
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { InfraSynthtraceEsClient } from '../../lib/infra/infra_synthtrace_es_client';
import { Logger } from '../../lib/utils/create_logger';
import { RunOptions } from './parse_run_cli_flags';
Expand All @@ -24,6 +24,8 @@ export function getInfraEsClient({
const client = new Client({
node: target,
tls: getEsClientTlsSettings(target),
Connection: HttpConnection,
requestTimeout: 30_000,
});

return new InfraSynthtraceEsClient({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { Client } from '@elastic/elasticsearch';
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { LogsSynthtraceEsClient } from '../../lib/logs/logs_synthtrace_es_client';
import { Logger } from '../../lib/utils/create_logger';
import { RunOptions } from './parse_run_cli_flags';
Expand All @@ -24,6 +24,8 @@ export function getLogsEsClient({
const client = new Client({
node: target,
tls: getEsClientTlsSettings(target),
Connection: HttpConnection,
requestTimeout: 30_000,
});

return new LogsSynthtraceEsClient({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { Client } from '@elastic/elasticsearch';
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { Logger } from '../../lib/utils/create_logger';
import { RunOptions } from './parse_run_cli_flags';
import { getEsClientTlsSettings } from './ssl';
Expand All @@ -24,6 +24,8 @@ export function getOtelSynthtraceEsClient({
const client = new Client({
node: target,
tls: getEsClientTlsSettings(target),
Connection: HttpConnection,
requestTimeout: 30_000,
});

return new OtelSynthtraceEsClient({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { Client } from '@elastic/elasticsearch';
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { Logger } from '../../lib/utils/create_logger';
import { RunOptions } from './parse_run_cli_flags';
import { getEsClientTlsSettings } from './ssl';
Expand All @@ -24,6 +24,8 @@ export function getSyntheticsEsClient({
const client = new Client({
node: target,
tls: getEsClientTlsSettings(target),
Connection: HttpConnection,
requestTimeout: 30_000,
});

return new SyntheticsSynthtraceEsClient({
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-es-archiver/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export function runCli() {
node: esUrl,
tls: esCa ? { ca: esCa } : undefined,
Connection: HttpConnection,
requestTimeout: 30_000,
});
addCleanupTask(() => client.close());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const createStubClient = (

return { statusCode: 404 };
}),
updateAliases: sinon.spy(async ({ body }) => {
updateAliases: sinon.spy(async (body) => {
body.actions.forEach(
({ add: { index, alias } }: { add: { index: string; alias: string } }) => {
if (!existingIndices.includes(index)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,12 @@ describe('esArchiver: createCreateIndexStream()', () => {

sinon.assert.calledWith(client.indices.create as sinon.SinonSpy, {
index: 'index',
body: {
settings: undefined,
mappings: undefined,
},
settings: undefined,
mappings: undefined,
});

sinon.assert.calledWith(client.indices.updateAliases as sinon.SinonSpy, {
body: {
actions: [{ add: { alias: 'foo', index: 'index' } }],
},
actions: [{ add: { alias: 'foo', index: 'index' } }],
});
});

Expand Down Expand Up @@ -343,9 +339,10 @@ describe('esArchiver: createCreateIndexStream()', () => {

// only update aliases for the 'new-index'
sinon.assert.callCount(client.indices.updateAliases as sinon.SinonSpy, 1);
expect((client.indices.updateAliases as sinon.SinonSpy).args[0][0]).toHaveProperty('body', {
actions: [{ add: { alias: 'new-index-alias', index: 'new-index' } }],
});
expect((client.indices.updateAliases as sinon.SinonSpy).args[0][0]).toHaveProperty(
'actions',
[{ add: { alias: 'new-index-alias', index: 'new-index' } }]
);
});

it('filters documents for skipped indices', async () => {
Expand Down
10 changes: 4 additions & 6 deletions packages/kbn-es-archiver/src/lib/indices/create_index_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { Transform, Readable } from 'stream';
import { inspect } from 'util';

import * as estypes from '@elastic/elasticsearch/lib/api/types';
import type { estypes } from '@elastic/elasticsearch';
import type { Client } from '@elastic/elasticsearch';
import { ToolingLog } from '@kbn/tooling-log';

Expand Down Expand Up @@ -162,10 +162,8 @@ export function createCreateIndexStream({
await client.indices.create(
{
index,
body: {
settings,
mappings,
},
settings,
mappings,
},
{
headers: ES_CLIENT_HEADERS,
Expand All @@ -184,7 +182,7 @@ export function createCreateIndexStream({
);

if (actions.length) {
await client.indices.updateAliases({ body: { actions } });
await client.indices.updateAliases({ actions });
}

stats.createdIndex(index, { settings });
Expand Down
16 changes: 7 additions & 9 deletions packages/kbn-es-archiver/src/lib/indices/kibana_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function deleteSavedObjectIndices({
await client.indices.putSettings(
{
index: indexNames,
body: { blocks: { read_only: false } },
settings: { blocks: { read_only: false } },
},
{
headers: ES_CLIENT_HEADERS,
Expand Down Expand Up @@ -123,13 +123,11 @@ export async function cleanSavedObjectIndices({
{
index,
refresh: true,
body: {
query: {
bool: {
must_not: {
ids: {
values: ['space:default'],
},
query: {
bool: {
must_not: {
ids: {
values: ['space:default'],
},
},
},
Expand Down Expand Up @@ -168,7 +166,7 @@ export async function createDefaultSpace({ index, client }: { index: string; cli
index,
id: 'space:default',
refresh: 'wait_for',
body: {
document: {
type: 'space',
updated_at: new Date().toISOString(),
space: {
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-es/src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import * as path from 'path';
import execa from 'execa';
import { Readable } from 'stream';
import { combineLatest, fromEvent, first } from 'rxjs';
import { Client } from '@elastic/elasticsearch';
import { Client, HttpConnection } from '@elastic/elasticsearch';
import { promisify } from 'util';
import { CA_CERT_PATH, ES_NOPASSWORD_P12_PATH, extract } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/tooling-log';
Expand Down Expand Up @@ -428,6 +428,8 @@ export class Cluster {
rejectUnauthorized: true,
}
: undefined,
Connection: HttpConnection,
requestTimeout: 30_000,
});

if (!skipReadyCheck) {
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-es/src/utils/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ export async function runServerlessEsNode(
function getESClient(clientOptions: ClientOptions): Client {
return new Client({
Connection: HttpConnection,
requestTimeout: 30_000,
...clientOptions,
});
}
Expand Down
4 changes: 1 addition & 3 deletions packages/kbn-es/src/utils/native_realm.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ exports.NativeRealm = class NativeRealm {
await this._client.security.changePassword({
username,
refresh: 'wait_for',
body: {
password,
},
password,
});
} catch (err) {
const isAnonymousUserPasswordChangeError =
Expand Down
Loading