国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

注冊網(wǎng)站賬號違法嗎軟文廣告經(jīng)典案例300字

注冊網(wǎng)站賬號違法嗎,軟文廣告經(jīng)典案例300字,免費制作簡歷,中山快速做網(wǎng)站公司寫在前面 ElasticSearch是一個基于Lucene的搜索服務(wù)器。它提供了一個分布式多用戶能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java開發(fā)的,并作為Apache許可條款下的開放源碼發(fā)布,是當(dāng)前流行的企業(yè)級搜索引擎。設(shè)計用于[云計…

寫在前面

ElasticSearch是一個基于Lucene的搜索服務(wù)器。它提供了一個分布式多用戶能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java開發(fā)的,并作為Apache許可條款下的開放源碼發(fā)布,是當(dāng)前流行的企業(yè)級搜索引擎。設(shè)計用于[云計算]中,能夠達(dá)到實時搜索,穩(wěn)定,可靠,快速,安裝使用方便。

可以這樣來對比elasticsearch和數(shù)據(jù)庫
索引(indices) ~~~~~~~~ 數(shù)據(jù)庫(databases)
類型(type) ~~~~~~~~ 數(shù)據(jù)表(table)
文檔(Document)~~~~~~~~ 行(row)
字段(Field) ~~~~~~~~ 列(Columns )

shards:分片數(shù)量,默認(rèn)5
replicas:副本數(shù)量,默認(rèn)1

引入庫

implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-elasticsearch', version: '2.7.5'
implementation group: 'org.springframework.data', name: 'spring-data-elasticsearch', version: '4.4.13';

版本對應(yīng)要求見如下表格: 傳送門

Spring Data Release TrainSpring Data ElasticsearchElasticsearchSpring FrameworkSpring Boot
2023.0 (Ullmann)5.1.x8.7.16.0.x3.1.x
2022.0 (Turing)5.0.x8.5.36.0.x3.0.x
2021.2 (Raj)4.4.x[1]7.17.35.3.x2.7.x
2021.1 (Q)4.3.x[1]7.15.25.3.x2.6.x
2021.0 (Pascal)4.2.x[1]7.12.05.3.x2.5.x
2020.0 (Ockham)4.1.x[1]7.9.35.3.22.4.x
Neumann4.0.x[1]7.6.25.2.122.3.x
Moore3.2.x[1]6.8.125.2.122.2.x
Lovelace3.1.x[1]6.2.25.1.192.1.x
Kay3.0.x[1]5.5.05.0.132.0.x
Ingalls2.1.x[1]2.4.04.3.251.5.x

配置連接

spring:elasticsearch:rest:uris: 10.10.88.163:9200username: rootpassword: pass123

配置信息讀取:

@RefreshScope
@ConfigurationProperties(ESProperties.PREFIX)
public class ESProperties {public static final String PREFIX = "spring.elasticsearch.rest";private Boolean enable = true;private String uris;private String userName;/*** Secret key是你賬戶的密碼*/private String password;}

連接初始化:

@AutoConfiguration
@EnableConfigurationProperties(ESProperties.class)
@ConditionalOnProperty(value = ESProperties.PREFIX + ".enabled", havingValue = "true", matchIfMissing = true)
public class ElasticSearchConfig extends AbstractElasticsearchConfiguration {private static final Logger logger = LogManager.getLogger(ElasticSearchConfig.class);@Resourceprivate ESProperties esProperties;@Override@Bean(destroyMethod = "close")public RestHighLevelClient elasticsearchClient() {final ClientConfiguration clientConfiguration = ClientConfiguration.builder().connectedTo(esProperties.getUris()).withBasicAuth(esProperties.getUserName(), esProperties.getPassword()).withConnectTimeout(RestClientBuilder.DEFAULT_CONNECT_TIMEOUT_MILLIS).withSocketTimeout(RestClientBuilder.DEFAULT_SOCKET_TIMEOUT_MILLIS).build();RestHighLevelClient client = RestClients.create(clientConfiguration).rest();try {logger.info("connect to elasticsearch:{} ", client.getLowLevelClient().getNodes());MainResponse response = client.info(RequestOptions.DEFAULT);MainResponse.Version version = response.getVersion();logger.info("elasticsearch version:{},lucene version:{}", version.getNumber(), version.getLuceneVersion());} catch (Exception e) {throw new RuntimeException(e);}return client;}
}

文件配置 spring.factories

org.springframework.boot.autoconfigure.EnableAutoConfiguration=io.gamioo.core.elasticsearch.config.ElasticSearchConfig

DAO層:

public interface OperationLogRepository extends ElasticsearchRepository<OperationLog, String> {}

操作對象:

@ApiModel(value = "operation_log", description = "操作日志")
@Document(indexName = "operation_log_*")
public class OperationLog {@Idprivate String id;@ApiModelProperty("創(chuàng)建時間")@Field(name = "addTime", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd'T'HH:mm:ssz")private Date addTime;}

邏輯操作:

    @Resourceprivate OperationLogRepository repository;@Overridepublic Page<OperationLog> findAll(Pageable pageable) {return repository.findAll(pageable);}@Overridepublic Page<OperationLog> findByAddTimeBetween(LocalDateTime startTime, LocalDateTime endTime, Pageable pageable) {return repository.findByAddTimeBetween(startTime, endTime, pageable);}

Q&A

1.實際使用中一直報錯: missing authentication credentials for REST request
經(jīng)過多方查證,最后發(fā)現(xiàn)報錯原因是:配置ES時沒添加用戶名密碼驗證

總結(jié)

以上就是springboot集成es后的一個簡單使用,spring封裝過后的spring-boot-starter-data-elasticsearch使用起來還是非常方便簡單的。

http://m.aloenet.com.cn/news/39921.html

相關(guān)文章:

  • 做網(wǎng)站書面報告申請深圳谷歌推廣公司
  • 冀州網(wǎng)站建設(shè)價格2023網(wǎng)站推廣入口
  • 網(wǎng)站備案管理系統(tǒng)北京今日重大新聞
  • 優(yōu)化大師app下載汕頭seo建站
  • 合肥建設(shè)網(wǎng)絡(luò)賭博網(wǎng)站網(wǎng)站移動端優(yōu)化工具
  • 縉云建設(shè)局網(wǎng)站網(wǎng)絡(luò)營銷課程思政
  • 韋博在上面做課件的網(wǎng)站叫什么搜狗推廣登錄
  • 佛山倫教網(wǎng)站設(shè)計千鋒教育官網(wǎng)
  • app下載網(wǎng)站模板品牌推廣外包
  • 化妝品網(wǎng)站建設(shè)網(wǎng)站開發(fā)流程有哪幾個階段
  • 中國南昌企業(yè)網(wǎng)站制作seo修改器
  • asp網(wǎng)站做安全全球搜
  • 企業(yè)網(wǎng)站怎么自適應(yīng)網(wǎng)站推廣的營銷策劃方案
  • 順義哪里有做網(wǎng)站設(shè)計的萬網(wǎng)官網(wǎng)登錄
  • 南通網(wǎng)站建設(shè)方案外包免費的網(wǎng)站申請
  • php網(wǎng)站怎么做302未來網(wǎng)絡(luò)營銷的發(fā)展趨勢
  • 網(wǎng)站都有什么類型十五種常見的銷售策略
  • 網(wǎng)站備案時間有效期荊門剛剛發(fā)布的
  • 做網(wǎng)站獨立云服務(wù)器什么意思網(wǎng)絡(luò)推廣方法大全
  • 自己做網(wǎng)站網(wǎng)站資源哪里來百度關(guān)鍵詞推廣怎么收費
  • 可以做熱圖的在線網(wǎng)站網(wǎng)站關(guān)鍵詞在哪里看
  • 電子商務(wù)網(wǎng)站建設(shè)前的分析網(wǎng)站排名優(yōu)化手機(jī)
  • iis7.5網(wǎng)站權(quán)限配置知了seo
  • 2015年做啥網(wǎng)站能致富網(wǎng)絡(luò)推廣運營推廣
  • 哪個網(wǎng)站有激光打標(biāo)業(yè)務(wù)做線上營銷推廣方法
  • 閔行營銷型網(wǎng)站建設(shè)公司免費網(wǎng)站制作成品
  • 網(wǎng)站開發(fā)人員需要什么要求卡一卡二卡三入口2021
  • 用py做網(wǎng)站b2b網(wǎng)站源碼
  • 網(wǎng)站開發(fā)人員資質(zhì)濟(jì)南網(wǎng)絡(luò)推廣公司
  • 國外服務(wù)器公司有哪些網(wǎng)站功能優(yōu)化