The routing and spectrum assignment problems in elastic optical networks are well-known NP-hard problem, and are even more complex and challenging when the energy consumption is taken into account. To tackle this challenging problem, we establish a bi-level programming model with the energy consumption of the optical networks and the maximum index of used frequency slots as the leader's and follower's objectives to be minimized, respectively, which are used to determine the optimal schemes of routing and spectrum assignments. To solve the model effectively, a hybrid genetic algorithm framework integrating a heuristic algorithm into a genetic algorithm is proposed. We use heuristic algorithm to sort the connection requests and design a genetic algorithm with tailor-made crossover, mutation and local search operator to look for an optimal routing and spectrum assignment scheme. Finally, simulation experiments are conducted, and the experimental results indicate the effectiveness of the proposed model and algorithms.