<p dir="auto"><strong>Elasticsearch version</strong>:<br>
elasticsearch 2.3.4</p>
<p dir="auto"><strong>Describe the feature</strong>:<br>
Slow Query log to include information when the query is over an index alias.<br>
Specially if the alis includes a filter this should be visible from slow query log. At the moment these logs don't show any information and look identical when alias is used or not.</p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li>install elasticsearch 2.3.4</li>
<li>index some data. example data, use shakespeare data from docs.</li>
<li>create an alias with a filter, as an example:</li>
</ol>
<p dir="auto">POST _aliases/<br>
{<br>
"actions" : [<br>
{<br>
"add" : {<br>
"index" : "shakespeare",<br>
"alias" : "shakespeare_lines",<br>
"filter" : { "type" : {"value":"line"} }<br>
}<br>
}<br>
]<br>
}</p>
<p dir="auto">4- configure slow log with a very low threshold<br>
index.search.slowlog.threshold.query.trace: 1ms<br>
index.search.slowlog.threshold.fetch.trace: 1ms</p>
<p dir="auto">5- query the data</p>
<p dir="auto">{<br>
"query": { "match_all": {} }<br>
}<br>
6- see below log lacking any reference to the alis or the filter.</p>
<p dir="auto">[2016-08-09 16:10:58,120][INFO ][index.search.slowlog.query] [shakespeare]took[1.1ms], took_millis[1], types[], stats[], search_type[QUERY_THEN_FETCH], total_shards[5], source[{"query":{"match_all":{}}}], extra_source[],</p>
<p dir="auto">When using filtered aliases filtered by type, it will be helpful for slowlog to report the types queried.   Currently, it returns <code class="notranslate">types[]</code>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="POST /_aliases
{
  &quot;actions&quot;: [
    {
      &quot;add&quot;: {
        &quot;index&quot;: &quot;index_name&quot;,
        &quot;alias&quot;: &quot;slowlogalias&quot;,
        &quot;filter&quot;: {
          &quot;term&quot;: {
            &quot;_type&quot;: &quot;doc_type&quot;
          }
        }
      }
    }
  ]
}"><pre class="notranslate"><code class="notranslate">POST /_aliases
{
  "actions": [
    {
      "add": {
        "index": "index_name",
        "alias": "slowlogalias",
        "filter": {
          "term": {
            "_type": "doc_type"
          }
        }
      }
    }
  ]
}
</code></pre></div>