Aggregating JSON Document Data Stored in Document API

How do you perform aggregation via UDF for Document API queries? Is it possible? Possibly to get multiple values? Groupbykey and similar?

Hi @Stephen_Johnston, welcome to the community!

The Document API is for a single record with JSONPath queries supporting some aggregate functions to invoke at the end of the path. There is not a way to combine JSONPath with Lua aggregates.

Here are some great resources on the Document API:

The Aerospike Map API could potentially be useful as a Map in Aerospike is an internal representation of a JSON document. You could run a filter expression query with a no-bins policy to get the keys that match, then run a batch operation on them using the Map API.

Or you could loop through the records with the Document API.

@aanderson Thanks for the info, we’ll explore that approach. Thanks!