Honey bees (Apis mellifera) can be reared in an incubator to study the mechanisms of aging and longevity; however, whether breeding in an incubator and using the abdomen without the digestive tract influences the expression of immune genes is unclear. In this study, we assayed the immune genes including abaecin, hymenoptaecin, defensin-2, glucose dehydrogenase, phenoloxidase, and lysozyme from the whole body of young and middle-aged worker bees reared in field hives, the whole body of young and middle-aged worker bees reared in a 34 °C incubator, and the abdomen without the digestive tract of young and middle-aged worker bees reared in a 34 °C incubator. The results showed that three groups of middle-aged worker bees have higher immunity than young worker bees. Furthermore, the similarity of immune genes expression in three groups indicated that the abdomen without the digestive tract of honey bees reared in an incubator can be used to study the relationship between immunity and aging and longevity to avoid the interference of pathogens and parasites from field hives.