Template variable in other variable doesn't work

I have metricbeat data from Elastic search with few custom fields added. I am trying to use template variables but facing issue when using another template variable in query.

source : {“find”: “terms”, “field”: “prod/agentName.keyword”}
Preview of values: ALL ABC XYZ QWR

host : {“find”: “terms”, “field”: “agent.hostname.keyword”, “query”: “prod/agentName.keyword:$source”}

Returns no results neither in preview nor in panel. Am i missing anything?