Mehdi Khlifi
07/28/2021, 9:25 AMprint(_id)
document = insert_change['updateDescription']['updatedFields']
print(document)
print(CLIENT.collections[TYPESENSE_COLLECTION].documents[_id].retrieve())
r = CLIENT.collections[TYPESENSE_COLLECTION].documents[_id].update(document)
print(r)
This is the response
5fae9573f56f4d5f91b8c02d
{'name': 'Le Zii'}
{'_cls': 'Model', 'address': '', 'admin_uuid': {'$uuid': 'f25b39ef25ba11ebb464bc5ff4bfaa62'}, 'categories': ['Fast Food et Pizzerias'], 'city': 'Texas', 'coordinates': {'coordinates': [30.1769166, 40.8368248], 'type': 'Point'}, 'country': 'France', 'created_at': '2020-11-13 14:17:15.782000', 'created_by_uuid': {'$uuid': 'f25b39ef25ba11ebb464bc5ff4bfaa62'}, 'cuisines': [], 'description': 'Best burger in town :)', 'email': '<mailto:test22@gmail.com|test22@gmail.com>', 'facebook_url': '', 'gallery': [], 'google_maps_url': '', 'has_ordering_service': False, 'has_qr_code': False, 'hours': {'Dimanche': ['0'], 'Jeudi': ['12:00', '23:00'], 'Lundi': ['12:00', '23:00'], 'Mardi': ['12:00', '23:00'], 'Mercredi': ['12:00', '23:00'], 'Samedi': ['12:00', '23:00'], 'Vendredi': ['12:00', '23:00']}, 'id': '5fae9573f56f4d5f91b8c02d', 'instagram_url': '', 'is_activated_by_admin': True, 'is_public': False, 'logo': '', 'menu_items': [], 'more_services': ['Livraison', 'Tickets resto'], 'name': 'Le Z', 'operator': {'_cls': 'BaseModel', '_ref': {'$id': {'$oid': '5fae9573f56f4d5f91b8c02e'}, '$ref': 'base_model'}}, 'price': 3, 'price_range': '$$$', 'private_phone_numbers': [], 'profile_picture': '', 'public_phone_numbers': ['0000'], 'rating': 0, 'reviews_count': 0, 'specialties': ['Burger'], 'state': 'Ariana', 'tagline': '', 'trends': 'Eat Out', 'updated_at': '2021-07-12 14:57:47.548000', 'uuid': 'f25b39ec-25ba-11eb-b464-bc5ff4bfaa62', 'website_url': '', 'zip_code': '0000'}
As you can see, the document exists in my Typesense collection, but when I call update()
it returns [Errno 404] Not Found
. Any idea why this is happening?Kishore Nallan
07/28/2021, 9:43 AMprint(CLIENT.collections[TYPESENSE_COLLECTION].documents['5fae9573f56f4d5f91b8c02d'].retrieve())
# Try inserting an empty document to see what error message you are getting now
print(CLIENT.collections[TYPESENSE_COLLECTION].documents['5fae9573f56f4d5f91b8c02d'].update({}))
Kishore Nallan
07/28/2021, 9:44 AM5fae9573f56f4d5f91b8c02d
in the client code snippet above for both retrieve and update.Mehdi Khlifi
07/28/2021, 9:46 AMKishore Nallan
07/28/2021, 9:47 AMMehdi Khlifi
07/28/2021, 9:48 AMKishore Nallan
07/28/2021, 9:48 AMcurl "<http://localhost:8108/collections/><COLLECTION>/documents/5fae9573f56f4d5f91b8c02d" -X PATCH \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '{}'
Kishore Nallan
07/28/2021, 9:49 AMMehdi Khlifi
07/28/2021, 9:50 AM{ "message": "Not Found"}
Kishore Nallan
07/28/2021, 9:50 AMMehdi Khlifi
07/28/2021, 9:53 AMMehdi Khlifi
07/28/2021, 9:53 AMKishore Nallan
07/28/2021, 9:53 AM{
"message": "Could not find a document with id: 1a"
}
Kishore Nallan
07/28/2021, 9:54 AM{
"message": "Not Found"
}
Mehdi Khlifi
07/28/2021, 9:59 AMretrieve()
it returns the document 😕Kishore Nallan
07/28/2021, 9:59 AMTYPESENSE_COLLECTION
variable name as well?Mehdi Khlifi
07/28/2021, 10:02 AMMehdi Khlifi
07/28/2021, 10:02 AMKishore Nallan
07/28/2021, 10:05 AMKishore Nallan
07/28/2021, 10:08 AMKishore Nallan
07/28/2021, 10:09 AM/debug
Mehdi Khlifi
07/29/2021, 6:39 AMMehdi Khlifi
07/29/2021, 6:40 AMMehdi Khlifi
07/29/2021, 6:40 AMMehdi Khlifi
07/29/2021, 6:42 AM/debug
returns {
"state": 1,
"version": "0.15.0"
}
Kishore Nallan
07/29/2021, 6:44 AMMehdi Khlifi
07/29/2021, 6:56 AMMehdi Khlifi
07/29/2021, 6:56 AMKishore Nallan
07/29/2021, 6:57 AMKishore Nallan
07/29/2021, 6:57 AMKishore Nallan
07/29/2021, 6:58 AMMehdi Khlifi
07/29/2021, 7:23 AM