国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Java SpringBoot API 實(shí)現(xiàn)ES(Elasticsearch)搜索引擎的一系列操作(超詳細(xì))(模擬數(shù)據(jù)庫操作)

這篇具有很好參考價(jià)值的文章主要介紹了Java SpringBoot API 實(shí)現(xiàn)ES(Elasticsearch)搜索引擎的一系列操作(超詳細(xì))(模擬數(shù)據(jù)庫操作)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔

小編使用的是elasticsearch-7.3.2

springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔

基礎(chǔ)說明:

  1. 啟動(dòng):進(jìn)入elasticsearch-7.3.2/bin目錄,雙擊elasticsearch.bat進(jìn)行啟動(dòng),當(dāng)出現(xiàn)一下界面說明,啟動(dòng)成功。也可以訪問http://localhost:9200/

springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
  1. 啟動(dòng)ES管理:進(jìn)入elasticsearch-head-master文件夾,然后進(jìn)入cmd命令界面,輸入npm?run?start?即可啟動(dòng)。訪問http://localhost:9100/?啟動(dòng)成功。

springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔

下面是springboot使用ES的準(zhǔn)備工作:

  1. 導(dǎo)入相關(guān)依賴:

? ? ? ? <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.sksamuel.elastic4s</groupId>
            <artifactId>elastic4s_2.11</artifactId>
             <version>1.5.5</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>7.3.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>

2.配置ES,創(chuàng)建配置類:CommonConfig

@Configuration
public class CommonConfig {
    
    @Bean
    public RestHighLevelClient restHighLevelClient() {
        return new RestHighLevelClient(
                RestClient.builder(
                        //若有多個(gè),可以傳一個(gè)數(shù)組
                        new HttpHost("127.0.0.1", 9200, "http")));
    }
}

到此,springboot需要使用ES的配置就基本完成了,下面讓我們開始進(jìn)行Java?對(duì)ES?的基本操作和以及復(fù)雜操作吧。

基礎(chǔ)操作:

  1. 創(chuàng)建ES索引:(創(chuàng)建表)

@Service
@Slf4j
public class TestService {

    @Autowired
    public RestHighLevelClient client;

    public String createESindex() throws IOException {
        //1、構(gòu)建 創(chuàng)建索引的請(qǐng)求
        CreateIndexRequest request = new CreateIndexRequest("base_data");//索引名
        //2、客戶端執(zhí)行請(qǐng)求,獲取響應(yīng)
        CreateIndexResponse response = client.indices().create(request, RequestOptions.DEFAULT);
        //3、打印
        System.out.println("創(chuàng)建成功,創(chuàng)建的索引名為:" + response.index());

        return "success";
    }
}
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
  1. 獲取索引,判斷索引是否存在:(判斷表是否存在)

public String getESindex() throws IOException {
        //1、構(gòu)建 獲取索引的請(qǐng)求
        GetIndexRequest request = new GetIndexRequest("base_data");
        //2、客戶端判斷該索引是否存在
        boolean exists = client.indices().exists(request, RequestOptions.DEFAULT);
        //3、打印
        System.out.println("該索引是否存在:"+exists);
        return "success";
}
  1. 刪除索引:(刪除表)

public String deleteESindex() throws IOException {
        DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest("base_data");
        AcknowledgedResponse deleteIndexResponse = client.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT);
        System.out.println("刪除索引==>"+deleteIndexResponse.isAcknowledged());
        return “success”;
}
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
  1. 創(chuàng)建文檔:(創(chuàng)建表并插入一條數(shù)據(jù))

