The Einherjar aren't actually that numerous. They are an elite force that serves as the main army of Asgard (or the palace guards in times of peace), and they are personally trained by Asgard's ruler. The number of soldiers opposing Hela was likely not very much smaller than what it would have been at full force. However, they were not at full force.
In order to stop Loki from destroying Jotunheim, Thor destroys the rainbow bridge. This cuts off Asgard from the other 8 realms, at which point they descend into chaos.
After capturing Loki and bringing him and the Tesseract back to Asgard, Heimdall uses the Tesseract to repair the Bifrost and restore Asgard's connection to the other realms.
Thor: The Dark World
Now that the Bifrost is in working order again, in order to "Undo the damage [Loki] has done" by forcing Thor to destroy the bridge in the first place, Thor is sent along with the Einherjar, Sif and the Warriors Three to bring peace back to the 9 realms. A number of Einherjar fell during these conflicts, especially against the marauders of Vanaheim.
Additionally, shortly after these conflicts have concluded, Asgard is sacked by Malekith and the Dark Elves, who cause a great deal of damage, killing a number of Asgardians and all of the Einherjar guarding the dungeons and the throne room, as well as causing a great deal of devastation in the city. This same attack also left them without power, making it difficult to rebuild and impossible to defend themselves.
Post-sacking, Asgard was secretly taken over by Loki, who had disguised himself as Odin. Loki's reign was vain and selfish, having Asgardians build him a statue and put on plays depicting his heroism. During this time, it is highly unlikely that Loki would have trained any new Einherjar, not just because he wouldn't have been bothered, but also because he would have to train them himself, and his relative lack of combat skills compared to Thor and the real Odin would probably have ousted him as an imposter.
This goes on for two years before Thor returns and exposes Loki, at which point Asgard has no ruler. Thor takes Loki to search for Odin, and the events on Earth leave both of them out of commission while Hela assaults Asgard herself. Sans Thor, Loki and it seems Sif, The Einherjar and the Warriors Three are no match for Hela, who makes short work of them.
In all the time Asgard has spent onscreen, we have only ever seen two forms of defence:
Asgardian Cannons - These turrets are the Asgardians "artillery", and are specialised anti-air weapons designed to shoot down enemy air / space craft, as seen in Thor: The Dark World when they were used first against the Dark Elves during the sacking of Asgard, then again when used to try and stop Thor and Loki escaping. Being anti-air weaponry, they are of no use against a single warrior on foot.
Asgardian Shield - This forcefield covers the entire central palace of Asgard when active. However, the generator was destroyed during the sacking of Asgard, and even if the generator were repaired, it is activated from Heimdall's Observatory, which is the first thing Hela took control of when she arrived in Asgard, so there was no way to activate the shield to defend the palace.
Any other forms of defence have not been shown onscreen, and therefore do not exist within the MCU.