In short, yes, there was fairly significant air-to-air combat during the Vietnam War. Claimed kills versus claimed losses are obviously a matter of spin and propaganda but North Vietnam lost between 131 (NV claim) -195 (US claim) aircraft and the US lost between 128 - 266. Apply your own judgement as to the accuracy of the claims.
North Vietnam had a well sourced aviation capability in addition to robust ground based air defense. While their intercept fighters had shorter legs than US aviation, that disadvantage is relatively meaningless when defending home turf, and the US aircraft, while technologically superior, were flying much further, and strike loaded, which is to say that they did not fly up to NV for the purpose of aerial fighting but to conduct strike ops against fixed targets. The number of pilots held for the duration of the war in NV prison camps bears out the efficacy of their air defense.
And this is not to discount the other issue - with the switch to missiles as a primary air to air weapon there had been a degradation in training in aerial combat, especially given the Cold War mission of a super sonic strike. At the same time, NV pilots were getting extensive training from the USSR and then lots of practice against the inbound US aviation.
The lines at the beginning of Topgun are more or less accurate. The US was taking pretty substantial losses against what was supposed to be a less capable adversary. The USN and USAF studied the problem. The AF decided they needed upgrades to the aircraft, the Navy decided to develop a focused training program. Following the implementation of the Fighter Weapons School (aka TOPGUN) the Navy saw its ratios radically improve against the AF’s worsening situation, which for many was sufficient evidence of TOPGUN’s efficacy.