Example request
cURL
JavaScript
PHP
Python
Ruby
Go
curl -X POST https://api.skryx.io/v1/multi-search \
-H "Authorization: Bearer $SKRYX_API_KEY" \
-H "Content-Type: application/json" \
-d '
{
"searches": [
{
"index": "products",
"q": "headphones",
"query_by": "title,brand",
"per_page": 5
},
{
"index": "products",
"q": "speakers",
"query_by": "title,brand",
"per_page": 5
},
{
"index": "blog",
"q": "headphone reviews",
"query_by": "title,body",
"per_page": 3
}
]
}
'
const response = await fetch('https://api.skryx.io/v1/multi-search', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.SKRYX_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
searches: [
{
index: 'products',
q: 'headphones',
query_by: 'title,brand',
per_page: 5,
},
{
index: 'products',
q: 'speakers',
query_by: 'title,brand',
per_page: 5,
},
{
index: 'blog',
q: 'headphone reviews',
query_by: 'title,body',
per_page: 3,
}
],
}),
});
const data = await response.json();
<?php
$ch = curl_init('https://api.skryx.io/v1/multi-search');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SKRYX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'searches' => [
0 => [
'index' => 'products',
'q' => 'headphones',
'query_by' => 'title,brand',
'per_page' => 5,
],
1 => [
'index' => 'products',
'q' => 'speakers',
'query_by' => 'title,brand',
'per_page' => 5,
],
2 => [
'index' => 'blog',
'q' => 'headphone reviews',
'query_by' => 'title,body',
'per_page' => 3,
],
],
]),
]);
$response = json_decode(curl_exec($ch), true);
import os
import requests
response = requests.post(
'https://api.skryx.io/v1/multi-search',
headers={
'Authorization': f"Bearer {os.environ['SKRYX_API_KEY']}",
'Content-Type': 'application/json',
},
json={
'searches': [
{
'index': 'products',
'q': 'headphones',
'query_by': 'title,brand',
'per_page': 5,
},
{
'index': 'products',
'q': 'speakers',
'query_by': 'title,brand',
'per_page': 5,
},
{
'index': 'blog',
'q': 'headphone reviews',
'query_by': 'title,body',
'per_page': 3,
}
],
},
)
data = response.json()
require 'net/http'
require 'json'
uri = URI('https://api.skryx.io/v1/multi-search')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri, {
'Authorization' => "Bearer #{ENV['SKRYX_API_KEY']}",
'Content-Type' => 'application/json',
})
request.body = {
'searches' => {
0 => {
'index' => 'products',
'q' => 'headphones',
'query_by' => 'title,brand',
'per_page' => 5,
},
1 => {
'index' => 'products',
'q' => 'speakers',
'query_by' => 'title,brand',
'per_page' => 5,
},
2 => {
'index' => 'blog',
'q' => 'headphone reviews',
'query_by' => 'title,body',
'per_page' => 3,
},
},
}.to_json
response = JSON.parse(http.request(request).body)
package main
import (
"bytes"
"encoding/json"
"io"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]interface{}{
"searches": map[string]interface{}{
"0": map[string]interface{}{
"index": 'products',
"q": 'headphones',
"query_by": 'title,brand',
"per_page": 5,
},
"1": map[string]interface{}{
"index": 'products',
"q": 'speakers',
"query_by": 'title,brand',
"per_page": 5,
},
"2": map[string]interface{}{
"index": 'blog',
"q": 'headphone reviews',
"query_by": 'title,body',
"per_page": 3,
},
},
})
req, _ := http.NewRequest("POST", "https://api.skryx.io/v1/multi-search", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("SKRYX_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
response, _ := io.ReadAll(resp.Body)
_ = response
}