Flying ants can be eliminated by using aerosol and residual insecticides. Keep floors and counters clean and food put away. Bleach is good to use for cleaning. Take trash out.
Flying ants are released in order to establish a new colony. Find the location where they came from and aim to kill the queen. Gel baits are the most effective.
The most effective way to get rid of flying ants is to use a chemical that kills carpenter ants. These ants are drawn to food and water supplies so maintaining a clean home will also prevent them from coming in.