elastic / elastic/docs-content

Use IN and NOT IN subqueries in EVAL expressions

Open
#8,143 1 comment 0 reactions 1 assignee Claimed by @florent-leborgne View on GitHub
Feature: ES|QL Team:SKI
Dominant language
No language data
Stars
47
Forks
261
Avg merge
3d 12h
Merged PRs (30d)
116

Description

## Summary

The ES|QL editor now suggests and validates `IN` and `NOT IN` subqueries in EVAL, for example `EVAL col = keywordField IN (FROM other_index | KEEP keywordField)`. Published language docs still say IN subqueries work only in WHERE and are not supported in other commands. Confirm that Elasticsearch accepts IN in EVAL before rewriting that limitation.

**Why this needs docs:** Editor now treats EVAL as an IN subquery context, but published docs still limit IN subqueries to WHERE.

## Resources

- PR [#286735](https://github.com/elastic/kibana/pull/286735) — [ESQL] Enable in subquery in eval

## Availability

| Channel | Details |
|---------|---------|
| **Stack** | v9.6.0 |
| **Serverless** | Aug 31–Sep 4 |
| **Feature flag** | None — active by default |

---
*Created with [Docs Quest Scanner](https://github.com/florent-leborgne/docs-quest-scanner) by @florent-leborgne*

## Suggested edits

[Use ES|QL subqueries with IN and NOT IN](https://www.elastic.co/docs/reference/query-languages/esql/esql-in-subquery) > IN subqueries are only supported in the WHERE command
- **What the docs say:** An IN subquery can only appear in the WHERE command. It is not supported in other commands.
- **What to add:** If Elasticsearch accepts IN in EVAL, update this limitation and add an EVAL example such as `FROM index | EVAL col = field IN (FROM other | KEEP field)`. Also update the opening sentence that ties IN subqueries to WHERE only. Applies from 9.6.0 and in serverless.

[Nest ES|QL queries using subqueries](https://www.elastic.co/docs/reference/query-languages/esql/esql-subquery) > Learn more
- **What the docs say:** You can use subqueries in two places: in a FROM command, and in a WHERE command with IN or NOT IN.
- **What to add:** If IN in EVAL is supported, mention EVAL as a third place for IN and NOT IN subqueries. Applies from 9.6.0 and in serverless.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.