mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-26 08:07:27 -04:00
* [DOCS] Documentation for the stable plugin API * Removed references to rivers * Add link to Cloud docs for managing plugins * Add caveat about needing to update plugins * Remove reference to site plugins * Wording and clarifications * Fix test * Add link to text analysis docs * Text analysis API dependencies * Remove reference to REST endpoints and fix list * Move plugin descriptor file to its own page * Typos * Review feedback * Delete unused properties file * Changed into * Changed 'elasticsearchVersion' into 'pluginApiVersion' * Swap 'The analysis plugin API' and 'Plugin file structure' sections * Update docs/plugins/authors.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-non-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-non-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-non-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/example-text-analysis-plugin.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/plugin-descriptor-file.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/plugin-script.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-non-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Update docs/plugins/development/creating-non-text-analysis-plugins.asciidoc Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> * Rewording * Add modulename and extended.plugins descriptions for descriptor file * Add link to existing plugins in Github * Review feedback * Use 'stable' and 'classic' plugin naming * Fix capitalization * Review feedback --------- Co-authored-by: Arianna Laudazzi <46651782+alaudazzi@users.noreply.github.com> Co-authored-by: William Brafford <william.brafford@elastic.co>
94 lines
No EOL
2.1 KiB
Text
94 lines
No EOL
2.1 KiB
Text
[[mapper-size]]
|
|
=== Mapper size plugin
|
|
|
|
The mapper-size plugin provides the `_size` metadata field which, when enabled,
|
|
indexes the size in bytes of the original
|
|
{ref}/mapping-source-field.html[`_source`] field.
|
|
|
|
:plugin_name: mapper-size
|
|
include::install_remove.asciidoc[]
|
|
|
|
[[mapper-size-usage]]
|
|
==== Using the `_size` field
|
|
|
|
In order to enable the `_size` field, set the mapping as follows:
|
|
|
|
[source,console]
|
|
--------------------------
|
|
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 {ref}/search-fields.html#search-fields-param[fields parameter]:
|
|
|
|
[source,console]
|
|
--------------------------
|
|
# 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>
|
|
}
|
|
}
|
|
}
|
|
--------------------------
|
|
// TEST[continued]
|
|
|
|
<1> Querying on the `_size` field
|
|
<2> Aggregating on the `_size` field
|
|
<3> Sorting on the `_size` field
|
|
<4> Use the `fields` parameter to return the `_size` in the search response.
|
|
<5> Uses a
|
|
{ref}/search-fields.html#script-fields[script field]
|
|
to return the `_size` field in the search response.
|
|
|
|
[NOTE]
|
|
.Using `_size` in {kib}
|
|
================================================
|
|
|
|
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.
|
|
|
|
================================================ |