Update Document: Append to/Remove Array/Object #522
Replies: 4 comments 1 reply
-
So it seems like theres no way to append or remove items from array, then it has to be updated with full list on every update? |
Beta Was this translation helpful? Give feedback.
-
@intoxicated I'm moving your messages from #568 in this discussion. "I'm trying to migrate from Algolia to meilisearch, but I have been struggling to find a way to add unique element to array type. { Algolia provides a way to add unique element to array field with batch like { "or maybe like https://discuss.elastic.co/t/how-to-update-a-object-within-array-in-elastic-search/20115/8" |
Beta Was this translation helpful? Give feedback.
-
Hey, I got a similar use case as mentioned in discussion#3458 I have a scraper to scrape product details. The fields to update are dynamic and can be in nested object. Currently I have to fetch the whole product document, deep merge it with scraped data, then send the document back to Meilisearch. e.g. if I have a document like this {
"price": {
"current": 3000,
"currency": "USD"
}
} And I do the update with this payload {
"price": {
"current": 4000
}
} The document should be updated like this {
"price": {
"current": 4000,
"currency": "USD"
}
} Or I do the update with this payload {
"price": {
"sale": 2000
}
} The document should be updated like this {
"price": {
"current": 3000,
"currency": "USD",
"sale": 2000
}
} I object to support the same feature for removing the field in object, appending/ removing item in array. These actions are very hard to describe/ understand in simple data json payload, they should be done in application before sending to Meilisearch. e.g. if you have a document like this {
"tmpArray": [1, 2 ,3]
} And you update with this payload {
"tmpArray": ["a", "b", "c"]
} Are you expecting the engine to replace the value or append the value? To support these conveniences, I assume that the payload of update document api will have breaking changes. |
Beta Was this translation helpful? Give feedback.
-
I am also looking for the same feature. |
Beta Was this translation helpful? Give feedback.
-
meilisearch/meilisearch#2693
meilisearch/meilisearch#2694
Created by @geoffatsource
"Is it possible to append to an existing array or object in a document? And relatedly, is there a way to remove?
My particular use-case is that I want to be able to "tag" documents without having to know the existing tags already assigned to those documents."
"Is there a way to completely delete a field in an existing document without replacing the entire document?"
Beta Was this translation helpful? Give feedback.
All reactions