Issue with getrawtransaction txindex and reindex
txindex=1 has to be added in the bitcoin.conf file.

When starting the node, the following command should be issued

bitcoind -reindex=1 -daemon


You can keep checking the debug.log file in the .bitcoin folder to see the progress of blockchain synchronisation

Until you have downloaded the entire blockchain and reindexed, getblockcount will keep returning 0.