Not able to access namespace set basis on secondary bins

When I try to apply aql query(SELECT a FROM test.user WHERE a=53) then it shows Error: (201) AEROSPIKE_ERR_INDEX_NOT_FOUND but my set have a bin named ‘a’ plzz help me.Thnks

Aerospike is primarily a key-value store. For matching based off the values of specific bins you need to create a secondary index. If you know the key you would just run something like SELECT * FROM test.user WHERE PK = 'foo'.

And how can I define a bin to be secondary index in java Springboot ApI And one more doubt In my set if a bin of name ‘salary’ is present and when i write aql query “Select salary from test.employee;” It shows that bin but when I use Aql query "Select salary from test.employee whrere salary=20; IT shows error “Error: (201) AEROSPIKE_ERR_INDEX_NOT_FOUND”. Can you plzz help me here. Thanks.

To create an index from the Java API, you would issue the sindex-create command with the info.request API.

You can create the secondary index using AQL too. That might be easier since you should really only have to do it once… https://www.aerospike.com/docs/tools/aql/

can you suggest how i can implement asynchronous query on aeroskipe using java springboot

Can you help me how can i apply Asynchronous query on aeroskipe in Java as I am finding only write and read Asynchronous query only in documentation but i want to apply Asynchronous query with filters example:

I my namespace bins secondary bins are(VID,FromTime,ToTime) Now i want to apply Asynchronous query like:

“Select * from test.set where VID=ID and FromTime>t1 and Totime < t2”.

Plzzzz help me

I am trying to implement asynchronous write using client.put() method But it gives NULLPOINTERException error and when i use Synchronously then it works perfectly. Plzz help My code is:

public void insert(itenary user) { WritePolicy policy = new WritePolicy(); WriteListener listener=new WriteListener() { @Override public void onSuccess(Key key) { System.out.println(“SUCCESSFULLY WRITTEN”); }

        @Override
        public void onFailure(AerospikeException e) {
            System.out.println("FAILED");

        }
    };
    

    Integer k=user.getId();
    Key key = new Key("test", "itenary2", user.getId());
    Bin bin4 = new Bin("id", user.getId());
    Bin bin1 = new Bin("fromtime", user.getFromtime());
    Bin bin2 = new Bin("totime", user.getTotime());
    Bin bin3 = new Bin("mode", user.getMode());
    ClientPolicy clientPolicy = new ClientPolicy();
    AerospikeClient client = new AerospikeClient(clientPolicy, "172.28.128.7", 3000);
    EventPolicy eventPolicy = new EventPolicy();
   EventLoops eventLoops = new NioEventLoops(eventPolicy, 100);
   if(eventLoops==null)
       return;
  EventLoop eventLoop = eventLoops.next();
    
    client.put(eventLoop,listener,policy,key,bin4,bin1,bin2,bin3);

}