JR
08/26/2024, 6:39 AMFanis Tharropoulos
08/26/2024, 7:04 AMJR
08/26/2024, 7:06 AMMax Priazhevskii
08/26/2024, 7:50 AMJR
08/26/2024, 7:54 AMstring[]
I saved product categories with their names, i now decided to switch to int32[]
category ids, but categories
still exists after dropping, so i can not change the field type to int32[]
My workaround now is: Exporting all data, convert category names to ids, dropping all documents, importing exported & converted data.Max Priazhevskii
08/26/2024, 8:01 AMJR
08/26/2024, 8:03 AMFanis Tharropoulos
08/26/2024, 8:20 AMMax Priazhevskii
08/26/2024, 8:21 AMcategories
field from the schema, the documents still retain it with all the data. Is this the expected behaviour?
curl "<http://localhost:8108/collections>" \
-X POST \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '{
"name": "products",
"fields": [
{"name": "title", "type": "string", "optional": true},
{"name": "categories", "type": "string[]", "optional": true}
]
}'
curl "<http://localhost:8108/collections/products/documents/import?action=upsert>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: text/plain" \
-X POST \
-d '{"id": "1", "title":"Dress", "categories":["Clothing", "Dresses"]}
{"id": "2", "title":"Top", "categories":["Clothing", "Tops"]}'
curl "<http://localhost:8108/collections/products>" \
-X PATCH \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '{
"fields": [
{"name": "categories", "drop": true}
]
}'
curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
"<http://localhost:8108/collections/products/documents/search?q=*>"
Fanis Tharropoulos
08/26/2024, 8:22 AMKishore Nallan
08/26/2024, 8:31 AMMax Priazhevskii
08/26/2024, 8:32 AMFanis Tharropoulos
08/26/2024, 8:32 AMJR
08/26/2024, 8:34 AMKishore Nallan
08/26/2024, 8:35 AMJR
08/26/2024, 8:37 AMcategories: null
would set the categories
to null
not remove them, am I right?Kishore Nallan
08/26/2024, 8:42 AMJR
08/26/2024, 8:44 AMKishore Nallan
08/26/2024, 8:48 AMnull
treats the operations as deletion for updates.JR
08/26/2024, 8:53 AMcategories: null
would delete field categories
in all documents?Kishore Nallan
08/26/2024, 8:58 AMJR
08/26/2024, 8:59 AM