OpenSearch/docs/plugins/mapper-size.asciidoc

85 lines
1.7 KiB
Plaintext
Raw Normal View History

[[mapper-size]]
=== Mapper Size Plugin
The mapper-size plugin provides the `_size` meta field which, when enabled,
indexes the size in bytes of the original
{ref}/mapping-source-field.html[`_source`] field.
[[mapper-size-install]]
[float]
==== Installation
This plugin can be installed using the plugin manager:
[source,sh]
----------------------------------------------------------------
sudo bin/elasticsearch-plugin install mapper-size
----------------------------------------------------------------
The plugin must be installed on every node in the cluster, and each node must
be restarted after installation.
[[mapper-size-remove]]
[float]
==== Removal
The plugin can be removed with the following command:
[source,sh]
----------------------------------------------------------------
sudo bin/elasticsearch-plugin remove mapper-size
----------------------------------------------------------------
The node must be stopped before removing the plugin.
[[mapper-size-usage]]
==== Using the `_size` field
In order to enable the `_size` field, set the mapping as follows:
[source,js]
--------------------------
PUT my_index
{
"mappings": {
"my_type": {
"_size": {
"enabled": true
}
}
}
}
--------------------------
// CONSOLE
The value of the `_size` field is accessible in queries:
[source,js]
--------------------------
# Example documents
PUT my_index/my_type/1
{
"text": "This is a document"
}
PUT my_index/my_type/2
{
"text": "This is another document"
}
GET my_index/_search
{
"query": {
"range": {
"_size": { <1>
"gt": 10
}
}
}
}
--------------------------
// CONSOLE
// TEST[continued]
<1> Querying on the `_size` field