Skip to content

Frequently asked questions

Q: What does the selectFlags parameter do, and what options are available?

A: The selectFlags parameter controls what the server returns from a path expression.

Possible values are:

ValueDescription
MATCHING_TREEReturn a tree from the root (bin) level to the bottom of the tree, with only non-filtered out nodes.
VALUEReturn a list of the values of the nodes finally selected by the context.
MAP_KEYFor final selected nodes which are elements of maps, return the appropiate map key.
MAP_KEY_VALUEReturn a list of key-value pairs.
NO_FAILIf the expression in the context hits an invalid type (e.g., selects as an integer when the value is a string), do not fail the operation, just ignore those elements.

Q: Can I use path expressions on both Maps and Lists?

A: Yes. CTX.allChildren and CTX.allChildrenWithFilter work across both maps and lists. Loop variables (MAP_KEY, VALUE, LIST_INDEX) allow filters to adapt depending on whether the container is a map of entries or a list of elements.

Q: What kind of exception will I see on the client if I don’t use NO_FAIL? Is it recoverable or will the whole operation abort?

A: Without Exp.SELECT_NO_FAIL, if the server encounters a type mismatch (e.g., it expects a map or list but finds a string), the entire path expression operation fails. The operation does not return partial results.


Q: How do I return only certain pieces of data, such as only the variant IDs?

A: The SelectFlags parameter controls return modes. For example, MATCHING_TREE returns the full subtree, MAP_KEY returns only keys, and VALUE returns only values. Choose the mode that matches your use case.


Q: Can path expressions be combined with secondary indexes?

A: Yes. You can create expression-based indexes on filtered elements of Maps/Lists. This lets you query and traverse deeply nested structures without denormalizing data.


Q: Can I use an IN expression (for example, WHERE roomId IN (10001, 30002, 10003)) with path expressions?

A: Aerospike does not provide a generic SQL‑style IN operator at the cluster query level. However, within a single record, you can express IN‑style membership over map keys or values using expression primitives and loop variables.

Here is an example that filters only rooms whose map key (roomId) is in a given list of IDs:

// Build room-level filter: roomId IN roomIds AND notDeleted AND timeValid
Exp roomIdInListExp = Exp.gt(
ListExp.getByValue(
ListReturnType.COUNT,
Exp.stringLoopVar(LoopVarPart.MAP_KEY), // current map key (roomId)
Exp.val(roomIds) // list of allowed roomIds
),
Exp.val(0) // > 0 -> membership
);
Exp roomFilter = Exp.and(roomIdInListExp, notDeletedExp, timeValidExp);
// Use in a path expression
Record record = client.operate(null, key,
CdtOperation.selectByPath(binName, Exp.SELECT_NO_FAIL,
CTX.allChildrenWithFilter(roomFilter), // room-level: roomId IN list + other filters
CTX.allChildren(),
CTX.allChildrenWithFilter(roomIdInListExp)
)
);

Performance

Q: What are the performance implications of path expressions?

A: Path expressions execute server-side, which reduces network transfer by returning only matching elements. For deeply nested structures, this can significantly reduce latency compared to fetching entire records and filtering client-side.

Performance depends on:

  • CDT size: Larger Maps/Lists require more processing time.
  • Nesting depth: Deeper structures take longer to traverse.
  • Filter complexity: Complex boolean expressions add overhead.
  • Result size: Returning MATCHING_TREE transfers more data than MAP_KEYS.

For performance-critical applications, benchmark with realistic data volumes.


Q: What’s the maximum nesting depth supported?

A: Path expressions support up to 15 levels of CDT nesting, matching the Aerospike CDT context depth limit.


Q: Are there limits on how many elements can be filtered?

A: There’s no hard limit on the number of elements, but very large CDTs (millions of elements) may impact latency. If you’re working with extremely large collections, consider partitioning data across multiple records or using secondary indexes to narrow the scope before applying path expressions.

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?