The route for updating already indexed things is not working

Summary

Thing update does not work.

Steps to reproduce

  1. Index things using a connector (or manually)
  2. try to update the thing using the "update thing route", e.g. using curl:
curl --request PUT   --url http://localhost:3000/THING_TYPE/THING_UID   --header 'content-type: application/json'   --data '{
"uid": "THING_UID",
"type": "THING_TYPE",
...(other fields)
}'

Which version of the software did you use ?

master

What is the current bug behavior?

The backend doesn't update the thing with the given uid (THING_UID). Instead the "Internal server error" occurs.

What is the expected correct behavior?

The backend should update the thing with the given uid (THING_UID). It should replace it with the sent content (thing).

Relevant logs and/or screenshots

e.g. server log:

[ERROR] You tried to PUT an non-existing object. PUT is only supported on existing objects., Error: You tried to PUT an non-existing object. PUT is only supported on existing objects.
    at Elasticsearch.<anonymous> (/home/jovank/Desktop/StApps/backend/lib/storage/elasticsearch/elasticsearch.js:447:19)
    at Generator.next (<anonymous>)
    at fulfilled (/home/jovank/Desktop/StApps/backend/lib/storage/elasticsearch/elasticsearch.js:4:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
PUT /person/62799001-6775-5147-9b9a-e7809effbc7a 502 36.804 ms - 639

Possible fixes

?

cc: @wulkanat @abcdev

Edited by Jovan Krunić