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

Springboot3.1+Elasticsearch8.x匹配查詢

這篇具有很好參考價值的文章主要介紹了Springboot3.1+Elasticsearch8.x匹配查詢。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

Springboot3.1+Elasticsearch8.x匹配查詢

springboot-starter3.1.0中spring-data-elasticsearch的版本為5.1.0,之前很多方法和類都找不到了。這里主要講講在5.1.0版本下如何使用spring data對elesticsearch8.x進行匹配查詢。

一、配置依賴

第一步當然是配置依賴

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>

在這里面,spring-boot-starter-data-elasticsearch是3.1.0的,里面的spring-data-elasticsearch是5.1.0的,服務器上的Elasticsearch用的是8.7.0的。

二、Elasticsearch配置

springboot對于elasticsearch活著的其它一些工具比如kafka,redis的配置都可以在resorces/application.properties中配置,新版的配置與舊版的不太一樣,從ElasticsearchProperties.java中可以看到,前綴是spring.elasticsearch,主機配置項已經(jīng)變成了uris的List,以前好像是spring.data.elasticsearch.cluster-nodes,因此我們在resorces/application.properties這樣子配置
spring-data-elasticsearch版本,elasticsearch,java,大數(shù)據(jù)文章來源地址http://www.zghlxwxcb.cn/news/detail-608346.html

spring.elasticsearch.uris=http://39.101.73.203:9200

三、配置實體類和Repository

  1. 在類前加上注解@Document(indexName = “discusspost”),indexName為索引名稱,新版本好像移除了分片和副本的配置。
    spring-data-elasticsearch版本,elasticsearch,java,大數(shù)據(jù)
  2. 配置類的屬性,和之前一樣
@Document(indexName = "discusspost")
public class DiscussPost {
   
    @Id
    private int id;
    @Field(type = FieldType.Integer)
    private int userId;
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String title;
    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")

到了這里,關于Springboot3.1+Elasticsearch8.x匹配查詢的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!

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

領支付寶紅包贊助服務器費用

相關文章

  • java-springboot整合ElasticSearch8.2復雜查詢

    近期有大數(shù)據(jù)項目需要用到es,而又是比較新的es版本,網(wǎng)上也很少有8.x的java整合教程,所有寫下來供各位參考。 首先 1.導包: 2.客戶端連接代碼EsUtilConfigClint: 一開始按照其他博主的方法,長時間連接不操作查詢再次調(diào)用查詢時會報錯timeout,所以要設置RequestConfigCallback 3

    2024年02月11日
    瀏覽(15)
  • Elasticsearch8.8.0 SpringBoot實戰(zhàn)操作各種案例(索引操作、聚合、復雜查詢、嵌套等)

    Elasticsearch8.8.0 全網(wǎng)最新版教程 從入門到精通 通俗易懂 引入依賴 添加配置文件 application.yaml 導入ca證書到項目中 從任意一個es容器中,拷貝證書到resources目錄下 [外鏈圖片轉(zhuǎn)存失敗,源站可能有防盜鏈機制,建議將圖片保存下來直接上傳(img-EXytUrDp-1691330960034)(media/16912196423122/16

    2024年02月13日
    瀏覽(27)
  • ElasticSearch系列 - SpringBoot整合ES之全文搜索匹配查詢 match

    官方文檔地址:https://www.elastic.co/guide/en/elasticsearch/reference/index.html 權(quán)威指南:https://www.elastic.co/guide/cn/elasticsearch/guide/current/structured-search.html 1. 數(shù)據(jù)準備 官方測試數(shù)據(jù)下載地址:https://download.elastic.co/demos/kibana/gettingstarted/accounts.zip ,數(shù)據(jù)量很大,我們自己構(gòu)造數(shù)據(jù)吧。 2. m

    2023年04月08日
    瀏覽(31)
  • ElasticSearch系列 - SpringBoot整合ES:短語匹配查詢 match_phrase

    1. ElasticSearch match_phrase查詢是什么?它與match查詢有什么區(qū)別? match_phrase查詢是一種用于匹配短語的查詢方式,可以用于精確匹配多個單詞組成的短語。它會將查詢字符串分解成單詞,然后按照順序匹配文檔中的單詞,只有當文檔中的單詞順序與查詢字符串中的單詞順序完全

    2024年02月12日
    瀏覽(18)
  • ElasticSearch8 - SpringBoot整合ElasticSearch

    springboot 整合 ES 有兩種方案,ES 官方提供的 Elasticsearch Java API Client 和 spring 提供的 [Spring Data Elasticsearch](Spring Data Elasticsearch) 兩種方案各有優(yōu)劣 Spring:高度封裝,用著舒服。缺點是更新不及時,有可能無法使用 ES 的新 API ES 官方:更新及時,靈活,缺點是太靈活了,基本是一

    2024年03月25日
    瀏覽(78)
  • springboot整合elasticsearch8

    1.引入maven依賴 2.application.yml添加配置 3.編寫config文件 啟動demo項目,通過控制臺日志查看是否能夠正常連接es。 4.在DemoApplicationTests編寫簡單測試操作es。

    2024年02月12日
    瀏覽(21)
  • SpringBoot連接ElasticSearch8.*

    系統(tǒng)中需要使用到ElasticSearch進行內(nèi)容檢索,因此需要搭建SpringBoot + ElasticSearch的環(huán)境。

    2024年02月16日
    瀏覽(25)
  • java(springboot)對接elasticsearch8+

    注:jackson包es只用到了databind,之所以全部引用是因為actuator用到了其他,只升級一個會 導致版本沖突 注:因為沒有用springboot自身的es插件所以健康檢查檢測不到es狀態(tài),關閉es檢測 上邊創(chuàng)建索引是定制的加了特殊mapping,正常這樣

    2024年02月16日
    瀏覽(25)
  • 【springboot-04】ElasticSearch8.7搜索

    【springboot-04】ElasticSearch8.7搜索

    為什么學?因為它 查詢速度很快 ,而且是非關系型數(shù)據(jù)庫?(NoSql) 一些增刪改查已經(jīng)配置好了,無需重復敲碼 ElasticSearch 更新快,本篇文章將主要介紹一些常用方法。 對于 spirngboot 整合 Es 的文章很少,有些已經(jīng)過時【更新太快了】 ?依賴:Maven 配置類:EsConfig 水果信息

    2024年02月07日
    瀏覽(19)
  • springBoot整合ElasticSearch8.x版本

    導入依賴 ? dependency ? ? ? ? groupIdcom.fasterxml.jackson.core/groupId ? ? ? ? artifactIdjackson-databind/artifactId ? ? ? ? version2.13.2/version ? /dependency ? ? dependency ? ? ? ? groupIdorg.glassfish/groupId ? ? ? ? artifactIdjakarta.json/artifactId ? ? ? ? version2.0.1/version ? /dependency ? ? ? ? ? dependency ?

    2023年04月21日
    瀏覽(25)

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

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

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

二維碼1

領取紅包

二維碼2

領紅包