As I documented in an earlier post, if you want to take full advantage of managed properties, you must rely on both auto-created and refinable managed properties in SharePoint Online. That said, the names of those Managed Properties leave much to be desired. They have default names like RefinableString01 or RefinableDate15, or owstaxIdDivision, which cannot be changed. So after a while, you might end up with many of those refinable managed properties with almost the same name. This confuses the users as they might not know which managed property to pick when using Keyword Query Language (KQL) to create a query within Highlighted Content Web Part, for example. Luckily, we can assign an alias to those managed properties and add an alternate name that means something to the users. Let me explain how to do this.
The issue with refinable managed properties
So let me expand on what I mentioned above. Suppose you rely on auto-created or refinable managed properties. In that case, you will end up with the following managed properties names (just some examples listed for you below):
- RefinableString25 (Refinable Managed Property for Text)
- RefinableInt10 (Refinable Managed Property for Integer)
- RefinableDate01 (Refinable Managed Property for Date)
- owstaxIdDivision (auto-created managed property for Managed Metadata)
- DepartmentOWSCHCS (auto-created managed property for Site Choice Column)
Those names above cannot be changed! So what that means when you say, use want to utilize the refinable managed property when building a KQL query, you have to use the exact refinable name.
Example of a Query search using an automatically-created managed property
Example of a Query search using the built-in Refinable managed property
This can become very confusing to those who create managed properties and those who want to use them when customizing the search experience.
How to add an alias to a refinable managed property
Luckily, we can assign an alias to a Refinable property. That will give that property an alternate name that is more meaningful than the generic name. Below are instructions on how to add an alias. You can assign an alias at both tenant or site level. The instructions below are for setting up an alias at the site-level search schema, but the same applies to the tenant-level search schema.
- From the SharePoint Site, click Gear Icon > Site Information
- Click View all site settings
- Under Site Collection Administration, click on Search Schema
- Find the Managed Property you want to add an alias to, then click on it
- Scroll down to the middle of the page to an Alias section, then type in an Alias you would like to use for this managed property. Then click OK at the bottom of the page.
- You might need to wait several hours for the Alias to “propagate.”
How to use an Alias when aggregating content
Anytime you have a query field where you would typically use Keyword Query Language (KQL) to build a query, you can use the Alias instead of the default managed property name. Some examples include:
- Search Box Query
- SharePoint Search Verticals setup
- HCWP Query (except for the Filter option mentioned in the section below)
Important Notes about Alias in Managed Properties
- The Alias cannot be used as a filter within the Highlighted Content Web Part (HCWP). You will need to use the original managed property name there.
- With that being said, you will be able to use the Alias within the HCWP Web part if you opt for the Custom Query instead of the Filter option within the HCWP Web part
- The Alias does not replace the name of the managed property. It gives users an alternate means of using an alternate name when you build a query