Is there a way to update array value in algolia Partial Update Method?

My records are something like this,

objectID: "123123",
product_id: "456456",
categories: ['pie', 'desert']

I want to just replace desert with sweet in categories.

Is this possible by using partial_update_objects method?

Hi @prashanthsoordelu
Yes, it’s possible via the Add operation, which is documented here:

I hope this helps!

Thank you for the answer. I tried it, still I didn’t find a way how to replace a value in the array, how can I specify which array index to update?

Hi @prashanthsoordelu, the method @Youcef linked will add a new unique value to an existing array.

If you are trying to replace a value in an already existing, it will be necessary to send the complete new array in:

  categories: ['pie', 'sweet'],
  objectID: '123123'

Hope that clarifies things!