Skip to content

Record metadata

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 on newer servers; prefer record_size on database 7.0+ (and 8.1+ guidance in each operation).

Ops

device_size

device_size()
Description

Deprecated in Database 8.1. Use record_size instead. Returns the record’s storage size in bytes as an integer. Value is 0 when namespace is configured storage-engine memory.

Returns
integer_value
Introduced
5.2.0.4
Example

(Deprecated.) When still using device-size metadata on disk-backed namespaces, find records over 1 MiB. Prefer record_size on server 7.0+.

Expression exp = Exp.build(
Exp.gt(Exp.deviceSize(), Exp.val(1024 * 1024)));

digest_modulo

digest_modulo(mod)
Description

Returns a record digest modulo as an integer.

Arguments
NameType
mod integer_value
Returns
integer_value
Introduced
5.2.0.4
Example

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

Expression exp = Exp.build(
Exp.eq(Exp.digestModulo(3), Exp.val(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_value
Introduced
5.2.0.4
Example

XDR shipping filter — select tombstone records only.

Expression exp = Exp.build(Exp.isTombstone());

key_exists

key_exists()
Description

Returns true if the record has a stored key (written with send_key / POLICY_KEY_SEND), otherwise false. Once stored, the key persists with the record until the record is deleted.

Returns
boolean_value
Introduced
5.2.0.4
Example

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

Expression exp = Exp.build(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_value
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).

Expression exp = Exp.build(
Exp.lt(Exp.lastUpdate(), Exp.intBin("updated_at")));

memory_size

memory_size()
Description

Deprecated in Database 8.1. Use record_size instead. Returns the record’s size in bytes as an integer when the namespace is configured storage-engine memory, otherwise returns 0.

Prior to Database 7.0: Returns the record’s memory size in bytes as an integer when either the namespace is configured data-in-memory true or storage-engine memory, otherwise returns 0.

Note: deprecated as of Database 7.0.0 since the data-size and memory-size are now the same size. Use record_size instead.

Returns
integer_value
Introduced
5.3.0
Example

(Deprecated.) When still using legacy memory-size metadata, find records over 1 MiB. Prefer record_size on server 7.0+.

Expression exp = Exp.build(
Exp.gt(Exp.memorySize(), Exp.val(1024 * 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_value
Introduced
7.0.0
Example

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

Expression exp = Exp.build(
Exp.gt(Exp.recordSize(), Exp.val(1024 * 1024)));

set_name

set_name()
Description

Returns the record’s set_name as a string.

Returns
string_value
Introduced
5.2.0.4
Example

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

Expression exp = Exp.build(Exp.or(
Exp.eq(Exp.setName(), Exp.val("books")),
Exp.eq(Exp.setName(), Exp.val("bundles"))));

since_update

since_update()
Description

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

Returns
integer_value
Introduced
5.2.0.4
Example

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

Expression exp = Exp.build(
Exp.lt(Exp.sinceUpdate(), Exp.val(2 * 60 * 60 * 1000)));

ttl

ttl()
Description

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

Returns
integer_value
Introduced
5.2.0.4
Example

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

Expression exp = Exp.build(
Exp.le(Exp.ttl(), Exp.val(24 * 60 * 60)));

void_time

void_time()
Description

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

Returns
integer_value
Introduced
5.2.0.4
Example

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

Expression exp = Exp.build(Exp.eq(Exp.voidTime(), Exp.val(-1)));
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?