LoginSignup
1
2

More than 3 years have passed since last update.

[Go]ElasticSearchの実行クエリをログ出力する

Posted at

モチベーション

GoからElasticSearchを操作するクライアントとしてgithub.com/olivere/elasticがある。
実行時に展開される生queryをみたかった。以下のようにセットするとログ出力で確認できる。

sample.go
es, err := elastic.NewClient(
  // other option...
  elastic.SetTraceLog(log.New(os.Stdout, "[elastic-search]", 0)), // [elastic-search]はlog prefix
)

参考

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2