1

Is there a way to write a KQL query which performs a search only in the contents/body of a file/document?

I'd expect something like managedProperty:text, but I found no managed property for this.
Of course, searching for text without specification, any file containing text is found correctly, but this could lead to false positives, due to text appearing in any other property.

The only suitable managed property could be body, but writing body:text does not work.

1

As stated in the question, the right managed property is body. However such property cannot be used as-is, but it needs to be set as queryable in Central Admin. Of course, an index reset and a full crawl are needed to ensure that the modification is applied.

0

The managed property is called "body", but it is not query-able by default. To enable querying, you need to modify the "body" managed property in SharePoint's Central Administration. This works in SharePoint 2016.

  1. Open up Central Administration
  2. Go to: Search Service Application
  3. Click "Search Schema" in the left navigation
  4. Search for the "Body" managed properly and click on it to edit, you will see: Search Service Application: Edit Managed Property - body
  5. Click "Searchable" and "Queryable" and save the changes.
  6. Perform a Full Crawl

Now you can used managed property search syntax to return results in the body content of a document stored in SharePoint (e.g. body:text).

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.