Searchable and indexed Custom attributes

Hi ,
Can we create the custom attributes which are searchable. Also, can we get these attributes indexed for better performance?

Hi @zhouken75034

Thank you for reaching out to us!

I believe that what you are looking for can be achieved by adding the custom attributes to either the user_metadata or app_metadata of your users. It’s important to know the distinction between the two ( more information can be found on our following documentation : Understand How Metadata Works in User Profiles), but the important part is :

  • user_metadata : this is information about the user that they can view and edit, such as favorite color, name of their pet, interest etc. It should not contain important information;
  • app_metadata : information that the user has read-only level access to and they cannot edit it. Typically used for assigning roles, job attributes, internal ID etc.

To be noted that sensitive data should never be stored within any of these fields.

Once your custom attributes have been set, you can then use the List or Search Users tool of the Management API to run a query and search for all users that have a specific attribute, with the help of the query: q search parameter. As an example, if you are searching for all users that have the custom attribute of role:"helpdesk" set in their app_metadata, your query: q search will look like this : app_metadata.role:"helpdesk". This will present a list of all users that have this specific custom attribute set in their app_metadata.

The following documentation on User Search Query Syntax might also prove useful for this purpose.

With regards to indexing the attributes for better performance, I do believe that when it comes to a large number of users that might slow down the Management API, this will require a Support case to be opened in order for our Support Engineers to further assist.

Hope this helped!
Gerald