Skip to content

Commit 9439d30

Browse files
docs(clp-json): Update list of characters that requires escaping in queries. (#617)
Co-authored-by: Kirk Rodrigues <[email protected]>
1 parent 88d83bf commit 9439d30

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

docs/src/user-guide/reference-json-search-syntax.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ To search for a key or value with multiple words, you must quote the key/value w
3333
"multi-word key": "multi-word value"
3434
```
3535

36-
Queries for keys or values with the following literal characters must escape the characters using a
37-
`\` (backslash): `\`, `(`, `)`, `:`, `<`, `>`, `"`, `*`, `{`, `}`.
38-
3936
:::{caution}
4037
Currently, a query that contains spaces is interpreted as a substring search, i.e., it will match
4138
log events that contain the value as a *substring*. In a future version of CLP, these queries will
4239
be interpreted as _exact_ searches unless they include [wildcards](#wildcards-in-values).
4340
:::
4441

42+
:::{note}
43+
Certain characters have special meanings when used in keys or values, so to search for the
44+
characters literally, you must escape them. For a list of such characters, see
45+
[Escaping special characters](#escaping-special-characters).
46+
:::
47+
4548
### Querying nested kv-pairs
4649

4750
If the kv-pair is nested in one or more objects, you can specify the key in one of two ways:
@@ -161,6 +164,33 @@ There are three supported boolean operators:
161164

162165
You can use parentheses (`()`) to apply an operator to a group of expressions.
163166

167+
### Escaping special characters
168+
169+
Keys containing the following literal characters must escape the characters using a `\` (backslash):
170+
171+
* `\`
172+
* `"`
173+
* `.`
174+
175+
Values containing the following literal characters must escape the characters using a `\`
176+
(backslash):
177+
178+
* `\`
179+
* `"`
180+
* `?`
181+
* `*`
182+
183+
_Unquoted_ keys or values containing the following literal characters must also escape the
184+
characters using a `\` (backslash):
185+
186+
* `(`
187+
* `)`
188+
* `:`
189+
* `<`
190+
* `>`
191+
* `{`
192+
* `}`
193+
164194
## Examples
165195

166196
**Search for log events that contain a specific key-value pair:**

0 commit comments

Comments
 (0)