public String createESdata() throws IOException {
        Map<String,Object> base_data=new HashMap<>();
        base_data.put("id","a1234");
        base_data.put("title","張三");
        base_data.put("gender","男");
        base_data.put("age","23");
        base_data.put("sort_int",1);
        base_data.put("time_date","2023-02-25 13:55:23");
        base_data.put("is_delete","0");
        //1、構(gòu)建請(qǐng)求
        IndexRequest request = new IndexRequest("base_data");
        //2、設(shè)置規(guī)則  PUT /user_index/user/_doc/1
        request.id(base_data.get("id")+"");//設(shè)置id
        request.timeout(TimeValue.timeValueSeconds(1));//設(shè)置超時(shí)時(shí)間

        //3、將數(shù)據(jù)放入到請(qǐng)求中,以JSON的格式存放
        request.source(JSONObject.toJSONString(base_data), XContentType.JSON);

        //4、客戶端發(fā)送請(qǐng)求,獲取響應(yīng)結(jié)果
        IndexResponse response = client.index(request, RequestOptions.DEFAULT);
        //5、打印
        System.out.println("響應(yīng)結(jié)果:"+response.toString());

        return "success";
    }
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
  1. 獲取文檔:(查詢表的數(shù)據(jù))

public String getESdata() throws IOException {
        //獲取id為1的文檔的信息
        GetRequest request = new GetRequest("base_data","a1234");

        boolean exists = client.exists(request, RequestOptions.DEFAULT);
        System.out.println("文檔是否存在:"+exists);
        //如果存在,獲取文檔信息
        if (exists){
            GetResponse response = client.get(request, RequestOptions.DEFAULT);
            System.out.println("文檔內(nèi)容為:"+response.getSourceAsString());
        }
        return "success";
}
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
  1. 修改文檔:(修改表中的一條數(shù)據(jù))

public String updateESdata() throws IOException {
        //更新id為1的文檔的信息
        UpdateRequest request = new UpdateRequest("base_data", "a1234");
        Map<String,Object> setdata=new HashMap<>();
        setdata.put("title","鎧甲");
        request.doc(JSONObject.toJSONString(setdata), XContentType.JSON);
        //客戶端執(zhí)行更新請(qǐng)求
        UpdateResponse response = client.update(request, RequestOptions.DEFAULT);
        System.out.println("更新狀態(tài):" +response.status());

        return "success";
    }
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
  1. 刪除一條文檔:(刪除表中的一條數(shù)據(jù))

