mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
* [docs] Migrate docs from AsciiDoc to Markdown (#123507) * delete asciidoc files * add migrated files * fix errors * Disable docs tests * Clarify release notes page titles * Revert "Clarify release notes page titles" This reverts commit8be688648d
. * Comment out edternal URI images * Clean up query languages landing pages, link to conceptual docs * Add .md to url * Fixes inference processor nesting. --------- Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> Co-authored-by: Liam Thompson <leemthompo@gmail.com> Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com> Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com> (cherry picked from commitb7e3a1e14b
) # Conflicts: # docs/build.gradle # docs/reference/migration/index.asciidoc # docs/reference/migration/migrate_9_0.asciidoc # docs/reference/release-notes.asciidoc # docs/reference/release-notes/9.0.0.asciidoc # docs/reference/release-notes/highlights.asciidoc * Fix build file * Really fix build file --------- Co-authored-by: Colleen McGinnis <colleen.j.mcginnis@gmail.com>
1.8 KiB
1.8 KiB
Using the _size field [mapper-size-usage]
In order to enable the _size
field, set the mapping as follows:
PUT my-index-000001
{
"mappings": {
"_size": {
"enabled": true
}
}
}
The value of the _size
field is accessible in queries, aggregations, scripts, and when sorting. It can be retrieved using the fields parameter:
# Example documents
PUT my-index-000001/_doc/1
{
"text": "This is a document"
}
PUT my-index-000001/_doc/2
{
"text": "This is another document"
}
GET my-index-000001/_search
{
"query": {
"range": {
"_size": { <1>
"gt": 10
}
}
},
"aggs": {
"sizes": {
"terms": {
"field": "_size", <2>
"size": 10
}
}
},
"sort": [
{
"_size": { <3>
"order": "desc"
}
}
],
"fields": ["_size"], <4>
"script_fields": {
"size": {
"script": "doc['_size']" <5>
}
}
}
- Querying on the
_size
field - Aggregating on the
_size
field - Sorting on the
_size
field - Use the
fields
parameter to return the_size
in the search response. - Uses a script field to return the
_size
field in the search response.
::::{admonition} Using _size
in {kib}
:class: note
To use the _size
field in {{kib}}, update the metaFields
setting and add _size
to the list of meta fields. metaFields
can be configured in {{kib}} from the Advanced Settings page in Management.
::::