HColumnDescriptor hcd = new HColumnDescriptor("col");
IndexSpecification iSpec = new IndexSpecification("ScanIndexf");
iSpec.addIndexColumn(hcd, "q1", ValueType.String, 10);
iSpec.addIndexColumn(hcd, "q2", ValueType.String, 10);
ihtd.addFamily(hcd);
ihtd.addIndex(iSpec);
admin.getConfiguration().set(TableInputFormat.INPUT_TABLE, tableName);
admin.createTable(ihtd);
HTable mainTable = new HTable(conf, Bytes.toBytes(tableName));
Put put = new Put(Bytes.toBytes("r1"));
put.add(hcd.getName(), Bytes.toBytes("q1"), Bytes.toBytes("v1"));