diff --git a/config/01-创建es索引 b/config/01-创建es索引
new file mode 100644
index 0000000..b653b27
--- /dev/null
+++ b/config/01-创建es索引
@@ -0,0 +1,28 @@
+PUT /documents
+{
+ "settings": {
+ "analysis": {
+ "analyzer": {
+ "my_chinese_analyzer": {
+ "type": "custom",
+ "tokenizer": "ik_max_word"
+ }
+ }
+ }
+ },
+ "mappings": {
+ "properties": {
+ "filename": {
+ "type": "keyword"
+ },
+ "filepath": {
+ "type": "keyword"
+ },
+ "content": {
+ "type": "text",
+ "analyzer": "ik_max_word",
+ "search_analyzer": "ik_smart"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index dfeddb3..31e1d29 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,6 +33,8 @@
3.12.0
5.7.20
31.0.1-jre
+
+ 7.17.10
@@ -149,6 +151,14 @@
${guava.version}
+
+
+
+ org.elasticsearch.client
+ elasticsearch-rest-high-level-client
+ ${elasticsearch-rest-high-level-client.version}
+
+
@@ -252,6 +262,11 @@
guava
+
+ org.elasticsearch.client
+ elasticsearch-rest-high-level-client
+
+
diff --git a/src/main/java/com/doc/parser/infrastructure/config/ElasticsearchConfig.java b/src/main/java/com/doc/parser/infrastructure/config/ElasticsearchConfig.java
new file mode 100644
index 0000000..69841d4
--- /dev/null
+++ b/src/main/java/com/doc/parser/infrastructure/config/ElasticsearchConfig.java
@@ -0,0 +1,28 @@
+package com.doc.parser.infrastructure.config;
+
+import org.apache.http.HttpHost;
+import org.elasticsearch.client.RestClient;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ElasticsearchConfig {
+
+ @Value("${elasticsearch.host}")
+ private String host;
+
+ @Value("${elasticsearch.port}")
+ private int port;
+
+ @Value("${elasticsearch.scheme}")
+ private String scheme;
+
+ @Bean
+ public RestHighLevelClient esClient() {
+ return new RestHighLevelClient(
+ RestClient.builder(new HttpHost(host, port, scheme))
+ );
+ }
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index a528f65..a2fd591 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -9,4 +9,14 @@ log4j2.enable.threadlocals=true
logging.level.com.doc.parser=info
logging.level.root=${logging.level.com.doc.parser}
logging.org.springframework.web=${logging.level.com.doc.parser}
-logging.org.springframework.context=${logging.level.com.doc.parser}
\ No newline at end of file
+logging.org.springframework.context=${logging.level.com.doc.parser}
+
+
+# ES相关
+elasticsearch.host=localhost
+elasticsearch.port=9200
+elasticsearch.scheme=http
+
+
+# 导入的材料路径
+markdown.path = D:/02-documents/01-ahnx-share-src-public/public/设计模式
\ No newline at end of file