Search vs. Filter

api

#1

I’m working with the Managment API, and in reading through the User resource documentation I came across the parameter descriptions:

This table seems to indicate that filtering means returning only a subset of properties for a given resource type, rather than the full property set. However, clicking through thelink to the description of filtering seems to indicate that filtering is not about returning a subset of resource properties, but rather a subset of resources. If this is the case, what is the difference between filtering and searching? Which one should I use to find users based on their properties?

Thanks!


#2

The filter does not manage how fields get projected on the object, I can definitely see how that can be interpreted a different way and I’ve flagged this for the docs team to look at.

To answer your questions, I think these two sections provide an OK overview:

https://developer.okta.com/docs/api/resources/users#list-users-with-a-filter
https://developer.okta.com/docs/api/resources/users#list-users-with-search

search uses a searching product under the hood, so Okta needs to index when data changes. A search may return different results then what is actually stored, based on the time it takes to index. It can search more fields though.

filter is a more rigid, only supporting some properties. Filtering queries the user store, so it is slower at returning results, but the results represent what it in the user store (since it doesn’t require additional indexing).

Hope this helps!


#3

Tom,

Thanks, this helps a lot! I think I understand now how to move forward with the queries I’m working on, and will probably use filtering over searching as accuracy is priority over speed in this particular project.