for (HTableInterfaceReference ref : refs) {
// Disable the index by using the updateIndexState method of MetaDataProtocol end point coprocessor.
String indexTableName = ref.getTableName();
byte[] indexTableKey = SchemaUtil.getTableKeyFromFullName(indexTableName);
HTableInterface systemTable = env.getTable(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES);
MetaDataProtocol mdProxy = systemTable.coprocessorProxy(MetaDataProtocol.class, indexTableKey);
// Mimic the Put that gets generated by the client on an update of the index state
Put put = new Put(indexTableKey);
put.add(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES, PhoenixDatabaseMetaData.INDEX_STATE_BYTES, PIndexState.DISABLE.getSerializedBytes());
List<Mutation> tableMetadata = Collections.<Mutation>singletonList(put);
MetaDataMutationResult result = mdProxy.updateIndexState(tableMetadata);