Springboot整合Elasticsearch新版分頁查詢
其它插入、刪除、簡單查詢都可以通過Repository調用方法查詢。文章來源:http://www.zghlxwxcb.cn/news/detail-515292.html
分頁查詢
Elasticsearch現(xiàn)在的新版本已經(jīng)棄用了ElasticsearchTemplate類,Repository里原來的search方法也已經(jīng)棄用了。下面是使用ElasticsearchRestTemplate類實現(xiàn)的分頁查詢文章來源地址http://www.zghlxwxcb.cn/news/detail-515292.html
代碼
package com.lzl.community;
import com.lzl.community.entity.DiscussPost;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.*;
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.springframework.data.elasticsearch.core.query
到了這里,關于Springboot整合Elasticsearch新版分頁查詢的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!