title: Vega and Kibana - Dynamic timestamp label and filtered queries
body: <p>I am working with my first Vega visualization with Kibana.</p>
  
  <pre><code>{
    $schema: https://vega.github.io/schema/vega-lite/v2.json
    title: Event counts from all indexes
  
    data: {
      url: {
  
        %context%: true
        %timefield%: last_submission
  
        index: test_info
  
        body: {
          aggs: {
            time_buckets: {
              date_histogram: {
  
                field: last_submission
                interval: {%autointerval%: true}
                extended_bounds: {
                  min: {%timefilter%: "min"}
                  max: {%timefilter%: "max"}
                }
  
                min_doc_count: 0
              }
            }
          }
          size: 0
        }
      }
      format: {property: "aggregations.time_buckets.buckets"}
    }
  
    mark: line
  
    encoding: {
      x: {
        field: key
        type: temporal
        axis: {title: false} 
      }
      y: {
        field: doc_count
        type: quantitative
        axis: {title: "Document count"}
      }
    }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/n3JR6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/n3JR6.png" alt="visualization result"></a></p>
  
  <p>I have two questions here.</p>
  
  <p>1 - As the visualization is linked to the Kibana dashboard, the user can choice different time windows from the main dashboard. As you can see the labels have always the full format. I need to set dynamically the label based on the time windows.
  That is, show only hours if the user choose day data, show days if the user choose weekly data and so on.
  What I need to do?</p>
  
  <p>2- I need to filter the events basing on a particular value of a field and use the time windows of the main dashboard. Is that possible? I have tried adding the query filter here in the Vega code, but if I also have the context and timefield set I have this error:</p>
  
  <p><em>url.%context% and url.%timefield% must not be used when url.body.query is set</em></p>