Skip to content

Record metadata

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

Record metadata expressions read Aerospike-managed fields: TTL and void time, digest sampling, set name, stored key flag, record size, last-update and time-since-update, and tombstone state (where applicable). Use them in secondary index filters, query predicates, record policies, and XDR shipping filters—anywhere the client accepts a boolean or typed expression over record metadata.

Wrap metadata values in comparison or logic expressions when you need a boolean filter (true / false / unknown). For how metadata-only evaluation interacts with the rest of an expression, see the expressions overview execution model.

memory_size and device_size are deprecated with warnings in Database 8.1 and later. Use record_size, introduced in 7.0, instead. It returns a consistent value regardless of storage engine.

The Developer SDK’s AEL text syntax exposes the same metadata as path functions on $, for example $.ttl() < 3600.

Each operation’s Example shows the code in nine tabs: Aerospike Expression Language (AEL) text on the Java SDK and Python SDK tabs, and the Exp builder on the other seven. See the AEL reference for AEL grammar.

Ops

device_size

deprecated
device_size()
Description

Returns the record’s storage size in bytes, or 0 when the namespace is configured storage-engine memory. Superseded by record_size in Database 8.1.

Returns
integer
Introduced
5.2.0.4
Example

(Deprecated.) When still using device-size metadata on disk-backed namespaces, find records over 128 KiB. Prefer record_size on Database 7.0 and later.

String exp = "$.deviceSize() > 128 * 1024";

digest_modulo

digest_modulo(mod)
Description

Returns a record digest modulo as an integer.

Arguments
NameTypeDescription
modinteger literal

Divisor applied to the record digest. The expression returns the remainder, so a mod of 3 yields 0, 1 or 2 — enough to sample a fixed fraction of records.

Returns
integer
Introduced
5.2.0.4
Example

Sample roughly one third of records (digest modulo 3 equals 0).

String exp = "$.digestModulo(3) == 0";

is_tombstone

is_tombstone()
Description

Returns true if the record is a tombstone, otherwise false. Note: Applies to XDR filters and to write requests using read/write expressions.

Returns
boolean
Introduced
5.2.0.4
Example

XDR shipping filter — select tombstone records only.

String exp = "$.isTombstone()";

key_exists

key_exists()
Description

Returns true if the record has a stored key (written with the write policy’s send-key option), otherwise false. Once stored, the key persists with the record until the record is deleted.

Returns
boolean
Introduced
5.2.0.4
Example

Return records that have a stored primary key in the record metadata.

String exp = "$.keyExists()";

last_update

last_update()
Description

Returns the record’s last-update-time (LUT) in nanoseconds (millisecond resolution) from Unix Epoch (1/1/1970) as an integer.

Returns
integer
Introduced
5.2.0.4
Example

Return records whose server last-update time (LUT, nanoseconds since epoch) is less than integer bin updated_at (for example, an application timestamp in the same units).

String exp = "$.lastUpdateTime() < $.updated_at";

memory_size

deprecated
memory_size()
Description

Returns the record’s size in bytes when the namespace is configured storage-engine memory, otherwise 0. Before Database 7.0 it also returned a size when the namespace was configured data-in-memory true; since 7.0 the data size and memory size are the same. Superseded by record_size in Database 8.1.

Returns
integer
Introduced
5.3.0
Example

(Deprecated.) When still using legacy memory-size metadata, find records over 128 KiB. Prefer record_size on Database 7.0 and later.

String exp = "$.memorySize() > 128 * 1024";

record_size

record_size()
Description

Returns the record’s size in bytes as an integer. This is the physical size of the record in the namespace storage device. If compression is turned on, the record size reflects the compressed size of the record, not the logical uncompressed size.

Returns
integer
Introduced
7.0.0
Example

Find records larger than 128 KiB on the storage device (compressed size when compression is enabled).

String exp = "$.recordSize() > 128 * 1024";

set_name

set_name()
Description

Returns the record’s set_name as a string.

Returns
string
Introduced
5.2.0.4
Example

Return records in Aerospike sets books or bundles (aligned with catalog-style examples elsewhere).

String exp = "$.setName() == 'books' or $.setName() == 'bundles'";

since_update

since_update()
Description

Returns the time (in milliseconds) since the record was last updated.

Returns
integer
Introduced
5.2.0.4
Example

Return records updated within the last 2 hours (milliseconds since last update).

String exp = "$.timeSinceLastUpdate() < 2 * 60 * 60 * 1000";

ttl

ttl()
Description

Returns the record’s TTL (Time To Live) as an integer.

Returns
integer
Introduced
5.2.0.4
Example

Return records whose TTL is at most 24 hours (seconds remaining until expiration).

String exp = "$.ttl() <= 24 * 60 * 60";

void_time

void_time()
Description

Returns the record’s expiration time in nanoseconds (resolution in seconds) as an integer.

Returns
integer
Introduced
5.2.0.4
Example

Return records that never expire (void time -1).

String exp = "$.voidTime() == -1";