Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.3.0版本 能添加返回es查询语句的功能吗 #46

Open
li418418 opened this issue Jul 28, 2021 · 11 comments
Open

6.3.0版本 能添加返回es查询语句的功能吗 #46

li418418 opened this issue Jul 28, 2021 · 11 comments
Assignees

Comments

@li418418
Copy link

li418418 commented Jul 28, 2021

ESDatas esDatas = //ESDatas包含当前检索的记录集合,最多1000条记录,由dsl中的size属性指定
clientUtil.searchList("demo/demo/_search",//demo为索引表,_search为检索操作action
"test",//esmapper/demo.xml中定义的dsl语句
paramsTotal,//变量参数
Map.class);//返回的文档封装对象类型
esDatas 能把 ESTemplateHelper.evalTemplate(esUtil,templateName, params) 这个解析后的es语句放到ESDatas里吗
我不想只记录在log里,我还要记录到其他地方去,如cat等
感谢 @yin-bp

@yin-bp
Copy link
Contributor

yin-bp commented Jul 28, 2021

在下一个版本(6.3.1)提供这个机制,支持自行扩展,将dsl记录到自己想记录的地方

@li418418
Copy link
Author

在下一个版本(6.3.1)提供这个机制,支持自行扩展,将dsl记录到自己想记录的地方

感谢

@yin-bp
Copy link
Contributor

yin-bp commented Jul 29, 2021

@li418418 机制已经提供,对bboss客户端进行改进,增加dsl输出组件logDslCallback,使用方法如下:

记录dsl组件必须实现接口org.frameworkset.elasticsearch.client.LogDslCallback

在配置文件中配置LogDslCallback:

非spring boot项目
elasticsearch.logDslCallback=org.frameworkset.elasticsearch.client.LoggerDslCallback

springboot项目
spring.elasticsearch.bboss.elasticsearch.logDslCallback=org.frameworkset.elasticsearch.client.LoggerDslCallback

实现案例

package org.frameworkset.elasticsearch.client;

import org.frameworkset.elasticsearch.entity.LogDsl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LoggerDslCallback implements LogDslCallback{
   private static final Logger logger = LoggerFactory.getLogger(LoggerDslCallback.class);

   public void logDsl(LogDsl logDsl){
      if(logger.isInfoEnabled()) {
         logger.info("Request[{}] action[{}] took time:{} ms ], use DSL[{}]",
               logDsl.getUrl(),logDsl.getAction(), logDsl.getTime(),   logDsl.getDsl());

      }
   }
}

@yin-bp
Copy link
Contributor

yin-bp commented Jul 29, 2021

正式版本需要6.3.1中发布,如果急需使用,可自行下载源码构建

@yin-bp yin-bp self-assigned this Jul 29, 2021
@li418418
Copy link
Author

正式版本需要6.3.1中发布,如果急需使用,可自行下载源码构建

@li418418 机制已经提供,对bboss客户端进行改进,增加dsl输出组件logDslCallback,使用方法如下:

记录dsl组件必须实现接口org.frameworkset.elasticsearch.client.LogDslCallback

在配置文件中配置LogDslCallback:

非spring boot项目
elasticsearch.logDslCallback=org.frameworkset.elasticsearch.client.LoggerDslCallback

springboot项目
spring.elasticsearch.bboss.elasticsearch.logDslCallback=org.frameworkset.elasticsearch.client.LoggerDslCallback

实现案例

package org.frameworkset.elasticsearch.client;

import org.frameworkset.elasticsearch.entity.LogDsl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LoggerDslCallback implements LogDslCallback{
   private static final Logger logger = LoggerFactory.getLogger(LoggerDslCallback.class);

   public void logDsl(LogDsl logDsl){
      if(logger.isInfoEnabled()) {
         logger.info("Request[{}] action[{}] took time:{} ms ], use DSL[{}]",
               logDsl.getUrl(),logDsl.getAction(), logDsl.getTime(),   logDsl.getDsl());

      }
   }
}

6.3.0找不到LogDslCallback 这个接口

@li418418
Copy link
Author

logDsl

大佬有微信吗,沟通下

@yin-bp
Copy link
Contributor

yin-bp commented Jul 30, 2021

从github下载以下工程的最新源码,编译,将bboss版本号调整为6.3.1,才可以
bboss
bboss-http
security
bboss-plugins
bboss-elasticsearch
bboss-elastic-tran

如果github下载速度慢,可以到gitee下载
https://gitee.com/bboss

近段时间会发布6.3.1

@li418418
Copy link
Author

从github下载以下工程的最新源码,编译,将bboss版本号调整为6.3.1,才可以
bboss
bboss-http
security
bboss-plugins
bboss-elasticsearch
bboss-elastic-tran

如果github下载速度慢,可以到gitee下载
https://gitee.com/bboss

近段时间会发布6.3.1

ok

@yin-bp
Copy link
Contributor

yin-bp commented Jul 30, 2021

@li418418,bboss 文档网站
https://esdoc.bbossgroups.com/

开发交流: 21220580,166471282

@yin-bp
Copy link
Contributor

yin-bp commented Aug 1, 2021

@li418418
Copy link
Author

li418418 commented Aug 2, 2021

@li418418,bboss v6.3.1已发布,详情请看:

https://esdoc.bbossgroups.com/#/changelog?id=v631-%e5%8a%9f%e8%83%bd%e6%94%b9%e8%bf%9b

灰常感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants