Skip to content

Commit 0cf5c7c

Browse files
(Doc+) Add typed_keys parameter set as true
### Description This PR Add `typed_keys` parameter set as `true`: - a `JsonException` that occurs when using aggregations with `SearchTemplateAsync` because the mandatory `typed_keys=true` parameter is undocumented. - This change improves the developer experience by preventing user confusion and saving significant debugging time when using search templates. ### Related issues - #7605 (comment) - elastic/sdh-search#1648 (comment)
1 parent 9d1b93f commit 0cf5c7c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/usage/aggregations.asciidoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33

44
This page demonstrates how to use aggregations.
55

6+
[discrete]
7+
=== Using Aggregations with Search Templates
8+
9+
[IMPORTANT]
10+
.A Note on `typed_keys` and `SearchTemplateAsync`
11+
====
12+
When using aggregations with the `SearchTemplateAsync` API, it is **mandatory** to include the `typed_keys: true` parameter in your request.
13+
14+
Unlike the `SearchAsync` API, which adds the `typed_keys=true` parameter to requests automatically, the `SearchTemplateAsync` API cannot do so due to the flexible nature of search templates.
15+
16+
If this parameter is omitted, the client's deserializer will fail with a `JsonException` as it cannot determine the aggregation types from the response.
17+
====
18+
19+
To correctly receive aggregations from a search template, you must explicitly include `typed_keys: true` in the parameters you provide to the `SearchTemplateAsync` call.
20+
21+
622
[discrete]
723
=== Top-level aggreggation
824

0 commit comments

Comments
 (0)