use of com.aerospike.client.policy.Policy in project aerospike-client-java by aerospike.
the class QueryString method createIndex.
private void createIndex(AerospikeClient client, Parameters params, String indexName, String binName) throws Exception {
console.info("Create index: ns=%s set=%s index=%s bin=%s", params.namespace, params.set, indexName, binName);
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.STRING);
task.waitTillComplete();
}
use of com.aerospike.client.policy.Policy in project aerospike-client-java by aerospike.
the class QueryRegion method createIndex.
private void createIndex(AerospikeClient client, Parameters params, String indexName, String binName) throws Exception {
console.info("Create index: ns=%s set=%s index=%s bin=%s", params.namespace, params.set, indexName, binName);
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.GEO2DSPHERE);
task.waitTillComplete();
}
use of com.aerospike.client.policy.Policy in project aerospike-client-java by aerospike.
the class QueryCollection method createIndex.
private void createIndex(AerospikeClient client, Parameters params, String indexName, String binName) throws Exception {
console.info("Create mapkeys index: ns=%s set=%s index=%s bin=%s", params.namespace, params.set, indexName, binName);
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.STRING, IndexCollectionType.MAPKEYS);
task.waitTillComplete();
}
use of com.aerospike.client.policy.Policy in project aerospike-client-java by aerospike.
the class TestQueryCollection method prepare.
@BeforeClass
public static void prepare() {
RegisterTask rtask = client.register(null, TestQueryCollection.class.getClassLoader(), "udf/record_example.lua", "record_example.lua", Language.LUA);
rtask.waitTillComplete();
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
IndexTask task = client.createIndex(policy, args.namespace, args.set, indexName, binName, IndexType.STRING, IndexCollectionType.MAPKEYS);
task.waitTillComplete();
for (int i = 1; i <= size; i++) {
Key key = new Key(args.namespace, args.set, keyPrefix + i);
HashMap<String, String> map = new HashMap<String, String>();
map.put(mapKeyPrefix + 1, mapValuePrefix + i);
if (i % 2 == 0) {
map.put(mapKeyPrefix + 2, mapValuePrefix + i);
}
if (i % 3 == 0) {
map.put(mapKeyPrefix + 3, mapValuePrefix + i);
}
Bin bin = new Bin(binName, map);
client.put(null, key, bin);
}
}
use of com.aerospike.client.policy.Policy in project aerospike-client-java by aerospike.
the class TestQueryExecute method prepare.
@BeforeClass
public static void prepare() {
RegisterTask rtask = client.register(null, TestQueryExecute.class.getClassLoader(), "udf/record_example.lua", "record_example.lua", Language.LUA);
rtask.waitTillComplete();
Policy policy = new Policy();
// Do not timeout on index create.
policy.socketTimeout = 0;
IndexTask itask = client.createIndex(policy, args.namespace, args.set, indexName, binName1, IndexType.NUMERIC);
itask.waitTillComplete();
for (int i = 1; i <= size; i++) {
Key key = new Key(args.namespace, args.set, keyPrefix + i);
client.put(null, key, new Bin(binName1, i), new Bin(binName2, i));
}
}
Aggregations