基于elasticsearch的CRUD简单封装java版

时间:2023-07-14 14:33:37
【文件属性】:

文件名称:基于elasticsearch的CRUD简单封装java版

文件大小:15KB

文件格式:JAR

更新时间:2023-07-14 14:33:37

elasticsearch orm

简化elasticsearch API的使用方式 使用示例 ApplicationContext context = new AnnotationConfigApplicationContext(TestConfiguration.class); ESBasicService service = context.getBean(ESBasicService.class); /*service.createIndexAndMapping(UserM.class); // 插入数据 List users = new ArrayList<>(); UserM user = new UserM("张先生", 25); users.add(user); UserM user2 = new UserM("王大姐", 30); users.add(user2); UserM user3 = new UserM("王小二", 25); users.add(user3); int count = service.saveDatas(users); System.out.println(count);*/ QueryRule rule = new QueryRule(); rule.add(Restrictions.ge("age", 20)).add(Restrictions.like("name", "*王*")); System.out.println(JSON.toJSONString(service.list(UserM.class, rule))); 源码链接:https://blog.csdn.net/u010825190/article/details/106838796


网友评论