package com.gz; import com.alibaba.fastjson.JSON; import org.frameworkset.elasticsearch.ElasticSearchHelper; import org.frameworkset.elasticsearch.boot.BBossESStarter; import org.frameworkset.elasticsearch.client.ClientInterface; import org.frameworkset.elasticsearch.entity.ESDatas; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; /** * @author LiuchangLan * @date 2021/4/26 19:49 */ @SpringBootTest public class ESTest { @Resource private BBossESStarter bbossESStarter; @Test void test(){ ClientInterface restClient = ElasticSearchHelper.getConfigRestClientUtil("elasticsearch/archive.xml"); Map params = new HashMap<>(); params.put("pageIndex",1); params.put("pageSize",10); ESDatas mapESDatas = restClient.searchList("/hp_es/_doc/_search", "query", params, Map.class); System.out.println(JSON.toJSONString(mapESDatas)); } }