Dear Solr Team

What happens when you send a partial document update like the following?


{
 "id":"mydoc",
 "price":{"set":99}
}

but no document with the id "mydoc" exists at this moment.

Or what happens if the partial document update is missing the id field?

Or what happens if you send a mixed request, containing fields with modifiers 
and fields containing only the value?

{
 "id":"mydoc",
 "name": "product",
 "price":{"set":99}
}


I personally know that in the first case it acts as an upsert. so inserting the 
document if its missing, and updating it if it already  exists.
And in the second case it always inserts a new document, with its id being 
generated.

For the third case I am not entirely sure, but I think if there is at least one 
field in the request with a modifier the whole request acts as a partial 
document update and fields without modifiers are handled as if they have the 
modifier "set". Thats what the behaviour on solr 9.10.1 looks like at least.

The Documentation does not really explain any of the above cases clearly. This 
also leads to AI making very questionable statements that are just wrong.

https://share.google/aimode/rZE2udrRajAUNDD6y
Google just casually tells us that it only acts as an upsert but ONLY if the 
document already exists in the collection, which is wrong and also does not 
make any sense as that would not be an upsert.

https://chatgpt.com/s/t_6a69f66582dc81919da8e03451e267f1
Also Chatgpt is just wrong about it.

As far as I understand it, partial document updates were introduced in solr 4 
and the upsert behaviour was introduced in solr 4.1. but as its not clearly 
documented I am not 100% sure.
https://stackoverflow.com/questions/14886814/can-solr-perform-an-upsert#comment21025920_14888083

Kind Regards

Reply via email to