The issue was resolved by changing the following parameters
work_mem
changed from 4mb to 50 mbrandom_Page_cost
changed to 1 from 4max_wal_size
reduced to 128 mb from 2 gbcpu_index_tuple_cost
to 0.003
Also changed the following as suggested by @Gerad H.pille
max_parallel__Workers_per_Gather
max_parallel_maintainence_workers