class EsController {

    public static final String INDEX_JAVASTACK = "javastack";
    private final ElasticsearchTemplate elasticsearchTemplate;

    private final UserRepository userRepository;

    @RequestMapping("/es/insert")
    public User insert(@RequestParam("name") String name, @RequestParam("sex") int sex) throws InterruptedException {
        // 新增
        User user = new User(RandomUtils.nextInt(), name, sex);
        IndexCoordinates indexCoordinates =  IndexCoordinates.of(INDEX_JAVASTACK);
        User save = elasticsearchTemplate.save(user, indexCoordinates);

        // 可能有延迟，休眠一秒再查询
        Thread.sleep(1000l);
        Query query = new CriteriaQuery(Criteria.where("name").is(name));
        return elasticsearchTemplate.searchOne(query, User.class, indexCoordinates).getContent();
    }

    @RequestMapping("/es/repo/insert")
    public User repoInsert(@RequestParam("name") String name, @RequestParam("sex") int sex) {<FILL_FUNCTION_BODY>}

}

        // 新增
        User user = new User(RandomUtils.nextInt(), name, sex);
        userRepository.save(user);

        // 查询
        return userRepository.findByName(name).get(0);
    
<no_super_class>