1. 程式人生 > 其它 >第五章、SpringBoot整合ElasticSearch

第五章、SpringBoot整合ElasticSearch

技術標籤:SpringBoot部落格-前後端

配置環境

ElasticSearch 2.4.4

Spring Data Elasticsearch 2.1.3.RELEASE

JNA 4.3.0

專案結構如下:

配置檔案application.properties如下:

# Elasticsearch 服務地址
spring.data.elasticsearch.cluster-nodes=localhost:9300
#設定連線超時時間
spring.data.elasticsearch.properties.transpoer.tcp.connect_timeout=120s

pom.xml檔案如下:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</