当前位置: 代码迷 >> 综合 >> 3.1 JavaApi---环境准备
  详细解决方案

3.1 JavaApi---环境准备

热度:87   发布时间:2023-12-14 21:45:36.0

pom内容

<properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target><elasticsearch.version>7.3.1</elasticsearch.version><log4j.version>2.11.1</log4j.version><junit.version>4.13.2</junit.version></properties><dependencies><dependency><groupId>org.elasticsearch</groupId><artifactId>elasticsearch</artifactId><version>${elasticsearch.version}</version></dependency><!--elasticsearch高级客户端--><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>${elasticsearch.version}</version></dependency><dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-api</artifactId><version>${log4j.version}</version></dependency><dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-core</artifactId><version>${log4j.version}</version></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>${junit.version}</version><scope>test</scope></dependency></dependencies>

程序包目录结构

程序目录结构

pers.bik.es

创建公用的类

package pers.bik.es.common;/*** ES的相关信息* @author yangkaifei* @date 2021/8/22 6:31 下午* @cersion 1.0*/
public class EsMessage {
    /*** 链接地址*/public static final String ADDRESS = "localhost";/*** 端口*/public static final int PORT = 9200;/*** 访问方式*/public static final String SCHEME = "http";}

github地址

github地址