bboss-elasticsearch系列--基础实例

其他网址

github 官网demo

基于springboot+bboss整合的elasticsearch(好用的一匹)_toBeMN的博客-CSDN博客_bboss
springboot集成bboss操作elasticsearch索引,类型,文档(单集群)_不经意的博客-CSDN博客

配置

打印dsl语句

其他网址

高性能elasticsearch ORM开发库使用介绍 - Bboss 每天进步一点点 - OSCHINA - 中文开源技术交流社区
Spring boot集成和配置Elasticsearch - Elasticsearch Bboss

开启方法

步骤1 选择日志实现类

springboot与bboss都引入了slf4j的实现,需要将其中一个排除掉,因为springboot的slf4j是必须的,所以,排除掉bboss的。
log级别需要至少为info级别,因为springboot默认的控制台输出级别即为info,所以无需其他配置。

<dependency>
    <groupId>com.bbossgroups.plugins</groupId>
    <artifactId>bboss-elasticsearch-spring-boot-starter</artifactId>
    <version>6.2.5</version>
    <exclusions>
        <exclusion>
            <artifactId>slf4j-log4j12</artifactId>
            <groupId>org.slf4j</groupId>
        </exclusion>
    </exclusions>
</dependency>

步骤2 打开调试开关

# 线上环境要关闭
spring.elasticsearch.bboss.elasticsearch.showTemplate = true

步骤3 使用BBossESStarter获取ClientInterface

必须使用下边这个,若使用右边这个,则不能输出调试信息:ClientInterface clientInterface = ElasticSearchHelper.getRestClientUtil();

@Autowired
private BBossESStarter bBossESStarter;
private ClientInterface clientUtil;

@PostConstruct
public void initUtil() {
    clientUtil = bBossESStarter.getConfigRestClient(mapperPath);
}

猜你喜欢

转载自blog.csdn.net/feiying0canglang/article/details/112132921