eclipse-ditto / ditto

Eclipse Ditto™: Digital Twin framework of Eclipse IoT - main repository
https://eclipse.dev/ditto/
Eclipse Public License 2.0
689 stars 224 forks source link

Bulk updating/deleting things/features via search (RQL) filter #1419

Open thjaeckle opened 2 years ago

thjaeckle commented 2 years ago

Let's assume you manage thousands, hundred of thousands things which shall now e.g. all get an additional attribute or e.g. set a property. In such a case, it would be very cumbersome to a) first find out all of the ids of the things to update b) consume them as a stream of ids c) for each found id, perform another API call applying the update

This would result in thousands or even hundred of thousands API interactions. I think it would (with all of the tools Ditto has gathered) be rather easy to instead provide a bulk update API.

Example:

Example HTTP API

PUT /api/2/bulk/things/attributes/manufacturer?filter=eq(attributes/manufacturer,'Raider')
HTTP payload: "Twix"

Deleting things could work in a very similar way:

DELETE /api/2/bulk/things?filter=eq(attributes/manufacturer,'Raider')

Example Ditto Protocol

{
  "topic": "_/_/things/twin/bulk/modify",
  "headers": {},
  "path": "/attributes/manufacturer",
  "value": {
    "bulkFilter": "eq(attributes/manufacturer,'Raider')"
    "bulkValue": "Twix"
  }
}
Korakbhakta02 commented 4 months ago

HI @thjaeckle is the bulk updating/deleting service present currently in ditto?

thjaeckle commented 4 months ago

No, the issue is still open.