mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 20:16:49 +08:00
Docs: How to use restful API to update or delete metadata (#11912)
### What problem does this PR solve? ### Type of change - [x] Documentation Update
This commit is contained in:
@ -2103,7 +2103,7 @@ Failure:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Dataset metadata summary
|
### Retrieve a metadata summary from a dataset
|
||||||
|
|
||||||
**GET** `/api/v1/datasets/{dataset_id}/metadata/summary`
|
**GET** `/api/v1/datasets/{dataset_id}/metadata/summary`
|
||||||
|
|
||||||
@ -2134,11 +2134,11 @@ Success:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Dataset metadata update
|
### Update or delete metadata
|
||||||
|
|
||||||
**POST** `/api/v1/datasets/{dataset_id}/metadata/update`
|
**POST** `/api/v1/datasets/{dataset_id}/metadata/update`
|
||||||
|
|
||||||
Batch update or delete document-level metadata in a dataset. If both `document_ids` and `metadata_condition` are omitted, all documents in the dataset are selected. When both are provided, the intersection is used.
|
Batch update or delete document-level metadata within a specified dataset. If both `document_ids` and `metadata_condition` are omitted, all documents within that dataset are selected. When both are provided, the intersection is used.
|
||||||
|
|
||||||
#### Request
|
#### Request
|
||||||
|
|
||||||
@ -2148,20 +2148,52 @@ Batch update or delete document-level metadata in a dataset. If both `document_i
|
|||||||
- `'content-Type: application/json'`
|
- `'content-Type: application/json'`
|
||||||
- `'Authorization: Bearer <YOUR_API_KEY>'`
|
- `'Authorization: Bearer <YOUR_API_KEY>'`
|
||||||
- Body:
|
- Body:
|
||||||
- `selector`: `object`, optional
|
- `selector`: `object`
|
||||||
- `document_ids`: `list[string]`, optional
|
- `updates`: `list[object]`
|
||||||
- `metadata_condition`: `object`, optional
|
- `deletes`: `list[object]`
|
||||||
- `logic`: `"and"` (default) or `"or"`
|
|
||||||
- `conditions`: array of `{ "name": string, "comparison_operator": string, "value": string }`
|
#### Request parameters
|
||||||
- `comparison_operator` supports: `is`, `not is`, `contains`, `not contains`, `in`, `not in`, `start with`, `end with`, `>`, `<`, `≥`, `≤`, `empty`, `not empty`
|
|
||||||
- `updates`: `array`, optional
|
- `dataset_id`: (*Path parameter*)
|
||||||
- items: `{ "key": string, "value": any, "match": any (optional) }`
|
The associated dataset ID.
|
||||||
- For lists: replace elements equal to `match` (or `value` when `match` omitted) with `value`.
|
- `"selector"`: (*Body parameter*), `object`, *optional*
|
||||||
- For scalars: replace when current value equals `match` (or `value` when `match` omitted).
|
A document selector:
|
||||||
- `deletes`: `array`, optional
|
- `"document_ids"`: `list[string]` *optional*
|
||||||
- items: `{ "key": string, "value": any (optional) }`
|
The associated document ID.
|
||||||
- For lists: remove elements equal to `value`; if list becomes empty, remove the key.
|
- `"metadata_condition"`: `object`, *optional*
|
||||||
- For scalars: remove the key when `value` matches or when `value` is omitted.
|
- `"logic"`: Defines the logic relation between conditions if multiple conditions are provided. Options:
|
||||||
|
- `"and"` (default)
|
||||||
|
- `"or"`
|
||||||
|
- `"conditions"`: `list[object]` *optional*
|
||||||
|
Each object: `{ "name": string, "comparison_operator": string, "value": string }`
|
||||||
|
- `"name"`: `string` The key name to search by.
|
||||||
|
- `"comparison_operator"`: `string` Available options:
|
||||||
|
- `"is"`
|
||||||
|
- `"not is"`
|
||||||
|
- `"contains"`
|
||||||
|
- `"not contains"`
|
||||||
|
- `"in"`
|
||||||
|
- `"not in"`
|
||||||
|
- `"start with"`
|
||||||
|
- `"end with"`
|
||||||
|
- `">"`
|
||||||
|
- `"<"`
|
||||||
|
- `"≥"`
|
||||||
|
- `"≤"`
|
||||||
|
- `"empty"`
|
||||||
|
- `"not empty"`
|
||||||
|
- `"value"`: `string` The key value to search by.
|
||||||
|
- `"updates"`: (*Body parameter*), `list[object]`, *optional*
|
||||||
|
Replaces metadata of the retrieved documents. Each object: `{ "key": string, "match": string, "value": string }`.
|
||||||
|
- `"key"`: `string` The name of the key to update.
|
||||||
|
- `"match"`: `string` *optional* The current value of the key to update. When omitted, the corresponding keys are updated to `"value"` regardless of their current values.
|
||||||
|
- `"value"`: `string` The new value to set for the specified keys.
|
||||||
|
- `"deletes`: (*Body parameter*), `list[ojbect]`, *optional*
|
||||||
|
Deletes metadata of the retrieved documents. Each object: `{ "key": string, "value": string }`.
|
||||||
|
- `"key"`: `string` The name of the key to delete.
|
||||||
|
- `"value"`: `string` *Optional* The value of the key to delete.
|
||||||
|
- When provided, only keys with a matching value are deleted.
|
||||||
|
- When omitted, all specified keys are deleted.
|
||||||
|
|
||||||
##### Request example
|
##### Request example
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user