Buscar documentos em uma coleção
curl --request POST \
--url https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"exclude_fields": "<string>",
"facet_by": "<string>",
"facet_query": "<string>",
"filter_by": "<string>",
"highlight_fields": "<string>",
"highlight_full_fields": "<string>",
"include_fields": "<string>",
"max_facet_values": 123,
"num_typos": 123,
"page": 123,
"per_page": 123,
"prefix": true,
"q": "<string>",
"query_by": "<string>",
"sort_by": "<string>"
}
'import requests
url = "https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search"
payload = {
"exclude_fields": "<string>",
"facet_by": "<string>",
"facet_query": "<string>",
"filter_by": "<string>",
"highlight_fields": "<string>",
"highlight_full_fields": "<string>",
"include_fields": "<string>",
"max_facet_values": 123,
"num_typos": 123,
"page": 123,
"per_page": 123,
"prefix": True,
"q": "<string>",
"query_by": "<string>",
"sort_by": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
exclude_fields: '<string>',
facet_by: '<string>',
facet_query: '<string>',
filter_by: '<string>',
highlight_fields: '<string>',
highlight_full_fields: '<string>',
include_fields: '<string>',
max_facet_values: 123,
num_typos: 123,
page: 123,
per_page: 123,
prefix: true,
q: '<string>',
query_by: '<string>',
sort_by: '<string>'
})
};
fetch('https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search', 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://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'exclude_fields' => '<string>',
'facet_by' => '<string>',
'facet_query' => '<string>',
'filter_by' => '<string>',
'highlight_fields' => '<string>',
'highlight_full_fields' => '<string>',
'include_fields' => '<string>',
'max_facet_values' => 123,
'num_typos' => 123,
'page' => 123,
'per_page' => 123,
'prefix' => true,
'q' => '<string>',
'query_by' => '<string>',
'sort_by' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search"
payload := strings.NewReader("{\n \"exclude_fields\": \"<string>\",\n \"facet_by\": \"<string>\",\n \"facet_query\": \"<string>\",\n \"filter_by\": \"<string>\",\n \"highlight_fields\": \"<string>\",\n \"highlight_full_fields\": \"<string>\",\n \"include_fields\": \"<string>\",\n \"max_facet_values\": 123,\n \"num_typos\": 123,\n \"page\": 123,\n \"per_page\": 123,\n \"prefix\": true,\n \"q\": \"<string>\",\n \"query_by\": \"<string>\",\n \"sort_by\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"exclude_fields\": \"<string>\",\n \"facet_by\": \"<string>\",\n \"facet_query\": \"<string>\",\n \"filter_by\": \"<string>\",\n \"highlight_fields\": \"<string>\",\n \"highlight_full_fields\": \"<string>\",\n \"include_fields\": \"<string>\",\n \"max_facet_values\": 123,\n \"num_typos\": 123,\n \"page\": 123,\n \"per_page\": 123,\n \"prefix\": true,\n \"q\": \"<string>\",\n \"query_by\": \"<string>\",\n \"sort_by\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"exclude_fields\": \"<string>\",\n \"facet_by\": \"<string>\",\n \"facet_query\": \"<string>\",\n \"filter_by\": \"<string>\",\n \"highlight_fields\": \"<string>\",\n \"highlight_full_fields\": \"<string>\",\n \"include_fields\": \"<string>\",\n \"max_facet_values\": 123,\n \"num_typos\": 123,\n \"page\": 123,\n \"per_page\": 123,\n \"prefix\": true,\n \"q\": \"<string>\",\n \"query_by\": \"<string>\",\n \"sort_by\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"found": 123,
"hits": [
{}
],
"page": 123,
"request_params": {}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}search
Buscar documentos em uma coleção
Busca documentos em uma coleção
POST
/
api
/
v1
/
typesense
/
collections
/
{collection}
/
documents
/
search
Buscar documentos em uma coleção
curl --request POST \
--url https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"exclude_fields": "<string>",
"facet_by": "<string>",
"facet_query": "<string>",
"filter_by": "<string>",
"highlight_fields": "<string>",
"highlight_full_fields": "<string>",
"include_fields": "<string>",
"max_facet_values": 123,
"num_typos": 123,
"page": 123,
"per_page": 123,
"prefix": true,
"q": "<string>",
"query_by": "<string>",
"sort_by": "<string>"
}
'import requests
url = "https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search"
payload = {
"exclude_fields": "<string>",
"facet_by": "<string>",
"facet_query": "<string>",
"filter_by": "<string>",
"highlight_fields": "<string>",
"highlight_full_fields": "<string>",
"include_fields": "<string>",
"max_facet_values": 123,
"num_typos": 123,
"page": 123,
"per_page": 123,
"prefix": True,
"q": "<string>",
"query_by": "<string>",
"sort_by": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
exclude_fields: '<string>',
facet_by: '<string>',
facet_query: '<string>',
filter_by: '<string>',
highlight_fields: '<string>',
highlight_full_fields: '<string>',
include_fields: '<string>',
max_facet_values: 123,
num_typos: 123,
page: 123,
per_page: 123,
prefix: true,
q: '<string>',
query_by: '<string>',
sort_by: '<string>'
})
};
fetch('https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search', 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://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'exclude_fields' => '<string>',
'facet_by' => '<string>',
'facet_query' => '<string>',
'filter_by' => '<string>',
'highlight_fields' => '<string>',
'highlight_full_fields' => '<string>',
'include_fields' => '<string>',
'max_facet_values' => 123,
'num_typos' => 123,
'page' => 123,
'per_page' => 123,
'prefix' => true,
'q' => '<string>',
'query_by' => '<string>',
'sort_by' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search"
payload := strings.NewReader("{\n \"exclude_fields\": \"<string>\",\n \"facet_by\": \"<string>\",\n \"facet_query\": \"<string>\",\n \"filter_by\": \"<string>\",\n \"highlight_fields\": \"<string>\",\n \"highlight_full_fields\": \"<string>\",\n \"include_fields\": \"<string>\",\n \"max_facet_values\": 123,\n \"num_typos\": 123,\n \"page\": 123,\n \"per_page\": 123,\n \"prefix\": true,\n \"q\": \"<string>\",\n \"query_by\": \"<string>\",\n \"sort_by\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"exclude_fields\": \"<string>\",\n \"facet_by\": \"<string>\",\n \"facet_query\": \"<string>\",\n \"filter_by\": \"<string>\",\n \"highlight_fields\": \"<string>\",\n \"highlight_full_fields\": \"<string>\",\n \"include_fields\": \"<string>\",\n \"max_facet_values\": 123,\n \"num_typos\": 123,\n \"page\": 123,\n \"per_page\": 123,\n \"prefix\": true,\n \"q\": \"<string>\",\n \"query_by\": \"<string>\",\n \"sort_by\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services.pref.rio/go/api/v1/typesense/collections/{collection}/documents/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"exclude_fields\": \"<string>\",\n \"facet_by\": \"<string>\",\n \"facet_query\": \"<string>\",\n \"filter_by\": \"<string>\",\n \"highlight_fields\": \"<string>\",\n \"highlight_full_fields\": \"<string>\",\n \"include_fields\": \"<string>\",\n \"max_facet_values\": 123,\n \"num_typos\": 123,\n \"page\": 123,\n \"per_page\": 123,\n \"prefix\": true,\n \"q\": \"<string>\",\n \"query_by\": \"<string>\",\n \"sort_by\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"found": 123,
"hits": [
{}
],
"page": 123,
"request_params": {}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Nome da coleção
Body
application/json
Parâmetros de busca
⌘I
