title: Can you use named queries on Elasticsearch with PHP?
body: <p>I know you can use named queries in Elasticsearch to test which document matched the best in Kibana but I'm running Wordpress with Jetpack search which uses elasticsearch PHP (v2.4) and I want to be able to test my queries and return the named queries on each result so I can better understand that my queries returned what I had intended. This is how it's done in Elasticsearch (json):</p>
  
  <pre><code>...
      "must": [
          {
              "match": {
                  "body": {
                      "query": "Will Smith",
                      "_name": "match_will_smith"
                  }
              }
          }  
      ],
      "should": [
          {
            "match_phrase": {
              "body": {
                "query": "Will Smith",
                "slop": 5,
                "_name": "should_match_phrase_will_smith_with_slop"
              }
            }
          },
      ]...
  </code></pre>
  
  <p>Result: </p>
  
  <pre><code>"matched_queries" : [
      "match_will_smith",
      "should_match_phrase_will_smith_with_slop"
  ]
  </code></pre>
  
  <p>That would be awesome if I could get the value of the "matched_queries" object and print it to my php page on every result to I can see what each article is matching. Anyone knows if this is possible?</p>