What is the right KQL syntax to query for all documents where a given managed metadata property, "Document Category" has the value of a term which exists under a given parent term, "Sales and Marketing" in the term hierarchy?

Term Hierarchy:

Document Category (Term set)
 |--- Sales and Marketing
 |      |
 |      |--- Some Document Category 1
 |      |
 |      |--- Some Document Category 2
 |---- Some other category
 |      |
. . .

What we want is all documents where the property "Document Category" on the document has a value that is one of the terms under the "Sales and Marketing" node.

  • I don't think I understand, what you're saying is that you want to query a term and all of it's descendants? Isn't this standard behaviour when you search for a term? Aug 20, 2014 at 20:32

2 Answers 2


I've had good success with this tutorial

So if the guid for Sales and Marketing is c8a43f13-5ea1-45f2-b46d-3a1986a1cbd7 this would get all things tagged with a child of that.


But that wouldn't include anything that is actually tagged Sales and Marketing. If you want to have that included you would use

owstaxIdItemType:"GPP|#c8a43f13-5ea1-45f2-b46d-3a1986a1cbd7" OR
  • Why are those conditions joined with the AND-keyword in the second example? Shouldn't it be OR instead?
    – artokai
    Feb 3, 2016 at 8:50
  • You are correct. My bad! I was using the AND in the everyday spoken English -- and I know better. Thanks.
    – Rothrock
    Feb 3, 2016 at 18:34

If you know there term ID which you can get from the MMS Term Store Manager or the Tag Summary Page you can your the following syntax to get all descendant children of the MMS property ItemType (the # at the beginning indicates child terms):

owstaxIdItemType=#52263385-1fc3-4323-8d6b-50c8f6c3c45d:"reference materials"

Ref: http://msdn.microsoft.com/en-us/library/office/ff625182(v=office.14).aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.