Advice on how to log or see the elasticsearch queries Kibana makes

sort-of Kibana / ELK stack noob here

I just wanna see how Kibana queries elasticsearch to learn how a little more on how it works internally to make all the cool charts and stuff. Timelion too.

is there a way to display that? Or maybe I can make elasticsearch log all the queries it gets or something. I never did any of that before so any ideas welcome!

Hi @dlam

There are a few different options, depending on what you want to inspect.

Kibana makes queries to Elasticsearch from both the frontend and the backend. The frontend queries can be viewed directly in the network tab of your browser's devtools.

Visualizations include a "spy tab" that allows you to see what the raw query looked like. Here's an example:

Backend requests were trickier until the (just released) version 5.2 came out. In 5.2 you can add elasticsearch.logQueries: true to your kibana.yml config file and then start up kibana with --verbose. This will log all of the backend queries to your console, including Timelion queries.

Another option, which I haven't personally tried but I know others have had some success with, is to set Elasticsearch's slowlog thereshold to 0 so that all queries to ES are logged. This is obviously something you'd only want to do in development, but could be a useful catchall.

woot! thanks I get it: looks like what I was looking for was the frontend queries where it POST's to /elasticsearch/_msearch

I tried the backend requests too. There was a lotta logging to look at but from what I could eyeball those were more related to internal Kibana stuff

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.