Bulk Delete Chunks
curl --request DELETE \
--url https://api.trieve.ai/api/chunk \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TR-Dataset: <tr-dataset>' \
--data '
{
"filter": {
"must": [
{
"field": "tag_set",
"match_all": [
"A",
"B"
]
},
{
"field": "num_value",
"range": {
"gte": 10,
"lte": 25
}
}
]
}
}
'import requests
url = "https://api.trieve.ai/api/chunk"
payload = { "filter": { "must": [
{
"field": "tag_set",
"match_all": ["A", "B"]
},
{
"field": "num_value",
"range": {
"gte": 10,
"lte": 25
}
}
] } }
headers = {
"TR-Dataset": "<tr-dataset>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'TR-Dataset': '<tr-dataset>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filter: {
must: [
{field: 'tag_set', match_all: ['A', 'B']},
{field: 'num_value', range: {gte: 10, lte: 25}}
]
}
})
};
fetch('https://api.trieve.ai/api/chunk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trieve.ai/api/chunk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'filter' => [
'must' => [
[
'field' => 'tag_set',
'match_all' => [
'A',
'B'
]
],
[
'field' => 'num_value',
'range' => [
'gte' => 10,
'lte' => 25
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"TR-Dataset: <tr-dataset>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trieve.ai/api/chunk"
payload := strings.NewReader("{\n \"filter\": {\n \"must\": [\n {\n \"field\": \"tag_set\",\n \"match_all\": [\n \"A\",\n \"B\"\n ]\n },\n {\n \"field\": \"num_value\",\n \"range\": {\n \"gte\": 10,\n \"lte\": 25\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("TR-Dataset", "<tr-dataset>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.trieve.ai/api/chunk")
.header("TR-Dataset", "<tr-dataset>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {\n \"must\": [\n {\n \"field\": \"tag_set\",\n \"match_all\": [\n \"A\",\n \"B\"\n ]\n },\n {\n \"field\": \"num_value\",\n \"range\": {\n \"gte\": 10,\n \"lte\": 25\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trieve.ai/api/chunk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["TR-Dataset"] = '<tr-dataset>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {\n \"must\": [\n {\n \"field\": \"tag_set\",\n \"match_all\": [\n \"A\",\n \"B\"\n ]\n },\n {\n \"field\": \"num_value\",\n \"range\": {\n \"gte\": 10,\n \"lte\": 25\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Bad Request"
}Chunk
Bulk Delete Chunks
Delete multiple chunks using a filter. Auth’ed user or api key must have an admin or owner role for the specified dataset’s organization.
DELETE
/
api
/
chunk
Bulk Delete Chunks
curl --request DELETE \
--url https://api.trieve.ai/api/chunk \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TR-Dataset: <tr-dataset>' \
--data '
{
"filter": {
"must": [
{
"field": "tag_set",
"match_all": [
"A",
"B"
]
},
{
"field": "num_value",
"range": {
"gte": 10,
"lte": 25
}
}
]
}
}
'import requests
url = "https://api.trieve.ai/api/chunk"
payload = { "filter": { "must": [
{
"field": "tag_set",
"match_all": ["A", "B"]
},
{
"field": "num_value",
"range": {
"gte": 10,
"lte": 25
}
}
] } }
headers = {
"TR-Dataset": "<tr-dataset>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'TR-Dataset': '<tr-dataset>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
filter: {
must: [
{field: 'tag_set', match_all: ['A', 'B']},
{field: 'num_value', range: {gte: 10, lte: 25}}
]
}
})
};
fetch('https://api.trieve.ai/api/chunk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trieve.ai/api/chunk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'filter' => [
'must' => [
[
'field' => 'tag_set',
'match_all' => [
'A',
'B'
]
],
[
'field' => 'num_value',
'range' => [
'gte' => 10,
'lte' => 25
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"TR-Dataset: <tr-dataset>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trieve.ai/api/chunk"
payload := strings.NewReader("{\n \"filter\": {\n \"must\": [\n {\n \"field\": \"tag_set\",\n \"match_all\": [\n \"A\",\n \"B\"\n ]\n },\n {\n \"field\": \"num_value\",\n \"range\": {\n \"gte\": 10,\n \"lte\": 25\n }\n }\n ]\n }\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("TR-Dataset", "<tr-dataset>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.trieve.ai/api/chunk")
.header("TR-Dataset", "<tr-dataset>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {\n \"must\": [\n {\n \"field\": \"tag_set\",\n \"match_all\": [\n \"A\",\n \"B\"\n ]\n },\n {\n \"field\": \"num_value\",\n \"range\": {\n \"gte\": 10,\n \"lte\": 25\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trieve.ai/api/chunk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["TR-Dataset"] = '<tr-dataset>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {\n \"must\": [\n {\n \"field\": \"tag_set\",\n \"match_all\": [\n \"A\",\n \"B\"\n ]\n },\n {\n \"field\": \"num_value\",\n \"range\": {\n \"gte\": 10,\n \"lte\": 25\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Bad Request"
}Authorizations
Headers
The dataset id or tracking_id to use for the request. We assume you intend to use an id if the value is a valid uuid.
Body
application/json
JSON request payload to speicy a filter to bulk delete chunks
ChunkFilter is a JSON object which can be used to filter chunks. This is useful for when you want to filter chunks by arbitrary metadata. Unlike with tag filtering, there is a performance hit for filtering on metadata.
Show child attributes
Show child attributes
Example:
{
"must": [
{
"field": "tag_set",
"match_all": ["A", "B"]
},
{
"field": "num_value",
"range": { "gte": 10, "lte": 25 }
}
]
}Response
Confirmation that the chunk with the id specified was deleted
Was this page helpful?
⌘I