Whether to allow the profile to be opened on every query request

I want to turn on profile for each elasticsearch query request in my system, so that I can get the profile results to print the logs, combined with traceId, I can get what the reason for each slow request is, but I am worried whether this will affect the performance of the elasticsearch query itself?

Welcome to our community! :smiley:

Are you referring to APM profiles?

If there is a relevant apm can analyze es query slow in which can also be, we use is skywalking, but I did not find the relevant APM plug-in, found are elasticsearch client, and I am concerned about elasticsearch server internal slow in where. So I want to turn on Profile in every query request, so that when a slow query occurs, I can print the json of the profile section and then paste it manually into kibana to see the cause of the slowdown. But I'm not sure if this will affect the performance of the query itself, so I thought I'd ask here.

GET movies/_search
{
  "query": {"match_all": {}},
  "profile": "true"
}

For example, in the query above, adding the profile parameter in the request body, I wonder if this will affect the performance of the query?

From Tune your queries with the Profile API | Elasticsearch Reference [7.10] | Elastic;

  • the Profile API as a debugging tool adds significant overhead to search execution and can also have a very verbose output

Thanks I see, so is there any way to catch the reason for the slow request at that time? Because some requests, not every query is slow, maybe just occasionally, but I would like to know what the time is spent on?

You can try looking at hot threads instead?

Okay, I'll try that next time.

Is there any other way to look at the hot threads in a way that doesn't feel as clear as the Profile

No there's not.
Do you have Monitoring enabled?

There is monitoring, but monitoring also only looks at global level information and cannot get the reason for a particular slowdown once in a while.

The only other thing is the slow log, which you can configure easily.

Thanks, I understand that