vespa icon indicating copy to clipboard operation
vespa copied to clipboard

Feeding an expired document returns 200 OK in /document/v1

Open kkraune opened this issue 5 years ago • 4 comments

When feeding a document that does not match the selection in https://docs.vespa.ai/documentation/reference/services-content.html#document, it is silently dropped.

It is correct that the document is not stored - but the fact that is was not should be returned in the response code when using document/v1 - example POST

curl -X POST -H "Content-Type:application/json" --data-binary @docs.json https://endpoint/document/v1 ...

kkraune avatar Jun 19 '19 09:06 kkraune

We could consider returning 412 Precondition Failed as we do when there's a test-and-set condition mismatch, but the semantics are subtly different enough that it's not 100% obvious that it's the right choice. Documents being dropped as part of the ingest pipeline happens because they do not match the selection criteria of any candidate clusters, i.e. it's a case of "the set of matches is empty" during routing vs. "there is an explicit mismatch" for test-and-set.

vekterli avatar Jun 19 '19 11:06 vekterli

I don't think we should change the status code as everything is OK, but we could return a payload including this information.

bratseth avatar Jun 20 '19 08:06 bratseth

Also note that Update operations through HTTP PUT for a non-existing document also is 200 OK without any payload about document not found so if we touch this please consider adding a payload for that case as well.

jobergum avatar Jun 20 '19 10:06 jobergum

we decided #10209 was hard to to and will prioritize this instead

kkraune avatar Aug 14 '19 12:08 kkraune