Search code examples
goaerospikeaql

How to execute pure aql query?


I'm using Official Aerospike Package for golang.

Is there any way to get list of all existing indexes this like?

aql> show indexes

Also I haven't found any way to execute pure aql query.

How can I do this?

Update: I'm looking for something similar to this but for aerospike (example from Rails) custom_query = "select * from users" result = ActiveRecord::Base.connection.execute(custom_query)


Solution

  • AQL is an admin and data browsing tool. It's not really Aerospike's SQL, as Aerospike doesn't natively implement a query language. Instead, all the Aerospike clients give you an API to make direct get, put, scan, query calls, and those are procedural, not declarative like SQL (where you state how you want the result and the server figures out a query plan). Piyush mentioned the predicate filtering API which is fantastic and lets you create complex queries over scans and secondary-index queries.

    Specifically to your question about getting all the indexes, that's the type of thing you should use the info command for. Aerospike allows you to get and set config parameters through it, and get a wide range of metrics, run microbenchmark, etc. Everything you need for admin and monitoring.

    You can run sindex through the standalone asinfo tool, or you can call it using the info command that any client provides.

    asinfo -v "sindex"