- Plugins and Integrations: other versions:
- Introduction to plugins
- Plugin Management
- API Extension Plugins
- Alerting Plugins
- Analysis Plugins
- Discovery Plugins
- Management and Site Plugins
- Mapper Plugins
- Scripting Plugins
- Security Plugins
- Snapshot/Restore Repository Plugins
- Transport Plugins
- Integrations
- Help for plugin authors
IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Using the _size field
editUsing the _size
field
editIn order to enable the _size
field, set the mapping as follows:
PUT my_index { "mappings": { "my_type": { "_size": { "enabled": true } } } }
The value of the _size
field is accessible in queries, aggregations, scripts,
and when sorting:
# 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": { "gt": 10 } } }, "aggs": { "Sizes": { "terms": { "field": "_size", "size": 10 } } }, "sort": [ { "_size": { "order": "desc" } } ], "script_fields": { "Size": { "script": "doc['_size']" } } }
Was this helpful?
Thank you for your feedback.