Uploading
Typing films in one at a time was fine for learning, but a real catalogue has hundreds or thousands of them. Let's load a whole list at once from a file — and let Search Stack work out the fields for you. We'll use this to add a second list to our movie-night site: actors.
The file format
Your data is a JSON array — one object per record, each object a set of "field": value pairs. Values can be text, numbers, true/false, or a list.
Here's a couple of actors:
[
{
"name": "Jennifer Lawrence",
"image_url": "https://.../jennifer-lawrence.jpg",
"movies": ["The Hunger Games: Catching Fire", "X-Men: Days of Future Past"]
},
{
"name": "Hugh Jackman",
"image_url": "https://.../hugh-jackman.jpg",
"movies": ["Prisoners", "X-Men: Days of Future Past"]
}
]
Import the file
Create a new list called actors, open it, and click the Import button (the upload icon). Choose your file, and set two things:
- Name Field — which field is the result's name. Here it's
name. (Leave it blank and Search Stack picks a sensible one for you.) - Create Fields — leave this on and Search Stack reads your file and sets up the fields automatically, so you don't have to add each one by hand first.
Click Upload. In seconds the whole list is in, with every field created and typed for you — image_url came in as a resource (see the little image previews), movies as searchable text:
Or from code
The same import over the API is a single call — post your JSON array to the with-fields endpoint and any new fields are created from the data:
POST https://api.searchstack.dev/search-result/Demo/actors/with-fields
X-API-Key: {your key}
Content-Type: application/json
[ { "name": "Jennifer Lawrence", "image_url": "https://…", "movies": ["…"] }, … ]
Big files (over 1 MB) are imported in the background — you can carry on, and the records appear when it finishes. You can also keep an imported file in a media store and have Search Stack re-import it automatically whenever the file changes, so your search data stays in step with a file you export from elsewhere.
You now have two lists: movies and actors. On the next page we'll let a visitor search both at once from a single box.
Auto-reimport, media stores and the in-console file editor are covered in the Media stores reference.