fix(core): Resolve TypeScript strict mode and ES client API compatibility issues for v3.0.0
- Fix ES client v8+ API: use document/doc instead of body for index/update operations - Add type assertions (as any) for ES client ILM, template, and search APIs - Fix strict null checks with proper undefined handling (nullish coalescing) - Fix MetricsCollector interface to match required method signatures - Fix Logger.error signature compatibility in plugins - Resolve TermsQuery type index signature conflict - Remove sourceMap from tsconfig (handled by tsbuild with inlineSourceMap)
This commit is contained in:
@@ -107,17 +107,12 @@ export function createLoggingPlugin(config: LoggingPluginConfig = {}): Plugin {
|
||||
|
||||
const duration = Date.now() - context.request.startTime;
|
||||
|
||||
logger.error('Elasticsearch error', {
|
||||
logger.error('Elasticsearch error', context.error, {
|
||||
requestId: context.request.requestId,
|
||||
method: context.request.method,
|
||||
path: context.request.path,
|
||||
duration,
|
||||
attempts: context.attempts,
|
||||
error: {
|
||||
name: context.error.name,
|
||||
message: context.error.message,
|
||||
stack: context.error.stack,
|
||||
},
|
||||
statusCode: context.response?.statusCode,
|
||||
});
|
||||
|
||||
|
||||
@@ -128,14 +128,19 @@ function extractIndexFromPath(path: string): string {
|
||||
|
||||
// Split by slash and get first segment
|
||||
const segments = cleanPath.split('/');
|
||||
const firstSegment = segments[0];
|
||||
|
||||
// Common patterns:
|
||||
// /{index}/_search
|
||||
// /{index}/_doc/{id}
|
||||
// /_cat/indices
|
||||
if (segments[0].startsWith('_')) {
|
||||
return segments[0]; // API endpoint like _cat, _search
|
||||
if (!firstSegment) {
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
return segments[0] || 'unknown';
|
||||
if (firstSegment.startsWith('_')) {
|
||||
return firstSegment; // API endpoint like _cat, _search
|
||||
}
|
||||
|
||||
return firstSegment;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user