public?String deleteESdata() throws IOException {
    //構(gòu)建刪除請(qǐng)求
    DeleteRequest request = new DeleteRequest("base_data", "a1234");
    //客戶端執(zhí)行刪除請(qǐng)求,并獲取響應(yīng)結(jié)果
    DeleteResponse response = client.delete(request, RequestOptions.DEFAULT);
    //打印
    System.out.println("刪除狀態(tài):"+response.status());
? ? return?"success";
}
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
  1. 批量創(chuàng)建數(shù)據(jù):(創(chuàng)建表并插入數(shù)據(jù))

    public String batchinsESdata() throws IOException {
        //構(gòu)建批量插入的請(qǐng)求
        BulkRequest request = new BulkRequest();
        //設(shè)置超時(shí)時(shí)間
        request.timeout("10s");
? ? ? ? //構(gòu)建測(cè)試數(shù)據(jù)
        List<Map<String,Object>> data=new ArrayList<>();
        Map<String,Object> datamap=null;
        for (int i = 0; i < 20; i++) {
            datamap=new HashMap<>();
            if(i<5){
                datamap.put("id","a123b"+i);
                datamap.put("title","財(cái)務(wù)"+i);
                datamap.put("user","王剛"+i);
                datamap.put("sort_int",6);
                datamap.put("is_delete","0");
                datamap.put("time_date",StringTimeUtil.now());
            }else if(i>5&&i<10){
                datamap.put("id","a456b"+i);
                datamap.put("title","能源"+i);
                datamap.put("user","洪河"+i);
                datamap.put("sort_int",i+1);
                datamap.put("is_delete","0");
                datamap.put("time_date","2023-02-28 12:33:55");
            }else if(i>10&&i<15){
                datamap.put("id","a789b"+i);
                datamap.put("title","光度"+i);
                datamap.put("user","時(shí)光"+i);
                datamap.put("sort_int",i+1);
                datamap.put("is_delete","0");
                datamap.put("time_date","2023-02-27 12:33:55");
            }else{
                datamap.put("id","c123d"+i);
                datamap.put("title","鎧甲"+i);
                datamap.put("user","迪迦"+i);
                datamap.put("sort_int",i+1);
                datamap.put("is_delete","0");
                datamap.put("time_date","2023-02-25 12:33:55");
            }
            data.add(datamap);
        }


        //批量插入請(qǐng)求設(shè)置
        for (int i = 0; i < data.size(); i++) {
            request.add( new IndexRequest("base_data")//設(shè)置索引
             .id(data.get(i).get("id")+"")//設(shè)置文檔的id,如果沒有指定,會(huì)隨機(jī)生成,自己測(cè)試
             .source(JSONObject.toJSONString(data.get(i)), XContentType.JSON)//設(shè)置要添加的資源,類型為JSON
            );
        }
        BulkResponse response = client.bulk(request, RequestOptions.DEFAULT);
        System.out.println("批量插入是否失?。?+response.hasFailures());

        return "success";
    }
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
  1. 精確查詢:(根據(jù)ID查詢表中的一條數(shù)據(jù))

    public String queryESdata() throws IOException {
        //1、構(gòu)建搜索請(qǐng)求
        SearchRequest request = new SearchRequest("base_data");
        //2、設(shè)置搜索條件,使用該構(gòu)建器進(jìn)行查詢
        SearchSourceBuilder builder = new SearchSourceBuilder();//生成構(gòu)建器
        //構(gòu)建精確匹配查詢條件
        TermQueryBuilder termQueryBuilder = QueryBuilders.termQuery("_id.keyword", "c123d10");
        builder.query(termQueryBuilder);
        //3、將搜索條件放入搜索請(qǐng)求中
        request.source(builder);
        //4、客戶端執(zhí)行搜索請(qǐng)求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        //5、打印測(cè)試
        SearchHit[] hits = response.getHits().getHits();
        System.out.println("共查詢到"+hits.length+"條數(shù)據(jù)");
        System.out.println("查詢結(jié)果:");
        for (int i = 0; i < hits.length; i++) {
            System.out.println(hits[i].getSourceAsString());
        }
        return "success";
    }
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔

復(fù)雜操作:

1.分頁排序查詢:(表查詢的?limit?order?by)

    public String paginggetESdata() throws IOException {
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.from(1);
        searchSourceBuilder.size(8);
        searchSourceBuilder.trackTotalHits(true);

        searchSourceBuilder.sort(SortBuilders.fieldSort("sort_int").order(SortOrder.DESC));//降序
        //searchSourceBuilder.sort(SortBuilders.fieldSort("sort_int").order(SortOrder.ASC));//升序

        SearchRequest searchRequest = new SearchRequest("base_data");
        searchRequest.source(searchSourceBuilder);
        SearchResponse search = client.search(searchRequest, RequestOptions.DEFAULT);
        SearchHit[] hits = search.getHits().getHits();
        System.out.println("ES分頁查詢返回?cái)?shù)據(jù)條數(shù)==>"+hits.length);

        for(SearchHit hit: hits){
            JSONObject data_json = JSONObject.parseObject(hit.getSourceAsString());
            System.out.println(data_json);
        }
        return "success";
    }
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔

2.按條件查詢某些字段:(表查詢的select?xxx,xxx,xxx?from?xxx?where?xxx='xxx'?and?xxx?like?'%xxx%')

    public String getfieldESdata() throws IOException {
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();

        QueryBuilder dim_q = QueryBuilders.wildcardQuery("title.keyword", "*財(cái)務(wù)*");//模糊查詢
        QueryBuilder qeual_q = QueryBuilders.matchPhraseQuery("id", "a123b3");//等量查詢
        RangeQueryBuilder rang_q=QueryBuilders.rangeQuery("time_date.keyword").from("2023-03-06 15:00:32").to("2023-03-06 19:05:32");//日期區(qū)間查詢

        searchSourceBuilder.query(QueryBuilders.boolQuery().must(dim_q).must(qeual_q).must(rang_q));
        //查詢指定字段
        String[] includeFields = new String[]{"id","title","time_date"};
        String[] excludeFields = new String[] {""};
        searchSourceBuilder.fetchSource(includeFields, excludeFields);

        SearchRequest searchRequest = new SearchRequest("base_data");
        searchRequest.source(searchSourceBuilder);
        SearchResponse search = client.search(searchRequest, RequestOptions.DEFAULT);
        SearchHit[] hits = search.getHits().getHits();
        System.out.println("ES復(fù)雜查詢返回?cái)?shù)據(jù)條數(shù)==>"+hits.length);

        for(SearchHit hit: hits){
            JSONObject data_json = JSONObject.parseObject(hit.getSourceAsString());
            System.out.println(data_json);
        }
        return "success";
    }
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔

3.按條件修改某些字段的值:(表修改的update?xxx?set?xxx='xxx',xxx='xxx'?where?xxx='xxx'?and?xxx='xxx')

  public String updatebyqueryESdata() throws IOException {
        UpdateByQueryRequest request = new UpdateByQueryRequest("base_data");
        QueryBuilder upd_q1 = QueryBuilders.matchPhraseQuery("is_delete", "0");//等量條件
        QueryBuilder upd_q2 = QueryBuilders.wildcardQuery("title.keyword", "*財(cái)務(wù)*");//模糊條件

        BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery().must(upd_q1).must(upd_q2);

        String setdata="ctx._source['user']='修改的user';ctx._source['sort_int']=100;ctx._source['title']='修改的title';";

        request.setQuery(queryBuilder);
        request.setScript(new Script(setdata));

        BulkByScrollResponse response = client.updateByQuery(request, RequestOptions.DEFAULT);
        System.out.println("受影響行數(shù)==>"+response.getStatus().getUpdated());
        return "";
    }
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔

4.按條件刪除文檔里面的數(shù)據(jù):(表刪除的delete?from?xxx?where?xxx='xxx'?and?xxx='xxx')

public String deletebyqueryESdata() throws IOException {
        DeleteByQueryRequest request = new DeleteByQueryRequest("base_data");
        QueryBuilder upd_q1 = QueryBuilders.matchPhraseQuery("is_delete", "0");//等量條件
        QueryBuilder upd_q2 = QueryBuilders.wildcardQuery("title.keyword", "*修改的*");//模糊條件

        BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery().must(upd_q1).must(upd_q2);
        request.setQuery(queryBuilder);

        BulkByScrollResponse response = client.deleteByQuery(request, RequestOptions.DEFAULT);
        System.out.println("受影響行數(shù)==>"+response.getStatus().getUpdated());
        return "success";
    }
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔
springboot使用es查詢,大數(shù)據(jù)查詢速度,elasticsearch,搜索引擎,java,spring boot,Powered by 金山文檔

以上就是小編自學(xué)并根據(jù)網(wǎng)絡(luò)整理的,Java?Springboot?操作ES的一些常用業(yè)務(wù)。整理不易,請(qǐng)大家多多支持,如有不足之處,歡迎大家留言討論。文章來源地址http://www.zghlxwxcb.cn/news/detail-756590.html

到了這里,關(guān)于Java SpringBoot API 實(shí)現(xiàn)ES(Elasticsearch)搜索引擎的一系列操作(超詳細(xì))(模擬數(shù)據(jù)庫操作)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Es elasticsearch 二十 站內(nèi)搜索示例 高亮內(nèi)容 java springboot 實(shí)現(xiàn)

    目錄 實(shí)現(xiàn)思路 代碼 全依賴 參數(shù)對(duì)象 搜索實(shí)現(xiàn)代碼全代碼 日志 重點(diǎn) 權(quán)重 分頁 入?yún)⒏吡翑?shù)據(jù)處理 返回出參數(shù)據(jù)處理 構(gòu)建請(qǐng)求 請(qǐng)求體設(shè)置搜索字段 返回?cái)?shù)據(jù)解析獲取高亮 高亮通過設(shè)置標(biāo)簽和class? 前端設(shè)置class字體顏色 也可直接寫在后端 ? 全依賴 參數(shù)對(duì)象 搜索實(shí)現(xiàn)代碼

    2024年02月02日
    瀏覽(29)
  • elasticsearch[五]:深入探索ES搜索引擎的自動(dòng)補(bǔ)全與拼寫糾錯(cuò):如何實(shí)現(xiàn)高效智能的搜索體驗(yàn)

    elasticsearch[五]:深入探索ES搜索引擎的自動(dòng)補(bǔ)全與拼寫糾錯(cuò):如何實(shí)現(xiàn)高效智能的搜索體驗(yàn)

    前一章講了搜索中的拼寫糾錯(cuò)功能,里面一個(gè)很重要的概念就是萊文斯坦距離。這章會(huì)講解搜索中提升用戶體驗(yàn)的另一項(xiàng)功能 - [自動(dòng)補(bǔ)全]。本章直接介紹 ES 中的實(shí)現(xiàn)方式以及真正的搜索引擎對(duì)自動(dòng)補(bǔ)全功能的優(yōu)化。 大家對(duì)上面的這個(gè)應(yīng)該都不陌生,搜索引擎會(huì)根據(jù)你輸入的

    2024年01月24日
    瀏覽(33)
  • SpringBoot封裝Elasticsearch搜索引擎實(shí)現(xiàn)全文檢索

    注:本文實(shí)現(xiàn)了Java對(duì)Elasticseach的分頁檢索/不分頁檢索的封裝 ES就不用過多介紹了,直接上代碼: 創(chuàng)建Store類(與ES字段對(duì)應(yīng),用于接收ES數(shù)據(jù)) Elasticsearch全文檢索接口:不分頁檢索 Elasticsearch全文檢索接口:分頁檢索 本文實(shí)現(xiàn)了Java對(duì)Elasticsearch搜索引擎全文檢索的封裝 傳入

    2024年02月04日
    瀏覽(38)
  • 用SpringBoot和ElasticSearch實(shí)現(xiàn)網(wǎng)盤搜索引擎,附源碼,詳細(xì)教學(xué)

    用SpringBoot和ElasticSearch實(shí)現(xiàn)網(wǎng)盤搜索引擎,附源碼,詳細(xì)教學(xué)

    可以掃描小程序碼體驗(yàn),切換到搜索Tabbar。 小程序端界面實(shí)現(xiàn) 網(wǎng)頁端實(shí)現(xiàn)界面 對(duì)外提供的api 接口聲明 接口實(shí)現(xiàn) 執(zhí)行搜索策略。 提供2種搜索策略,分別是MySQL和ElasticSearch搜索策略。在配置文件進(jìn)行配置搜索策略。 搜索類型枚舉 配置文件中的搜索策略相關(guān)配置 es搜索策略實(shí)

    2024年02月08日
    瀏覽(21)
  • Elasticsearch (ES) 搜索引擎: 搜索功能:搜索分頁、搜索匹配、全文搜索、搜索建議、字段排序

    原文鏈接:https://xiets.blog.csdn.net/article/details/132348920 版權(quán)聲明:原創(chuàng)文章禁止轉(zhuǎn)載 專欄目錄:Elasticsearch 專欄(總目錄) ES 搜索 API 官網(wǎng)文檔:Search APIs 先創(chuàng)建一個(gè)索引,并寫入一些文檔用于搜索示例: 寫入一些文檔示例: 官網(wǎng)API:The _source option 搜索結(jié)果中的文檔數(shù)據(jù)封裝

    2024年02月08日
    瀏覽(33)
  • ElasticSearch內(nèi)容分享(四):ES搜索引擎

    ElasticSearch內(nèi)容分享(四):ES搜索引擎

    目錄 ES搜索引擎 1. DSL設(shè)置查詢條件 1.1 DSL查詢分類 1.2 全文檢索查詢 1.2.1 使用場(chǎng)景 1.2.2 match查詢 1.2.3 mulit_match查詢 1.3 精準(zhǔn)查詢 1.3.1 term查詢 1.3.2 range查詢 1.4 地理坐標(biāo)查詢 1.4.1 矩形范圍查詢 1.4.2 附近(圓形)查詢 1.5 復(fù)合查詢 1.5.0 復(fù)合查詢歸納 1.5.1 相關(guān)性算分 1.5.2 算分函數(shù)查

    2024年02月05日
    瀏覽(24)
  • 入門ElasticSearch :為什么選擇ES作為搜索引擎?

    隨著數(shù)據(jù)量的不斷增長(zhǎng),搜索和分析大規(guī)模數(shù)據(jù)集變得越來越重要。傳統(tǒng)數(shù)據(jù)庫在面對(duì)這種需求時(shí)往往表現(xiàn)不佳,這時(shí)候就需要一種專門用于搜索和分析的引擎。ElasticSearch (簡(jiǎn)稱ES)就是這樣一款強(qiáng)大的搜索引擎,它具有許多優(yōu)勢(shì),使得它成為許多企業(yè)和開發(fā)者的首選。 簡(jiǎn)

    2024年02月09日
    瀏覽(23)
  • Elasticsearch (ES) 搜索引擎: 文本搜索:分析器/分詞器、同義詞/停用詞、拼音搜索、高亮顯示、拼寫糾錯(cuò)

    原文鏈接:https://xiets.blog.csdn.net/article/details/132349032 版權(quán)聲明:原創(chuàng)文章禁止轉(zhuǎn)載 專欄目錄:Elasticsearch 專欄(總目錄) 文本搜索主要指的就是全文搜索,全文搜索是搜索引擎的核心功能,與精確匹配的結(jié)構(gòu)化數(shù)據(jù)不同,文本(text)數(shù)據(jù)在構(gòu)建索引和搜索時(shí)都需要進(jìn)行額外的處

    2024年02月03日
    瀏覽(44)
  • elasticsearch(ES)分布式搜索引擎03——(RestClient查詢文檔,ES旅游案例實(shí)戰(zhàn))

    elasticsearch(ES)分布式搜索引擎03——(RestClient查詢文檔,ES旅游案例實(shí)戰(zhàn))

    文檔的查詢同樣適用昨天學(xué)習(xí)的 RestHighLevelClient對(duì)象,基本步驟包括: 1)準(zhǔn)備Request對(duì)象 2)準(zhǔn)備請(qǐng)求參數(shù) 3)發(fā)起請(qǐng)求 4)解析響應(yīng) 我們以match_all查詢?yōu)槔?3.1.1.發(fā)起查詢請(qǐng)求 代碼解讀: 第一步,創(chuàng)建 SearchRequest 對(duì)象,指定索引庫名 第二步,利用 request.source() 構(gòu)建DSL,DSL中可

    2024年02月07日
    瀏覽(26)
  • 如何使用內(nèi)網(wǎng)穿透工具實(shí)現(xiàn)Java遠(yuǎn)程連接本地Elasticsearch搜索分析引擎

    如何使用內(nèi)網(wǎng)穿透工具實(shí)現(xiàn)Java遠(yuǎn)程連接本地Elasticsearch搜索分析引擎

    簡(jiǎn)單幾步,結(jié)合Cpolar 內(nèi)網(wǎng)穿透工具實(shí)現(xiàn)Java 遠(yuǎn)程連接操作本地分布式搜索和數(shù)據(jù)分析引擎Elasticsearch。 Cpolar內(nèi)網(wǎng)穿透提供了更高的安全性和隱私保護(hù),通過使用加密通信通道,Cpolar技術(shù)可以確保數(shù)據(jù)傳輸?shù)陌踩?,這為用戶和團(tuán)隊(duì)提供了更可靠的保護(hù),使他們能夠放心地處理和

    2024年02月04日
    瀏覽(29)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包