Skip to content

Conversation

mjmbischoff
Copy link
Contributor

I think we need to reword this bit as we don't actually say things like \ is the escape character - which I'm not too well equipped for.

but the \\" is wrong and should be \" so vs escaping escape char and then quote as this fails:

POST _query?format=txt
{
  "query":"""
    ROW a = 1
    | EVAL b = "\\""
"""
}

vs:

POST _query?format=txt
{
  "query":"""
    ROW a = 1
    | EVAL b = "\""
"""
}

I think we need to reword this bit as we don't actually say things like `\` is the escape character - which I'm not too well equipped for.

but the `\\"` is wrong and should be `\"` so <escape char><quote> vs escaping escape char and then quote as this fails:

```
POST _query?format=txt
{
  "query":"""
    ROW a = 1
    | EVAL b = "\\""
"""
}
```
vs:
```
POST _query?format=txt
{
  "query":"""
    ROW a = 1
    | EVAL b = "\""
"""
}
```
@mjmbischoff mjmbischoff added >docs General docs changes Team:Docs Meta label for docs team labels Sep 7, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/core-docs (Team:Docs)

@elasticsearchmachine
Copy link
Collaborator

@mjmbischoff please enable the option "Allow edits and access to secrets by maintainers" on your PR. For more information, see the documentation.

@elasticsearchmachine elasticsearchmachine added the external-contributor Pull request authored by a developer outside the Elasticsearch team label Sep 7, 2025
Copy link
Contributor

github-actions bot commented Sep 7, 2025

🔍 Preview links for changed docs

This comment was marked as resolved.

@leemthompo
Copy link
Contributor

Thanks @mjmbischoff —This change looks correct to me but because escape characters is kinda a can of worms in ESQL, just want to make sure get technical approve from devs :)

Copy link
Contributor

@luigidellaquila luigidellaquila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good to me, \\" is incorrect in all cases.

I think the confusion came from the fact that we can escape the string in the query

ROW a = "foo\"bar"

but we can also escape the query itself:

POST _query
{
    "query": "ROW a = \"foo\\\"bar\""
}

and it becomes three escapes in this case.

Let alone all the all the combinations of triple quotes in the JSON payload and in ES|QL strings.

I still haven't found a way to explain all the cases in a way that is clear enough for the end user, so let's stick to this for now.

@leemthompo leemthompo added auto-backport Automatically create backport pull requests when merged v9.1.0 v9.0.0 and removed external-contributor Pull request authored by a developer outside the Elasticsearch team labels Sep 12, 2025
@leemthompo leemthompo merged commit bc8a87e into main Sep 12, 2025
12 checks passed
@leemthompo leemthompo deleted the mjmbischoff-patch-esql-docs-escapechar branch September 12, 2025 14:23
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.0
9.1

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

Labels

auto-backport Automatically create backport pull requests when merged >docs General docs changes Team:Docs Meta label for docs team v9.0.0 v9.1.0 v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants