Binary field type
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Generally available
Stack
Generally available
The binary type accepts a binary value as a Base64 encoded string. The field is not stored by default and is not searchable:
PUT my-index-000001{ "mappings": { "properties": { "name": { "type": "text" }, "blob": { "type": "binary" } } } }PUT my-index-000001/_doc/1{ "name": "Some binary blob", "blob": "U29tZSBiaW5hcnkgYmxvYg==" }
- The Base64 encoded binary value must not have embedded newlines
\n.
The following parameters are accepted by binary fields:
doc_values- Should the field be stored on disk in a column-stride fashion, so that it can later be used for sorting, aggregations, or scripting? Accepts
trueorfalse(default). This parameter will be automatically set totruefor TSDB indices (indices that haveindex.modeset totime_series). store- Whether the field value should be stored and retrievable separately from the
_sourcefield. Acceptstrueorfalse(default).
Synthetic source may sort binary values in order of their byte representation. For example:
PUT idx{ "settings": { "index": { "mapping": { "source": { "mode": "synthetic" } } } }, "mappings": { "properties": { "binary": { "type": "binary", "doc_values": true } } } }PUT idx/_doc/1{ "binary": ["IAA=", "EAA="] }
Will become:
{
"binary": ["EAA=", "IAA="]
}