Update in bulk from temporal
Updates a list of items in the temporal index in a single bulk operation.
curl --request PATCH \
--url https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
{
"title": "Adidas Originals Trefoil Hoodie",
"link": "https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/",
"image_link": "https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg",
"id": "1234",
"color": "blue",
"price": 15.99,
"sale_price": 11.99,
"categories": [
"Clothes > Hoodie",
"Men > Hoodie"
]
}
]
'import requests
url = "https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk"
payload = [
{
"title": "Adidas Originals Trefoil Hoodie",
"link": "https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/",
"image_link": "https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg",
"id": "1234",
"color": "blue",
"price": 15.99,
"sale_price": 11.99,
"categories": ["Clothes > Hoodie", "Men > Hoodie"]
}
]
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
title: 'Adidas Originals Trefoil Hoodie',
link: 'https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/',
image_link: 'https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg',
id: '1234',
color: 'blue',
price: 15.99,
sale_price: 11.99,
categories: ['Clothes > Hoodie', 'Men > Hoodie']
}
])
};
fetch('https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk', 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://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
[
'title' => 'Adidas Originals Trefoil Hoodie',
'link' => 'https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/',
'image_link' => 'https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg',
'id' => '1234',
'color' => 'blue',
'price' => 15.99,
'sale_price' => 11.99,
'categories' => [
'Clothes > Hoodie',
'Men > Hoodie'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk"
payload := strings.NewReader("[\n {\n \"title\": \"Adidas Originals Trefoil Hoodie\",\n \"link\": \"https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/\",\n \"image_link\": \"https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg\",\n \"id\": \"1234\",\n \"color\": \"blue\",\n \"price\": 15.99,\n \"sale_price\": 11.99,\n \"categories\": [\n \"Clothes > Hoodie\",\n \"Men > Hoodie\"\n ]\n }\n]")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"title\": \"Adidas Originals Trefoil Hoodie\",\n \"link\": \"https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/\",\n \"image_link\": \"https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg\",\n \"id\": \"1234\",\n \"color\": \"blue\",\n \"price\": 15.99,\n \"sale_price\": 11.99,\n \"categories\": [\n \"Clothes > Hoodie\",\n \"Men > Hoodie\"\n ]\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"title\": \"Adidas Originals Trefoil Hoodie\",\n \"link\": \"https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/\",\n \"image_link\": \"https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg\",\n \"id\": \"1234\",\n \"color\": \"blue\",\n \"price\": 15.99,\n \"sale_price\": 11.99,\n \"categories\": [\n \"Clothes > Hoodie\",\n \"Men > Hoodie\"\n ]\n }\n]"
response = http.request(request)
puts response.read_body{
"results": [
{
"result": "updated",
"id": "1234"
}
],
"errors": false
}{
"error": {
"code": "bad_params",
"message": "Bad parameters error",
"details": [
{
"name": "language",
"fields": [
"language"
],
"reason": "is invalid"
}
]
}
}{
"error": {
"code": "not_authenticated",
"message": "Authentication required"
}
}{
"error": {
"code": "access_denied",
"message": "Access denied"
}
}{
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"error": {
"code": "searchengine_timeout",
"message": "Timeout connecting to backend"
}
}{
"error": {
"code": "searchengine_locked",
"message": "Search engine is being processed"
}
}{
"error": {
"code": "too_many_items",
"message": "Body is too large (max 8 MB)"
}
}{
"error": {
"code": "too_many_items",
"message": "Too many items in bulk request (max 100)"
}
}{
"error": {
"code": "too_many_requests",
"message": "Too many requests"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error"
}
}Authorizations
Doofinder API key. Pass it as: Authorization: Token <api_key>
Path Parameters
Unique id of a search engine.
^[a-f0-9]{32}$Name of an index.
^[a-z][a-z0-9_]*$Body
1 - 100 elementsItem id
This field indicates the group to which this item belongs to. All items with the same group_id will be collapsed into one in search results, returning the most relevant one or the group leader if they all have the same score.
This field indicates the item chosen as the default among its group. It will be returned in search results if there is no other item with a higher score.
(Deprecated) This field indicates the item chosen as the default among its group. It will be returned in search results if there is no other item with a higher score.
A numeric score boosting. It multiplies the natural score of the item for a search. For instance, if boost is greater than 1.0 the item will appear higher in the results. If it is lower than 1.0, it will appear lower. The minimum value is 0.0.
x >= 0This field has special behaviour when Indice has product preset, categories
shall be specified as:
{
...
categories: [
'parent category > inner category > leaft category',
'other parent > other inner > other leaft'
]
}
This way, when using categories field in facets, it will work as expected. When Index has generic preset, this works as normal field but it should be string.
Auto created field that gets the min value between price or sale_price fields, if added in the document.
It gets null if doesn't find any of these fields.
It is not necessary to send this field to index it.
curl --request PATCH \
--url https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
[
{
"title": "Adidas Originals Trefoil Hoodie",
"link": "https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/",
"image_link": "https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg",
"id": "1234",
"color": "blue",
"price": 15.99,
"sale_price": 11.99,
"categories": [
"Clothes > Hoodie",
"Men > Hoodie"
]
}
]
'import requests
url = "https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk"
payload = [
{
"title": "Adidas Originals Trefoil Hoodie",
"link": "https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/",
"image_link": "https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg",
"id": "1234",
"color": "blue",
"price": 15.99,
"sale_price": 11.99,
"categories": ["Clothes > Hoodie", "Men > Hoodie"]
}
]
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
title: 'Adidas Originals Trefoil Hoodie',
link: 'https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/',
image_link: 'https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg',
id: '1234',
color: 'blue',
price: 15.99,
sale_price: 11.99,
categories: ['Clothes > Hoodie', 'Men > Hoodie']
}
])
};
fetch('https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk', 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://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
[
'title' => 'Adidas Originals Trefoil Hoodie',
'link' => 'https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/',
'image_link' => 'https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg',
'id' => '1234',
'color' => 'blue',
'price' => 15.99,
'sale_price' => 11.99,
'categories' => [
'Clothes > Hoodie',
'Men > Hoodie'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk"
payload := strings.NewReader("[\n {\n \"title\": \"Adidas Originals Trefoil Hoodie\",\n \"link\": \"https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/\",\n \"image_link\": \"https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg\",\n \"id\": \"1234\",\n \"color\": \"blue\",\n \"price\": 15.99,\n \"sale_price\": 11.99,\n \"categories\": [\n \"Clothes > Hoodie\",\n \"Men > Hoodie\"\n ]\n }\n]")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"title\": \"Adidas Originals Trefoil Hoodie\",\n \"link\": \"https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/\",\n \"image_link\": \"https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg\",\n \"id\": \"1234\",\n \"color\": \"blue\",\n \"price\": 15.99,\n \"sale_price\": 11.99,\n \"categories\": [\n \"Clothes > Hoodie\",\n \"Men > Hoodie\"\n ]\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-api.doofinder.com/api/v2/search_engines/{hashid}/indices/{name}/temp/items/_bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"title\": \"Adidas Originals Trefoil Hoodie\",\n \"link\": \"https://woocommerce.doofinder.com/product/adidas-originals-trefoil-hoodie/\",\n \"image_link\": \"https://woocommerce.doofinder.com/wp-content/uploads/2024/02/suda-6-scaled.jpg\",\n \"id\": \"1234\",\n \"color\": \"blue\",\n \"price\": 15.99,\n \"sale_price\": 11.99,\n \"categories\": [\n \"Clothes > Hoodie\",\n \"Men > Hoodie\"\n ]\n }\n]"
response = http.request(request)
puts response.read_body{
"results": [
{
"result": "updated",
"id": "1234"
}
],
"errors": false
}{
"error": {
"code": "bad_params",
"message": "Bad parameters error",
"details": [
{
"name": "language",
"fields": [
"language"
],
"reason": "is invalid"
}
]
}
}{
"error": {
"code": "not_authenticated",
"message": "Authentication required"
}
}{
"error": {
"code": "access_denied",
"message": "Access denied"
}
}{
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"error": {
"code": "searchengine_timeout",
"message": "Timeout connecting to backend"
}
}{
"error": {
"code": "searchengine_locked",
"message": "Search engine is being processed"
}
}{
"error": {
"code": "too_many_items",
"message": "Body is too large (max 8 MB)"
}
}{
"error": {
"code": "too_many_items",
"message": "Too many items in bulk request (max 100)"
}
}{
"error": {
"code": "too_many_requests",
"message": "Too many requests"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error"
}
}