application.yml增加配置
代码语言:javascript复制# 日志配置
logging:
level:
#es日志
org.springframework.data.elasticsearch.client.WIRE : trace
增加配置类
代码语言:javascript复制package com.maruifu.business.config;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;
/**
* 用于打印dsl语句
*/
@Configuration
public class EsConfig {
@Bean(destroyMethod = "close")
public RestHighLevelClient restClient() {
ClientConfiguration clientConfiguration = ClientConfiguration.builder()
.connectedTo("172.16.45.138:11700")
.build();
RestHighLevelClient client = RestClients.create(clientConfiguration).rest();
return client;
}
}
查看打印效果
本文由 小马哥 创作,采用 知识共享署名4.0 国际许可协议进行许可 本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名 最后编辑时间为: 2022/12/15 22:40