Search code examples
vespa

Detect if document update fails


This update-statement:

curl -v -X PUT 
  -d '{"fields":{"postings":{"assign":42}}}' 
  http://localhost:8080/document/v1/post/post/docid/ABCDEFG

Question: The post "ABCDEFG" does not exist - but the server answers "200 OK". Is there way to detect, that the update statement fails (e.g. getting a "404 NOT FOUND")?


Solution

  • https://docs.vespa.ai/en/reference/document-v1-api-reference.html

    Going by the documentation that is expected behavior. Utilize the condition parameter to determine if the document exists first in order to get a 412 status code instead.