com.aerospike.client.query.IndexType Java Examples
The following examples show how to use
com.aerospike.client.query.IndexType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AerospikeJavaRDDFT.java From deep-spark with Apache License 2.0 | 6 votes |
/** * Imports dataset. * * @throws java.io.IOException */ private static void dataSetImport() throws IOException, ParseException { URL url = Resources.getResource(DATA_SET_NAME); JSONParser parser = new JSONParser(); Object obj = parser.parse(new FileReader(url.getFile())); JSONObject jsonObject = (JSONObject) obj; String id = (String) jsonObject.get("id"); JSONObject metadata = (JSONObject) jsonObject.get("metadata"); JSONArray cantos = (JSONArray) jsonObject.get("cantos"); Key key = new Key(NAMESPACE_ENTITY, SET_NAME, id); Bin binId = new Bin("id", id); Bin binMetadata = new Bin("metadata", metadata); Bin binCantos = new Bin("cantos", cantos); aerospike.put(null, key, binId, binMetadata, binCantos); aerospike.createIndex(null, NAMESPACE_ENTITY, SET_NAME, "id_idx", "id", IndexType.STRING); Key key2 = new Key(NAMESPACE_CELL, SET_NAME, 3); Bin bin_id = new Bin("_id", "3"); Bin bin_number = new Bin("number", 3); Bin bin_text = new Bin("message", "new message test"); aerospike.put(null, key2, bin_id, bin_number, bin_text); aerospike.createIndex(null, NAMESPACE_CELL, SET_NAME, "num_idx", "number", IndexType.NUMERIC); aerospike.createIndex(null, NAMESPACE_CELL, SET_NAME, "_id_idx", "_id", IndexType.STRING); }
Example #2
Source File: AerospikeTransactionalStore.java From attic-apex-malhar with Apache License 2.0 | 5 votes |
private void createIndexes() { IndexTask task; try { task = client.createIndex(null, namespace, metaSet, "operatorIdIndex", metaTableOperatorIdColumn, IndexType.NUMERIC); task.waitTillComplete(); task = client.createIndex(null, namespace, metaSet, "appIdIndex", metaTableAppIdColumn, IndexType.STRING); task.waitTillComplete(); } catch (AerospikeException ex) { throw new RuntimeException(ex); } }
Example #3
Source File: SampleData.java From aerospike-hadoop with Apache License 2.0 | 3 votes |
public static void runSeqInt(String[] args, int argi) throws Exception { int offset = Integer.parseInt(args[argi++]); int nrecs = Integer.parseInt(args[argi++]); String ndxname = binName + "ndx"; IndexTask task = client.createIndex(null, namespace, setName, ndxname, binName, IndexType.NUMERIC); task.waitTillComplete(); log.info("created secondary index on " + binName); for (long ll = offset; ll < offset + nrecs; ++ll) { String keystr = "key-" + ll; Key key = new Key(namespace, setName, keystr); Bin bin1 = new Bin(binName, ll); Bin bin2 = new Bin("bin2", "value2"); client.put(writePolicy, key, bin1, bin2); } log.info("inserted " + nrecs + " records"); }