Loading...

Groups

You have two lists now — movies and actors. But a visitor to your site doesn't think in lists; they just type into one box and expect the right thing back, whether it's a film or a person. A group gives you exactly that: one search box over several lists at once.

What a group is

A group is a single searchable thing made of several lists. Search it, and Search Stack searches every list in the group, merges the matches, and ranks them together — so "hemsworth" can return both the actor and the films they're in, in one response. Your underlying lists don't change; the group just gives them a shared front door.

Create the group

Go to Groups and choose Create Group. Name it movies-and-actors.

The Create Group dialog with the name 'movies-and-actors'

Open the new group's menu and choose Add List. Add movies, then do the same for actors. Each list is added at a specific version, so the group always searches a known shape of each list:

The Add List to Group dialog with a list and version selector

The group now lists both members:

The movies-and-actors group showing movies v1 and actors v1 as members

Search the group

A group has its own search and suggest endpoints — same as a list, with group in the path. The number is the group's current version, shown next to it in the console:

GET https://api.searchstack.dev/search/group/Demo/movies-and-actors/3?query=hemsworth
X-API-Key: {your key}

Results come back merged from both lists. Each result carries a list_name telling you which list it came from — so your page can show a film with a poster and a person with a headshot, from the same response:

{
  "results": [
    { "name": "Liam Hemsworth", "list_name": "actors", "fields": { "movies": ["The Hunger Games: Catching Fire"] } },
    { "name": "The Dark Knight", "list_name": "movies", "fields": { "genre": "Action", "year": 2008 } }
  ],
  "count": 2,
  "total_count": 2
}

In your front-end you'd branch on list_name to pick the right card template:

if (result.list_name === "actors") {
  renderActorCard(result);   // headshot + films
} else {
  renderMovieCard(result);   // poster + year
}

Why versions are pinned

Because each list joins the group at a fixed version, changing a list later never silently breaks the group. When you're ready to pick up a list's changes, you bump the group to a new version on your own schedule. That's the same versioning idea you'll meet head-on two pages from now.

Next: make your suggestions get smarter as people actually use the box.

Merging behaviour, version pins and cloning are covered in the Groups reference.

« Uploading
Next — User Generated Suggestions »
Let real searches improve your autocomplete.
Top