Avoid the “swarm” when possible by going away from it. If it targets you, pull out a torch and swing in the air in the direction of the swarm, while looking about “hip high” as the hit box becomes visible from fire. Then use torch, sword, or Dino to attack the “hit box”. Once dead, you can harvest it where the hit box was last before it died.
The hit box will tend to fly at ground level, but will fly up to where you are if you are not standing at ground level.
Some Dino’s don’t agro the swarm, others do.
The swarm will still attack unattended Dinos.
As of a certain recent patch, they can no longer target or attack you inside a base (building), but they can get over Dino walls, so your Dino’s need to be on neutral.
I don’t trust leaving my base doors open, just in case they can get through them while open.
For some reason on single player when I was targeted by them i didnt have a torch becuase i was building my base they chased me like 5 minutes i think and then died i saw them on my base floor dead. So if you dont have a torch stay away and survive