#community-help

Updating Multiple Records with Typesense

TLDR Shabber wanted to update multiple records based on ids. Kishore Nallan suggested using the import endpoint with 'update' action mode and provided examples.

Powered by Struct AI
8
4mo
Solved
Join the chat
Jun 09, 2023 (4 months ago)
Shabber
Photo of md5-5a2ce5f6a332437f74a5fd2f2c98052e
Shabber
12:28 PM
curl -X DELETE \
-H "X-TYPESENSE-API-KEY: oKsdsdsd7D2SXjtd6MjXxWjjlkkhjc5mQeGpcU2OdfvdsfdsOXl7zZmuWfqaWsdsdc9rG6Ohw" \
http://localhost:8108/collections/BooksNewStar

for delete this works, but need to update individual records based on id
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:44 PM
Jun 12, 2023 (4 months ago)
Shabber
Photo of md5-5a2ce5f6a332437f74a5fd2f2c98052e
Shabber
04:36 AM
Thank You
04:59
Shabber
04:59 AM
One last question, similar way
curl "" -X POST \
        -H "Content-Type: application/json" \
        -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
        -d '{
          "id": "124",
          "company_name": "Stark Industries",
          "num_employees": 5215,
          "country": "USA"
        }'

05:00
Shabber
05:00 AM
cant i update multiple records at once ?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
05:14 AM
The import endpoint supports sending documents 1 per line
05:14
Kishore Nallan
05:14 AM
The documentation page above has examples
Shabber
Photo of md5-5a2ce5f6a332437f74a5fd2f2c98052e
Shabber
05:15 AM
Thank you will check on it