elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.69k stars 8.24k forks source link

[ES|QL] High-level AST mutation API #191812

Open vadimkibana opened 3 months ago

vadimkibana commented 3 months ago

Implement a high-level API for ES|QL AST mutations.

The API

The API could look something like below.

Manipulate METADATA fields:

// Remove METADATA field
Query.removeFromMetadata('_id');
// Add METADATA field
Query.addFromMetadata('_id');

Remove commands:

Query.removeCommands(node => node.name === 'limit');
// or
Query.removeCommandsByName('limit')

Change LIMIT of the query:

// Change LIMIT to specific value
Query.limit.set(10);
// Remove LIMIT command
Query.limit.remove();

...

elasticmachine commented 3 months ago

Pinging @elastic/kibana-esql (Team:ESQL)