Elasticsearch query for Query Suggestions

Does anyone have an example query of what Query Suggestions actually uses for Elasticsearch? According to (Query Suggestions Guide | Elastic App Search Documentation [8.6] | Elastic),

" Query suggestions use the best_fields type."
" A query suggestion will match deeper on a single field and apply less search logic when compared to a search query."

I would like to see an example so I can make my own with some adjustments.

Hi @ryans

If you want to see exactly what requests Enterprise Search is sending to Elasticsearch, you can add the X-Enterprise-Search-Debug header to your Enterprise Search API request. So if you were using cURL, it would look like:

-H 'X-Enterprise-Search-Debug: true

See: https://www.elastic.co/guide/en/app-search/current/troubleshooting.html#troubleshooting-debugging-queries-debug-header

Thanks Sean, but it doesn't seem to work for Query Suggestions. I got no additional data:

curl -X POST '<ENTERPRISE_SEARCH_BASE_URL>/api/as/v1/engines/parks-data/query_suggestion'
-H 'Content-Type: application/json'
-H 'Authorization: Bearer API_KEY'
-H 'X-Enterprise-Search-Debug: true'
-d '{
"query": "car",
"types": {
"documents": {
"fields": [
"size": 3

Is this a bug?

@ryans you need to look in the Enterprise Search logs to see all of the Elasticsearch requests that are generated from this Enterprise Search request. They are not included in the request response body.

Thanks Sean. I checked the logs and still didn't see any additional information:

Is there some setting I need to enable or something?

Hi @ryans ,

Sorry, I did not clarify. I'm talking about the application server logs (system logs), not the API Event Logs.

If you deployed with Elastic Cloud, you can access these logs by enabling logging and metrics, or by reaching out to support. If you have deployed Enterprise Search on infrastructure you own, you can find the logs at the <install-root>/enterprise-search.*/logs/app-server.log


Thanks so much! I was able to figure out the logging and find the query. Much appreciated.

1 Like

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