I want to build a KQL query for some server side code to search both custom properties and document content. So if for example there was a property called reference and we are looking for content say "affiliated" I have tried something like:

Reference: "1234" and affiliated

But the query returns items with the terms Reference and affiliated in it. It looks like the reference property is being applied as well so I am just getting a subset of my results.

Any ideas would be greatly appreciated.


Ok I have spent some time with this and it's a reasonably complex area but. I have discovered (DOH!) that I need to be using the Managed Property name in the KQL Search. So when the crawler crawls and finds a document property, column, etc. It creates a crawled property it also creates a mapped Managed Property.

So when building your KQL you need to know what the Managed property name is, in the case of Reference it will be ReferenceOWSTEXT this includes the name (note spaces will be removed for properties that have those) OWS and finally the field type (in this case TEXT).

So my query now looks like ReferenceOWSTEXT:"1234" affiliated this brings back only documents that have a Reference field with the value 1234 and the text affiliated in the body; title or other properties of the document.

Hopefully this may help any others in the same boat.


I have found that case matters. In the search center try Reference:"1234" (the colon is a contains operator, if you want exactly "1234" use Reference="1234") that should only get the items for Reference. Confirm that is working first. Then add "affiliated AND " so that your whole query is affiliated AND Reference="1234".

BTW, is the Reference managed property data type Text, Integer, or ??

  • Hi thanks for the response, tried the above with no luck. The Reference field is a string (text) type. I only get results if I put the query as 1234 AND affiliated or – Openside Jan 14 '14 at 16:35
  • or ... 1234 affiliated putting the field name in does not return anything unless that's in the document too. – Openside Jan 14 '14 at 16:38
  • I suspect that something is wrong with your managed property definition or that you have not completed a full crawl of the content. – Matthew McDermott Jan 14 '14 at 21:51
  • Have looked at that, a full crawl has been done but it makes no difference. Will look at this further when I get chance. I have just specified the term as free text so "affiliated AND 1234" which is working for the time being. But I may need to revisit if the search terms increase. – Openside Jan 22 '14 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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