Skip to content

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

Open

Description

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

  • Ability to add/remove METADATA fields
  • Ability to add/remove WHERE commands
  • Ability to change LIMIT
  • Ability to add/remove SORT command expressions
  • Ability to add/remove FROM sources

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();

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Feature:ES|QLES|QL related features in KibanaTeam:ESQLES|QL related features in KibanaenhancementNew value added to drive a business resultimpact:mediumAddressing this issue will have a medium level of impact on the quality/strength of our product.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions