Elasticsearch のサーバー上でクエリログを出力する方法
Published: 2021/12/15
前提
アプリケーションから Elasticsearch へ問合せを行う場合には、実際にどのようなクエリが発行されたのかを確認したくなるため、サーバー側の(コンソール)ログに、それを出力するための方法
方法
index.search.slowlog.threshold.query.debug
の設定を 0s
にするなどして、
スロークエリとしてのログ出力機構をすべてのクエリに適用することで、
クエリログの出力が可能。
この設定値は動的に変更可能なので、
curl -XPUT "http://localhost:9200/_all/_settings" -H "content-type: application/json" -d'
{
"index.search.slowlog.threshold.query.debug": "0s"
}'
などと _settings
へ PUT すればいける。
参考
How to log all queries made to elasticsearch container?
I'm trying to debug my app. When I hit the production elasticsearch host through my python app, the results are returned. When I change it to localhost, it works when I hit it manually through the
stackoverflow.com

Tags: elasticsearch
関連記事
Elasticsearch で join フィールドの値でフィルタする方法
2022/1/10
Elasticsearch-rails で接続先情報を設定する方法
2021/12/18