Skip to content

Commit 4efcd9b

Browse files
authored
[DOCS] Adds a doc value field example to Mapper Size docs (#57257) (#57282)
Changes: * Updates snippet to include doc value field example. * Fixes a broken link to inline script settings.
1 parent 2a68d42 commit 4efcd9b

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

docs/plugins/mapper-size.asciidoc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,36 +45,49 @@ GET my_index/_search
4545
{
4646
"query": {
4747
"range": {
48-
"_size": { <1>
48+
"_size": { <1>
4949
"gt": 10
5050
}
5151
}
5252
},
5353
"aggs": {
5454
"sizes": {
5555
"terms": {
56-
"field": "_size", <2>
56+
"field": "_size", <2>
5757
"size": 10
5858
}
5959
}
6060
},
6161
"sort": [
6262
{
63-
"_size": { <3>
63+
"_size": { <3>
6464
"order": "desc"
6565
}
6666
}
6767
],
6868
"script_fields": {
6969
"size": {
70-
"script": "doc['_size']" <4>
70+
"script": "doc['_size']" <4>
7171
}
72-
}
72+
},
73+
"docvalue_fields": [
74+
{
75+
"field": "_size" <5>
76+
}
77+
]
7378
}
7479
--------------------------
7580
// TEST[continued]
7681

7782
<1> Querying on the `_size` field
7883
<2> Aggregating on the `_size` field
7984
<3> Sorting on the `_size` field
80-
<4> Accessing the `_size` field in scripts (inline scripts must be modules-security-scripting.html#enable-dynamic-scripting[enabled] for this example to work)
85+
<4> Uses a
86+
{ref}/search-request-body.html#request-body-search-script-fields[script field]
87+
to return the `_size` field in the search response.
88+
<5> Uses a
89+
{ref}/search-request-body.html#request-body-search-docvalue-fields[doc value
90+
field] to return the `_size` field in the search response. Doc value fields are
91+
useful if
92+
{ref}/modules-scripting-security.html#allowed-script-types-setting[inline
93+
scripts are disabled].

0 commit comments

Comments
 (0)