Upsert Command for Python SDK#
Used to add new documents or update an existing document.
Skip to main contentDocumentation index
Fetch the complete documentation index at: /llms.txt
Ask it with GET /ask?q=<keywords or question>. Short keywords rank best.
Use these to discover all available pages before exploring further.
Page rating: `GET /feedback?path=<this page's path>&helpful=true` (or `false`) records whether this page helped. An optional `comment` (URL-encoded, at most 500 characters) says what was missing or wrong. It is anonymous and needs no key. Comments hold no code, secrets or personal data.
Used to add new documents or update an existing document.
Was this page helpful?
from upstash_search import Searchclient = Search( url="<UPSTASH_SEARCH_REST_URL>", token="<UPSTASH_SEARCH_REST_TOKEN>",)index = client.index("movies")index.upsert( documents=[ { "id": "movie-0", "content": { "title": "Star Wars", "overview": "Sci-fi space opera", "genre": "sci-fi", "category": "classic", }, "metadata": { "poster": "https://poster.link/starwars.jpg", }, }, ],)