No filtering possibility with vega graph (when using aggregations to create the plot)

Hello everyone,

I would like to know why I can not use filters in Controls, or the general time filter, in a visualization that I developped in vega.

This is the code I have developed, and it seems to be that a simple functionality of kibana with controls is not working property in these cases. Would you mind giving me a suggestion??.

{
$schema: https://vega.github.io/schema/vega-lite/v2.6.0.json
title: Orders
%context%: true
%timefield%: @timestamp

layer : [
{
data: {
url: {

  index: hs_index
   "body": {
    "size": 0,
    "track_total_hits": true,
    "query": {
		"match": {
			"order_sent": "ORDER/INSERT"
				}
	},
    "aggregations": {
      "order_over_time_sent": {
        "date_histogram": {
          "field": "@timestamp",
          "format": "yyyy-MM-dd hh:mm-ss",
          "interval": "15m"
        }
      }
    }
  }
}
format: {property: "aggregations.order_over_time_sent.buckets"}

}
mark: bar
width: {"step": 12}
encoding: {
"column": {
"field": "order_sent",
"type": "ordinal",
"scale": {"padding": 4},
"axis": {"orient": "bottom","axisWidth": 1,"offset": -8}
},
x: {
field: key
type: temporal
axis: {title: "Time"}
}
y: {
field: doc_count
type: quantitative
axis: {title: "No. of orders"}
}

 color: {"value": "#FF0000"},

legend: { title: '1' }

}
},

{
data: {
url: {

  index: hs_index
   "body": {
    "size": 0,
    "track_total_hits": true,
    "query": {
		"match": {
			"order_rejected": "ORDER/INSERT/NAK"
				}
	},
    "aggregations": {
      "order_over_time_rejected": {
        "date_histogram": {
          "field": "@timestamp",
          "format": "yyyy-MM-dd hh:mm-ss",
          "interval": "15m"
        }
      }
    }
  }
}
format: {property: "aggregations.order_over_time_rejected.buckets"}

}
mark: bar
width: {"step": 12}
encoding: {

"column": {
  "field": "order_rejected",
  "type": "ordinal",
  "scale": {"padding": 4},
  "axis": {"orient": "bottom","axisWidth": 1,"offset": -8}
}


x: {
  field: key
  type: temporal
  axis: {title: "Time"}
}
y: {
  field: doc_count
  type: quantitative
  axis: {title: "No. of orders"}
}

 color: {"value": "#006400"},

legend: { title: '1' }

}
},

{
data: {
url: {

  index: hs_index
   "body": {
    "size": 0,
    "track_total_hits": true,
    "query": {
		"match": {
			"order_executed": "EXEC_FULL"
				}
	},
    "aggregations": {
      "order_over_time_executed": {
        "date_histogram": {
          "field": "@timestamp",
          "format": "yyyy-MM-dd hh:mm-ss",
          "interval": "15m"
        }
      }
    }
  }
}
format: {property: "aggregations.order_over_time_executed.buckets"}

}
mark: bar
width: {"step": 12}
encoding: {
"column": {
"field": "order_executed",
"type": "ordinal",
"scale": {"padding": 4},
"axis": {"orient": "bottom","axisWidth": 1,"offset": -8}
}

x: {
  field: key
  type: temporal
  axis: {title: "Time"}
}
y: {
  field: doc_count
  type: quantitative
  axis: {title: "No. of orders"}
}

 color: {"value": "#FFFF00"},

legend: { title: '1' }

}
}

]
}

(How I could be able to filter the graph in a dashboard in order to for example see the values of a particular day and not all the data stored in the index?)

this is the graph.

I'm going to be really grateful if somebody could help me with this issue.

JUAN DAVID BRICENO GUERRERO

You can add filters using the guide from this PR: https://github.com/elastic/kibana/pull/17586

Marius Dragomir,

thanks so much for your reply, yet could you explain me in few words how it works? or somehow, how/where may I have to add it in my code?

Thank for helping!

Sorry, I don't really know more about it that what it's described in the PR comments and description.