/** * Create scalar secondary index. * This asynchronous server call will return before command is complete. * The user can optionally wait for command completion by using the returned * IndexTask instance. * * @param policy generic configuration parameters, pass in null for defaults * @param namespace namespace - equivalent to database name * @param setName optional set name - equivalent to database table * @param indexName name of secondary index * @param binName bin name that data is indexed on * @param indexType underlying data type of secondary index * @throws AerospikeException if index create fails */ public final IndexTask createIndex( Policy policy, String namespace, String setName, String indexName, String binName, IndexType indexType ) throws AerospikeException { return createIndex(policy, namespace, setName, indexName, binName, indexType, IndexCollectionType.DEFAULT); }
/** * Create scalar secondary index. * This asynchronous server call will return before command is complete. * The user can optionally wait for command completion by using the returned * IndexTask instance. * * @param policy generic configuration parameters, pass in null for defaults * @param namespace namespace - equivalent to database name * @param setName optional set name - equivalent to database table * @param indexName name of secondary index * @param binName bin name that data is indexed on * @param indexType underlying data type of secondary index * @throws AerospikeException if index create fails */ public final IndexTask createIndex( Policy policy, String namespace, String setName, String indexName, String binName, IndexType indexType ) throws AerospikeException { return createIndex(policy, namespace, setName, indexName, binName, indexType, IndexCollectionType.DEFAULT); }
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); } }
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); } }
@Override public <T> void createIndex(Class<T> domainType, String indexName, String binName, IndexType indexType) { try { String setName = getSetName(domainType); IndexTask task = client.createIndex(null, this.namespace, setName, indexName, binName, indexType); if (task != null) { task.waitTillComplete(); } } catch (AerospikeException e) { DataAccessException translatedException = exceptionTranslator.translateExceptionIfPossible(e); throw translatedException == null ? e : translatedException; } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.NUMERIC); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.NUMERIC); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.STRING, IndexCollectionType.MAPKEYS); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
private void createIndex( AerospikeClient client, String indexName, String binName ) { console.info("Create index: ns=%s set=%s index=%s bin=%s", params.namespace, params.set, indexName, binName); Policy policy = new Policy(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.NUMERIC); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.STRING); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.NUMERIC); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.NUMERIC); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.NUMERIC); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.NUMERIC); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.STRING); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
private void createIndex( AerospikeClient client, Parameters params, IndexCollectionType indexType, String indexName, String binName ) throws Exception { console.info("Create GeoJSON %s index: ns=%s set=%s index=%s bin=%s", indexType, params.namespace, params.set, indexName, binName); Policy policy = new Policy(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.GEO2DSPHERE, indexType); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.GEO2DSPHERE); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }
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(); policy.socketTimeout = 0; // Do not timeout on index create. try { IndexTask task = client.createIndex(policy, params.namespace, params.set, indexName, binName, IndexType.GEO2DSPHERE); task.waitTillComplete(); } catch (AerospikeException ae) { if (ae.getResultCode() != ResultCode.INDEX_ALREADY_EXISTS) { throw ae; } } }