Can I see the query in the results elastic sends me?

I feel like this is a dumb question, but is there a way to show the query itself in the results JSON elastic sends via search API?

For example:
Say I'm querying index named "Movies":

curl http://localhost:9200/Movies/_search?q=movie:matrix

I get the normal response structure:

{
    "took": 1,
    "timed_out": false,
    "_shards":{
        "total" : 1,
        "successful" : 1,
        "skipped" : 0,
        "failed" : 0
    },
    "hits":{
        "total" : 1,
        "max_score": 1.3
        "hits" : [
            {
                "_index" : "Movies",
                "_type" : "_doc",
                "_id" : "0",
                "_score": 1.3,
                "_source" : {
                    "movie" : "matrix",
                    "year": "1999",
                    "rating" : 4
                }
            }
        ]
    }
}

but is there a way to see in the response what query generated this results?

I want "movie:matrix" to appear somewhere in the results, so when I inspect the results later I would know what query created this results.

This is usefull when each doc has a lot of fields, so recovering the query is not obvious...
Any ideas?

Are you looking for this? https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-named-queries-and-filters.html

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