Search
Search via Typesense
Run full-text search across your ledger data with the Go SDK.
POST
/
search
/
{collection}
Search via Typesense
curl --request POST \
--url http://localhost:5001/search/{collection} \
--header 'X-blnk-key: <api-key>'import requests
url = "http://localhost:5001/search/{collection}"
headers = {"X-blnk-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'X-blnk-key': '<api-key>'}};
fetch('http://localhost:5001/search/{collection}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "5001",
CURLOPT_URL => "http://localhost:5001/search/{collection}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-blnk-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:5001/search/{collection}"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-blnk-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:5001/search/{collection}")
.header("X-blnk-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:5001/search/{collection}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-blnk-key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyUse
Go response (
client.Search.SearchDocument to search records in a collection.
1
Call the method
client.Search.SearchDocument
searchResult, resp, err := client.Search.SearchDocument(
blnkgo.SearchParams{
Q: "payment",
QueryBy: "description",
PerPage: 20,
},
blnkgo.Transactions,
)
| Field | Type | Description |
|---|---|---|
Q | string | Search query text. Use * to return all records. |
QueryBy | string | Comma-separated list of fields to search in. |
FilterBy | string | Filter conditions to refine results. |
SortBy | string | Sort order, for example created_at:desc. |
Page | int | Page number, starting at 1. |
PerPage | int | Results per page. Max 250, defaults to 10. |
resource | blnkgo.ResourceType | Collection to search: Transactions, Balances, Ledgers, or Identities. |
2
Response
201 Created
{
"found": 2,
"out_of": 232,
"page": 1,
"request_params": {
"collection_name": "transactions",
"per_page": 10,
"q": "payment"
},
"search_time_ms": 2,
"facet_counts": [],
"search_cutoff": false,
"hits": [
{
"document": {
"id": "txn_cd728825-a6e1-4fae-9277-c3235a045ea5",
"transaction_id": "txn_cd728825-a6e1-4fae-9277-c3235a045ea5",
"amount": 532,
"currency": "USD",
"description": "Test transaction",
"source": "bln_93fb50c2-969e-49c2-bb61-ef5ed245516e",
"destination": "bln_20666087-1355-4736-ba04-3ba92a7542b9",
"status": "APPLIED",
"created_at": 1758116489
},
"highlights": [],
"text_match": 578730123365711993
}
]
}
Go response (*blnkgo.SearchResponse)
| Field | Type | Description |
|---|---|---|
Found | int | Number of records matching the query. |
OutOf | int | Total records in the collection. |
Page | int | Current page number. |
SearchTimeMs | int | Time taken to run the search, in milliseconds. |
Hits | []blnkgo.SearchHit | Array of results, each with a Document field. |
Need help?
We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool. To ask questions or discuss issues, please contact us or join our Discord community.Was this page helpful?
⌘I