Less Than Filtered Queries, Aerosik

It was difficult for me to find the final documentation for aerospics. Using aerosik filters with or without lua, is it possible for me:

  • Order the server side of the results
  • Use a filter to execute a request larger / smaller than the request

Essentially, I want to encode the value (on the client side) and extract the first line from the value of the aerospace value, which is greater than the encoded one.

Another way of expressing this is contrary to the law of price ... that the lowest value I can find in the aerospace, the value of which is not lower than the one I give.

Id like an easy way, but I am also open to work around (or without it, if that is not reasonable / practical)

+4
source share
3 answers
  • Aerospike does not support server-side data downloads.
  • Aerospike supports filters on request. You can specify a range filter for your needs. See an example in this link .
+3
source

Basic sorting is supported in large lists (LDT).

In a large list, your key (index) is always ordered lexically by default.

Note that the directive ldt-enabled truemust be present in the namespace configuration area inaerospike.conf

javascript client example

var key = {ns: 'test', set: 'mySet', key: 'myKey'};
var callback = function (status, result) {console.log(status, result)}

var list = client.LargeList(key, 'targetBinName', null, callback));

// add first item (also determinate the list values type) 
list.add(1, callback);

// add multiple items
list.add([0, 2, 4, 5], callback);

list.add(3, callback);

// get all items
list.scan(function (status, list) {
     // list = [0, 1, 2, 3, 4, 5]
})

// select by values range
list.findRange(0, 3, callback)

// filter using udf to do custom gt/lt filtering
list.filter('udfName', callback)

if you need to save objects, you must add a property keythat will be an index for sorting, range, duplicates, etc. (duplicates are not allowed by default)

list.add({key: 1})
list.add([{key: 0},{key: 2}])

, .

NodeJS Github

+1

In the past, you would have expressed this as a UDF stream , but since release 3.12 the predicate filter would be the right solution.

Take a look at the PredExp Java client class and examples for creating sophisticated filters. There is currently predicate filtering for C , C #, and Go .

0
source

Source: https://habr.com/ru/post/1537554/


All Articles