Type to search.

ES|QL MV_SLICE function

Serverless

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Generally available

    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.

Returns a subset of a multi-value field using start and end indexes.

Embedded
Embedded
field
Expression that can be null, a single value, or multiple values. If null, the function returns null.
start
Start position. If null, the function returns null. The start argument can be negative. An index of -1 is used to specify the last value in the list.
end

End position(included). Optional; if omitted, the position at start is returned. The end argument can be negative. An index of -1 is used to specify the last value in the list.

Returns a subset of the multivalued field using the start and end index values. Indexes are 0-based. This is most useful when reading from a function that emits multivalued columns in a known order like SPLIT or MV_SORT.

The order that multivalued fields are read from underlying storage is not guaranteed. It is frequently ascending, but don’t rely on that.

field start end result
boolean integer integer boolean
cartesian_point integer integer cartesian_point
cartesian_shape integer integer cartesian_shape
date integer integer date
date_nanos integer integer date_nanos
double integer integer double
flattened The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Preview since 9.5 This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply. 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. integer integer flattened
geo_point integer integer geo_point
geo_shape integer integer geo_shape
geohash integer integer geohash
geohex integer integer geohex
geotile integer integer geotile
integer integer integer integer
ip integer integer ip
keyword integer integer keyword
long integer integer long
text integer integer keyword
unsigned_long integer integer unsigned_long
version integer integer version
ES|QL
row a = [1, 2, 2, 3]
| eval a1 = mv_slice(a, 1), a2 = mv_slice(a, 2, 3)
a:integer a1:integer a2:integer
[1, 2, 2, 3] 2 [2, 3]
ES|QL
row a = [1, 2, 2, 3]
| eval a1 = mv_slice(a, -2), a2 = mv_slice(a, -3, -1)
a:integer a1:integer a2:integer
[1, 2, 2, 3] 2 [2, 2, 3]