Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45501,6 +45501,7 @@ components:
- green
- yellow
- red
- unavailable
- unknown
type: string
id:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/ebt": "^1.3.1",
"@elastic/ecs": "^8.11.5",
"@elastic/elasticsearch": "^8.18.2",
"@elastic/elasticsearch": "^8.19.0",
"@elastic/ems-client": "8.6.3",
"@elastic/eui": "104.0.0-amsterdam.0",
"@elastic/eui-amsterdam": "npm:@elastic/eui@104.0.0-amsterdam.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function getBulkOperationError(
id: string,
rawResponse: {
status: number;
error?: { type: string; reason?: string; index: string };
error?: { type: string; reason?: string | null; index: string };
// Other fields are present on a bulk operation result but they are irrelevant for this function
}
): Payload | undefined {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export const isClusterShardLimitExceeded = (errorCause?: ErrorCause): boolean =>
);
};

export const hasAllKeywordsInOrder = (message: string | undefined, keywords: string[]): boolean => {
export const hasAllKeywordsInOrder = (
message: string | null | undefined,
keywords: string[]
): boolean => {
if (!message || !keywords.length) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {

/** @internal */
export interface WaitForTaskResponse {
error: Option.Option<{ type: string; reason?: string; index?: string }>;
error: Option.Option<{ type: string; reason?: string | null; index?: string }>;
completed: boolean;
failures: Option.Option<any[]>;
description?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ export interface InvalidateAPIKeyResult {
*/
error_details?: Array<{
type?: string;
reason?: string;
reason?: string | null;
caused_by?: {
type?: string;
reason?: string;
reason?: string | null;
};
}>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export const extractErrorProperties = (error: ErrorType): MLErrorObject => {
) {
errObj.causedBy =
error.body.attributes.body.error.caused_by?.caused_by?.reason ||
error.body.attributes.body.error.caused_by?.reason;
error.body.attributes.body.error.caused_by?.reason ||
undefined; // Remove 'null' option from the types
}
if (
Array.isArray(error.body.attributes.body.error.root_cause) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const indexWithLifecyclePolicy: Index = {
action_time_millis: 1544187775867,
step: 'complete',
step_time_millis: 1544187775867,
skip: false,
},
};

Expand Down Expand Up @@ -112,6 +113,7 @@ const indexWithLifecycleError: Index = {
type: 'illegal_argument_exception',
reason: 'setting [index.lifecycle.rollover_alias] for index [testy3] is empty or not defined',
},
skip: false,
},
};
const indexWithLifecyclePhaseDefinition: Index = {
Expand Down Expand Up @@ -145,6 +147,7 @@ const indexWithLifecyclePhaseDefinition: Index = {
version: 1,
modified_date_in_millis: 1544031699844,
},
skip: false,
},
};
const indexWithLifecycleWaitingStep: Index = {
Expand Down Expand Up @@ -178,6 +181,7 @@ const indexWithLifecycleWaitingStep: Index = {
all_shards_active: false,
number_of_replicas: 2,
},
skip: false,
},
};
const indexWithNonExistentPolicyError: Index = {
Expand Down Expand Up @@ -205,6 +209,7 @@ const indexWithNonExistentPolicyError: Index = {
type: 'illegal_argument_exception',
reason: 'policy [testy] does not exist',
},
skip: false,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const deleteAlertsForQuery = async (
action: AlertAuditAction.DELETE,
id: alertUuid,
outcome: 'failure',
error: new Error(item.delete?.error?.reason),
error: new Error(item.delete?.error?.reason ?? undefined), // reason can be null and it's not a valid parameter for Error
})
);
errors.push(`Error deleting alert "${alertUuid!}" - ${item.delete?.error?.reason}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export async function updateTagsBatch(
agentId: failure.id,
actionId,
namespace: spaceId,
error: failure.cause.reason,
error: failure.cause.reason ?? undefined, // reason can be null and we want to replace it with undefined
}))
);
appContextService.getLogger().debug(`action failed result wrote on ${failureCount} agents`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export const bulkDeleteArtifacts = async (
if (res.errors) {
errors = res.items.reduce<Error[]>((acc, item) => {
if (item.delete?.error) {
acc.push(new Error(item.delete.error.reason));
acc.push(new Error(item.delete.error.reason ?? undefined)); // reason can be null and it's not a valid parameter for Error
}
return acc;
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,12 @@ export abstract class InferenceBase<TInferResponse> {
};
}

protected getDocFromResponse({ doc, error }: estypes.IngestPipelineSimulation) {
protected getDocFromResponse({ doc, error }: estypes.IngestSimulateDocumentResult) {
if (doc === undefined) {
if (error) {
// @ts-expect-error Error is now typed in estypes. However, I doubt that it doesn't get the expected HTTP wrapper.
this.setFinishedWithErrors(error);
throw Error(error.reason);
throw Error(error.reason ?? undefined); // reason can be null and it's not a valid parameter for Error
}

throw Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function mockIndicesStatsResponseFactory(

listOfIndicesWithCount.forEach((indexPair) => {
result!.indices![indexPair.name] = {
total: { docs: { count: indexPair.count } },
total: { docs: { count: indexPair.count, total_size_in_bytes: 0 } },
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,42 @@ describe('lifecycle helpers', () => {
managed: true,
phase: 'frozen',
policy: 'mypolicy',
skip: true,
},
index_name_002: {
index: 'index_name_002',
managed: true,
phase: 'frozen',
policy: 'mypolicy',
skip: true,
},
index_name_003: {
index: 'index_name_003',
managed: true,
phase: 'cold',
policy: 'mypolicy',
skip: true,
},
index_name_004: {
index: 'index_name_004',
managed: true,
phase: 'warm',
policy: 'mypolicy',
skip: true,
},
index_name_005: {
index: 'index_name_005',
managed: true,
phase: 'hot',
policy: 'mypolicy',
skip: true,
},
index_name_006: {
index: 'index_name_006',
managed: true,
phase: 'hot',
policy: 'mypolicy',
skip: true,
},
},
indicesStats: {
Expand Down Expand Up @@ -102,12 +108,14 @@ describe('lifecycle helpers', () => {
managed: true,
phase: 'hot',
policy: 'mypolicy',
skip: true,
},
index_name_002: {
index: 'index_name_002',
managed: true,
phase: 'hot',
policy: 'mypolicy',
skip: true,
},
index_name_003: {
index: 'index_name_003',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {
IngestDocument,
IngestProcessorContainer,
IngestSimulateRequest,
IngestPipelineSimulation,
IngestSimulateDocumentResult,
SimulateIngestRequest,
IndicesIndexState,
SimulateIngestResponse,
SimulateIngestSimulateIngestDocumentResult,
FieldCapsResponse,
type IngestPipelineProcessorResult,
} from '@elastic/elasticsearch/lib/api/types';
import { IScopedClusterClient } from '@kbn/core/server';
import { flattenObjectNestedLast, calculateObjectDiff } from '@kbn/object-utils';
Expand Down Expand Up @@ -854,14 +854,13 @@ const computeMappingProperties = (detectedFields: NamedFieldDefinitionConfig[])
* Guard helpers
*/
const isSuccessfulProcessor = (
processor: IngestPipelineSimulation
): processor is WithRequired<IngestPipelineSimulation, 'doc' | 'tag'> =>
processor: IngestPipelineProcessorResult
): processor is WithRequired<IngestPipelineProcessorResult, 'doc' | 'tag'> =>
processor.status === 'success' && !!processor.tag;

const isSkippedProcessor = (
processor: IngestPipelineSimulation
): processor is WithRequired<IngestPipelineSimulation, 'tag'> =>
// @ts-expect-error Looks like the IngestPipelineSimulation.status is not typed correctly and misses the 'skipped' status
processor: IngestPipelineProcessorResult
): processor is WithRequired<IngestPipelineProcessorResult, 'tag'> =>
processor.status === 'skipped';

const isMappingFailure = (entry: SimulateIngestSimulateIngestDocumentResult) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export const useIngestionRatePerTier = ({
const countByTier = indices.buckets.reduce((tiers, index) => {
const explain = ilmExplain.indices[index.key];
const tier =
explain.managed && explain.phase in ilmPhases
explain.managed && explain.phase && explain.phase in ilmPhases
? (explain.phase as PhaseNameWithoutDelete)
: fallbackTier;
tiers[tier] = (tiers[tier] ?? 0) + index.doc_count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ export interface TaskTypeAggregation extends estypes.AggregationsFiltersAggregat
}

export interface ScheduleAggregation extends estypes.AggregationsFiltersAggregate {
buckets: Array<{ doc_count: number; key: string | number }>;
buckets: Array<{ doc_count: number; key: string }>;
doc_count_error_upper_bound?: number | undefined;
sum_other_doc_count?: number | undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ export class TaskStore {

if (item.update?.error) {
const err = new BulkUpdateError({
message: item.update.error.reason,
message: item.update.error.reason ?? undefined, // reason can be null, and we want to keep `message` as string | undefined
type: item.update.error.type,
statusCode: item.update.status,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const healthColorsMapSelectable = {
GREEN: 'success',
yellow: 'warning',
YELLOW: 'warning',
unknown: '',
unavailable: '',
};

export const indexHealthToHealthColor = (health?: HealthStatus | 'unavailable'): IconColor => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* 2.0.
*/

import { AnalysisTokenFilter } from '@elastic/elasticsearch/lib/api/types';
import { AnalysisTokenFilter, AnalysisStopWords } from '@elastic/elasticsearch/lib/api/types';

interface LanguageDataEntry {
custom_filter_definitions?: object;
name: string;
stemmer: string;
stop_words: string;
stop_words: AnalysisStopWords;
postpended_filters?: string[];
prepended_filters?: string[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const hot: IlmExplainLifecycleLifecycleExplainManaged = {
version: 1,
modified_date_in_millis: 1675536751205,
},
skip: true,
};
const warm = {
...hot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const hot: IlmExplainLifecycleLifecycleExplainManaged = {
version: 1,
modified_date_in_millis: 1675536751205,
},
skip: true,
};
const warm = {
...hot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ describe('updateResultOnCheckCompleted', () => {
phase_time_millis: 1675536751809,
action: 'rollover',
action_time_millis: 1675536751809,
skip: true,
step: 'check-rollover-ready',
step_time_millis: 1675536751809,
phase_execution: {
Expand All @@ -93,6 +94,7 @@ describe('updateResultOnCheckCompleted', () => {
phase_time_millis: 1675536774416,
action: 'rollover',
action_time_millis: 1675536774416,
skip: true,
step: 'check-rollover-ready',
step_time_millis: 1675536774416,
phase_execution: {
Expand Down Expand Up @@ -175,6 +177,7 @@ describe('updateResultOnCheckCompleted', () => {
phase_time_millis: 1675536751809,
action: 'rollover',
action_time_millis: 1675536751809,
skip: true,
step: 'check-rollover-ready',
step_time_millis: 1675536751809,
phase_execution: {
Expand All @@ -195,6 +198,7 @@ describe('updateResultOnCheckCompleted', () => {
phase_time_millis: 1675536774416,
action: 'rollover',
action_time_millis: 1675536774416,
skip: true,
step: 'check-rollover-ready',
step_time_millis: 1675536774416,
phase_execution: {
Expand Down Expand Up @@ -272,6 +276,7 @@ describe('updateResultOnCheckCompleted', () => {
phase_time_millis: 1675536751809,
action: 'rollover',
action_time_millis: 1675536751809,
skip: true,
step: 'check-rollover-ready',
step_time_millis: 1675536751809,
phase_execution: {
Expand All @@ -292,6 +297,7 @@ describe('updateResultOnCheckCompleted', () => {
phase_time_millis: 1675536774416,
action: 'rollover',
action_time_millis: 1675536774416,
skip: true,
step: 'check-rollover-ready',
step_time_millis: 1675536774416,
phase_execution: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const mockIlmExplain: Record<string, IlmExplainLifecycleLifecycleExplain>
version: 1,
modified_date_in_millis: 1675536751205,
},
skip: true,
},
'.ds-packetbeat-8.5.3-2023.02.04-000001': {
index: '.ds-packetbeat-8.5.3-2023.02.04-000001',
Expand All @@ -47,6 +48,7 @@ export const mockIlmExplain: Record<string, IlmExplainLifecycleLifecycleExplain>
version: 1,
modified_date_in_millis: 1675536751205,
},
skip: true,
},
'auditbeat-custom-index-1': {
index: 'auditbeat-custom-index-1',
Expand Down
Loading
Loading