Skip to content

[IngestPipelineSimulation] Typing error on exported type #2647

Closed
elastic/elasticsearch-specification
#4292
@tonyghiani

Description

@tonyghiani

🐛 Bug report

📓 Summary

In Kibana, we use the IngestPipelineSimulation type to manipulate response values from the POST /_ingest/pipeline/_simulate API.

First issue is about naming, the IngestPipelineSimulation represents the property IngestSimulateDocumentResult.processor_results, which is a bit misleading since it's not the result of the whole pipeline, but represent a single processor result. Maybe something IngestPipelineProcessorResult would fit better.

We want to run guards against the status property, and it is currently set to WatcherActionStatusOptions, which seems wrong as we don't get types for the right status (e.g. skipped).

Would be great to fix the type to get the expected status mapping that comes from the ES implementation.

To reproduce

const processorResult: IngestPipelineSimulation = {
  status: 'skipped', // Type '"skipped"' is not assignable to type 'WatcherActionStatusOptions | undefined'.ts(2322)
};

Expected behavior

const processorResult: IngestPipelineSimulation = {
  status: 'skipped' // ✅ Valid value
};

Node.js version

Any version

@elastic/elasticsearch version

v9.0.0-alpha

Operating system

macOs

Any other relevant environment information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions