How to aggregate term field only with query

eg:
the values of "p6" only contains d the query clause, not filter by filter clause
how to do ?? thanks !

"query": {
"filtered": {
"query": {
"multi_match": {
"query": "testing",
"fields": [ "field1"
]
}
},
"filter": {
"bool": {
"must": [{"term":{"field2":1}}]
}
}
}
},
"aggregations": {
"p6": {
"terms": {
"field": "p6"
}
}
}