I think I found the solution however it will require the tags to be stored in two separate fields (one to query and the other to aggregate on)
{
"from" : 0,
"size" : 0,
"query" : {
"bool" : {
"must" : [{
"term" : {
"userid" : {
"value" : 1
}
}
}
]
}
},
"aggs" : {
"suggest" : {
"filter" : {
"prefix" : {
"tags" : {
"value" : "win"
}
}
},
"aggs" : {
"Tags_suggest" : {
"terms" : {
"field" : "tags_key",
"size" : 20,
"include" : {
"pattern" : "win.*"
}
}
}
}
}
}
}
I can live with that, even though it will require twice the storage. And fingers crossed that ES wont remove aggregation filters in the future.