let query = ActivitiesQuery(  filter: .equal(.type, "post"),  sort: [Sort(field: .createdAt, direction: .reverse)],  limit: 10 ) let activityList = client.activityList(for: query) let activities = try await activityList.get()Querying Activities
Activity Search & Queries
You can query & search activities. Here’s an example of how to query activities:
val query = ActivitiesQuery(  filter = ActivitiesFilterField.type.equal("post"),  sort = listOf(ActivitiesSort(ActivitiesSortField.CreatedAt, SortDirection.REVERSE)),  limit = 10 ) val activityList = client.activityList(query = query) val activities: Result<List<ActivityData>> = activityList.get()client.queryActivities({  filter: {  activity_type: "post",  },  sort: [{ field: "created_at", direction: -1 }],  limit: 10, });client.feeds.queryActivities({  filter: {  activity_type: "post",  },  sort: [{ field: "created_at", direction: -1 }],  limit: 10, });final query = ActivitiesQuery(  filter: const Filter.equal(ActivitiesFilterField.type, 'post'),  sort: [ActivitiesSort.desc(ActivitiesSortField.createdAt)],  limit: 10, );  final activityList = client.activityList(query); final activities = await activityList.get();response, err := client.Feeds().QueryActivities(context.Background(), &getstream.QueryActivitiesRequest{  Filter: map[string]any{  "activity_type": "post",  },  Sort: []getstream.SortParamRequest{  {  Field: stringPtr("created_at"),  Direction: intPtr(-1),  },  },  Limit: intPtr(10), })Map<String, Object> filter = new HashMap<>(); filter.put("activity_type", "post");  QueryActivitiesRequest request =  QueryActivitiesRequest.builder().limit(10).filter(filter).build();  QueryActivitiesResponse response = feeds.queryActivities(request).execute().getData();$response = $feedsClient->queryActivities(  new GeneratedModels\QueryActivitiesRequest(  limit: 10,  filter: (object)['activity_type' => 'post'],  sort: [['field' => 'created_at', 'direction' => -1]]  ) );var response = await _feedsV3Client.QueryActivitiesAsync(  new QueryActivitiesRequest  {  Limit = 10,  Filter = new Dictionary<string, object> { ["activity_type"] = "post" }  } );response = self.client.feeds.query_activities(  limit=10, filter={"activity_type": "post"} )When searching activities, the activity.current_feed field contains information about the feed the activity belongs to. However, if an activity is posted to multiple feeds, this field will be empty. In this case, you can use the activity.feeds array to read all feed IDs the activity was posted to and fetch feeds separately if needed.
Search filter syntax emulates a MongoDB style query syntax. (It emulates it, we don’t use MongoDB, but the query syntax is nice here).
Querying activities by text
// search for activities where the text includes the word 'popularity'. let query = ActivitiesQuery(  filter: .query(.text, "popularity") ) let activityList = client.activityList(for: query) let activities = try await activityList.get()// search for activities where the text includes the word 'popularity'. val query = ActivitiesQuery(  filter = ActivitiesFilterField.text.query("popularity") ) val activityList = client.activityList(query = query) val activities: Result<List<ActivityData>> = activityList.get()client.queryActivities({  filter: {  text: {  $q: "popularity",  },  }, });client.feeds.queryActivities({  filter: {  text: {  $q: "popularity",  },  }, });// search for activities where the text includes the word 'popularity'. const query = ActivitiesQuery(  filter: Filter.equal(ActivitiesFilterField.text, 'popularity'), );  final activityList = client.activityList(query); final activities = await activityList.get();response, err := client.Feeds().QueryActivities(context.Background(), &getstream.QueryActivitiesRequest{  Filter: map[string]interface{}{  "text": map[string]interface{}{  "$q": "popularity",  },  }, })Map<String, Object> filter = new HashMap<>(); filter.put("activity_type", "post");  QueryActivitiesRequest request =  QueryActivitiesRequest.builder().limit(10).filter(filter).build();  QueryActivitiesResponse response = feeds.queryActivities(request).execute().getData();// search for activities where the text includes the word 'popularity'. $response = $feedsClient->queryActivities(  new GeneratedModels\QueryActivitiesRequest(  filter: (object)[  'text' => (object)[  '$q' => 'popularity'  ]  ]  ) );var response = await _feedsV3Client.QueryActivitiesAsync(  new QueryActivitiesRequest  {  Limit = 10,  Filter = new Dictionary<string, object> { ["activity_type"] = "post" }  } );response = self.client.feeds.query_activities(  limit=10, filter={"activity_type": "post"} )Querying activities by search data
Consider this example activity:
{  "id": "activity-123",  "type": "post",  "text": "Check out our spring sale!",  "search_data": {  "campaign": {  "id": "spring-sale-2025",  "location": {  "mall": "yorkdale",  "city": "toronto",  "country": "canada"  }  }  }  // ... other activity fields }You can search this activity using the search_data field in several ways:
// search for activities associated with the campaign ID 'spring-sale-2025' let searchValue: [String: RawJSON] = ["campaign": .dictionary(["id": .string("spring-sale-2025")])] let query = ActivitiesQuery(  filter: .contains(.searchData, searchValue) ) let activityList = client.activityList(for: query) let activities = try await activityList.get()  // search for activities where the campaign took place in a mall let query2 = ActivitiesQuery(  filter: .pathExists(.searchData, "campaign.location.mall") ) let activityList2 = client.activityList(for: query2) let activities2 = try await activityList2.get()// search for activities associated with the campaign ID 'spring-sale-2025' val searchValue = mapOf("campaign" to mapOf("id" to "spring-sale-2025")) val query = ActivitiesQuery(  filter = ActivitiesFilterField.searchData.contains(searchValue) ) val activityList = client.activityList(query = query) val activities: Result<List<ActivityData>> = activityList.get()  // search for activities where the campaign took place in a mall val query2 = ActivitiesQuery(  filter = ActivitiesFilterField.searchData.pathExists("campaign.location.mall") ) val activityList2 = client.activityList(query = query2) val activities2: Result<List<ActivityData>> = activityList2.get()client.queryActivities({  filter: {  search_data: { $contains: { campaign: { id: "spring-sale-2025" } } },  }, });  client.queryActivities({  filter: {  search_data: { $path_exists: "campaign.location.mall" },  }, });client.feeds.queryActivities({  filter: {  search_data: { $contains: { campaign: { id: "spring-sale-2025" } } },  }, });  client.feeds.queryActivities({  filter: {  search_data: { $path_exists: "campaign.location.mall" },  }, });// search for activities associated with the campaign ID 'spring-sale-2025' final searchValue = {  'campaign': {'id': 'spring-sale-2025'}, };  final query = ActivitiesQuery(  filter: Filter.contains(ActivitiesFilterField.searchData, searchValue), );  final activityList = client.activityList(query); final activities = await activityList.get();  // search for activities where the campaign took place in a mall const query2 = ActivitiesQuery(  filter: Filter.pathExists(  ActivitiesFilterField.searchData,  'campaign.location.mall',  ), );  final activityList2 = client.activityList(query2); final activities2 = await activityList2.get();query1 := &getstream.QueryActivitiesRequest{  Filter: map[string]any{  "search_data": map[string]any{  "$contains": map[string]any{  "campaign": map[string]any{  "id": "spring-sale-2025",  },  },  },  }, }  response1, err := client.Feeds().QueryActivities(context.Background(), query1)  query2 := &getstream.QueryActivitiesRequest{  Filter: map[string]any{  "search_data": map[string]any{  "$path_exists": "campaign.location.mall",  },  }, }  response2, err := client.Feeds().QueryActivities(context.Background(), query2)Map<String, Object> filter = new HashMap<>(); filter.put("activity_type", "post");  QueryActivitiesRequest request =  QueryActivitiesRequest.builder().limit(10).filter(filter).build();  QueryActivitiesResponse response = feeds.queryActivities(request).execute().getData();// search for activities associated with the campaign ID 'spring-sale-2025' $response = $feedsClient->queryActivities(  new GeneratedModels\QueryActivitiesRequest(  filter: (object)[  'search_data' => (object)[  '$contains' => (object)[  'campaign' => (object)[  'id' => 'spring-sale-2025'  ]  ]  ]  ]  ) );  // search for activities where the campaign took place in a mall $response2 = $feedsClient->queryActivities(  new GeneratedModels\QueryActivitiesRequest(  filter: (object)[  'search_data' => (object)[  '$path_exists' => 'campaign.location.mall'  ]  ]  ) );var response = await _feedsV3Client.QueryActivitiesAsync(  new QueryActivitiesRequest  {  Limit = 10,  Filter = new Dictionary<string, object> { ["activity_type"] = "post" }  } );response = self.client.feeds.query_activities(  limit=10, filter={"activity_type": "post"} )Activities Queryable Built-In Fields
| name | type | description | supported operations | example | 
|---|---|---|---|---|
| id | string or list of strings | The ID of the activity | $in,$eq | { id: { $in: [ 'abc', 'xyz' ] } } | 
| activity_type | string or list of strings | The type of the activity | $in,$eq | { activity_type: { $in: [ 'abc', 'xyz' ] } } | 
| user_id | string or list of strings | The ID of the user who created the activity | $in,$eq | { user_id: { $in: [ 'abc', 'xyz' ] } } | 
| text | string | The text content of the activity | $eq,$q,$autocomplete | { text: { $q: 'popularity' } } | 
| search_data | object | The extra metadata for search indexing | $contains,$path_exists | { search_data: { $contains: { 'category': 'sports', 'status': 'active' } } } | 
| interest_tags | list of strings | Tags for user interests | $eq,$contains | { interest_tags: { $in: [ 'sports', 'music' ] } } | 
| filter_tags | list of strings | Tags for filtering | $eq,$contains | { filter_tags: { $in: [ 'categoryA', 'categoryB' ] } } | 
| created_at | string, must be formatted as an RFC3339 timestamp | The time the activity was created | $eq,$gt,$lt,$gte,$lte | { created_at: { $gte: '2023-12-04T09:30:20.45Z' } } | 
| popularity | number | The popularity score of the activity | $eq,$ne,$gt,$lt,$gte,$lte | { popularity: { $gte: 70 } } | 
| near | object | Indicates the GEO point to search nearby activities | $eq | { near: { $eq: { lat: 40.0, lng: -74.0, distance: 200 } } } | 
| within_bounds | object | Indicates the GEO bounds to search for activities within | $eq | { within_bounds: { $eq: { ne_lat: 40.0, ne_lng: -115.0, sw_lat: 32.0, sw_lng: -125.0 } } } | 
Be sure to reach out to support if you need additional query activity capabilities.
Activities sort options
Fields:
- created_at
- popularity
Direction: 1 or -1