diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 0000000..f0ccbc9
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,2 @@
+[alias]
+xtask = "run --package xtask --"
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0356dc7..4e0fb4e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,26 +1,40 @@
name: CI
on:
+ workflow_dispatch:
push:
branches:
- main
+ paths-ignore:
+ - '**/*.md'
pull_request:
branches:
- main
+ paths-ignore:
+ - '**/*.md'
jobs:
tests:
- runs-on: "${{ matrix.platform.os }}-latest"
+ runs-on: '${{ matrix.platform.os }}-latest'
strategy:
matrix:
- platform: [
- { os: "ubuntu", target: "x86_64-unknown-linux-gnu" },
- { os: "ubuntu", target: "wasm32-unknown-unknown" },
- ]
- env:
- # used to connect to httpmock
- URL: "http://localhost:5000"
- API_KEY: "VerySecretKey"
+ platform:
+ [
+ { os: 'ubuntu', target: 'x86_64-unknown-linux-gnu' },
+ { os: 'ubuntu', target: 'wasm32-unknown-unknown' },
+ ]
+ services:
+ typesense:
+ image: typesense/typesense:29.0
+ ports:
+ - 8108:8108/tcp
+ volumes:
+ - /tmp/typesense-server-data:/data
+ env:
+ TYPESENSE_DATA_DIR: '/data'
+ TYPESENSE_API_KEY: 'xyz'
+ TYPESENSE_ENABLE_CORS: true
+ TYPESENSE_URL: 'http://localhost:8108'
steps:
- uses: actions/checkout@v4
- name: Cache .cargo and target
@@ -38,21 +52,14 @@ jobs:
target: ${{ matrix.platform.target }}
profile: minimal
default: true
- - name: Install httpmock
- uses: actions-rs/cargo@v1
- with:
- command: install
- args: --features standalone -- httpmock
- - name: Run httpmock
- run: httpmock --expose --mock-files-dir=./mocks &
- name: Install test runner for wasm
if: matrix.platform.target == 'wasm32-unknown-unknown'
- run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
+ run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Stable Build
uses: actions-rs/cargo@v1
with:
command: build
- args: --all-features --target ${{ matrix.platform.target }}
+ args: --all-features --package typesense --target ${{ matrix.platform.target }}
- name: Tests
if: matrix.platform.target != 'wasm32-unknown-unknown'
uses: actions-rs/cargo@v1
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 0527114..f5084e7 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,16 +1,23 @@
name: Lint checks
on:
+ workflow_dispatch:
push:
- branches: [ main ]
+ branches:
+ - main
+ paths-ignore:
+ - '**/*.md'
pull_request:
- branches: [ main ]
+ branches:
+ - main
+ paths-ignore:
+ - '**/*.md'
jobs:
lint:
runs-on: ubuntu-latest
env:
- TZ: "/usr/share/zoneinfo/your/location"
+ TZ: '/usr/share/zoneinfo/your/location'
steps:
- uses: actions/checkout@v4
- name: Cache .cargo and target
diff --git a/.gitignore b/.gitignore
index e551aa3..8d7229e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
/target
Cargo.lock
.env
+/typesense-data
\ No newline at end of file
diff --git a/Cargo.toml b/Cargo.toml
index a378f77..23adab9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,8 @@
members = [
"typesense",
"typesense_derive",
- "typesense_codegen"
+ "typesense_codegen",
+ "xtask",
]
resolver = "3"
diff --git a/compose.yml b/compose.yml
new file mode 100644
index 0000000..c77de65
--- /dev/null
+++ b/compose.yml
@@ -0,0 +1,9 @@
+services:
+ typesense:
+ image: typesense/typesense:29.0
+ restart: on-failure
+ ports:
+ - '8108:8108'
+ volumes:
+ - ./typesense-data:/data
+ command: '--data-dir /data --api-key=xyz --enable-cors'
diff --git a/openapi.yml b/openapi.yml
index 3bac4f6..3c23cba 100644
--- a/openapi.yml
+++ b/openapi.yml
@@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Typesense API
description: "An open source search engine for building delightful search experiences."
- version: 0.25.0
+ version: '28.0'
externalDocs:
description: Find out more about Typsesense
url: https://typesense.org
@@ -19,8 +19,8 @@ tags:
externalDocs:
description: Find out more
url: https://typesense.org/api/#index-document
- - name: promote
- description: Promote certain documents over others
+ - name: curation
+ description: Hand-curate search results based on conditional business rules
externalDocs:
description: Find out more
url: https://typesense.org/docs/0.23.0/api/#curation
@@ -28,7 +28,7 @@ tags:
description: Typesense can aggregate search queries for both analytics purposes and for query suggestions.
externalDocs:
description: Find out more
- url: https://typesense.org/docs/0.25.0/api/analytics-query-suggestions.html
+ url: https://typesense.org/docs/28.0/api/analytics-query-suggestions.html
- name: keys
description: Manage API Keys with fine-grain access control
externalDocs:
@@ -40,8 +40,37 @@ tags:
description: Manage Typesense cluster
externalDocs:
description: Find out more
- url: https://typesense.org/docs/0.23.0/api/#cluster-operations
-
+ url: https://typesense.org/docs/28.0/api/cluster-operations.html
+ - name: stopwords
+ description: Manage stopwords sets
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/stopwords.html
+ - name: presets
+ description: Store and reference search parameters
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/search.html#presets
+ - name: conversations
+ description: Conversational Search (RAG)
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/conversational-search-rag.html
+ - name: synonyms
+ description: Manage synonyms
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/synonyms.html
+ - name: stemming
+ description: Manage stemming dictionaries
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/stemming.html
+ - name: nl_search_models
+ description: Manage NL search models
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/29.0/api/natural-language-search.html
paths:
/collections:
get:
@@ -54,7 +83,7 @@ paths:
first.
operationId: getCollections
responses:
- 200:
+ '200':
description: List of all collections
content:
application/json:
@@ -79,19 +108,19 @@ paths:
$ref: "#/components/schemas/CollectionSchema"
required: true
responses:
- 201:
+ '201':
description: Collection successfully created
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionResponse"
- 400:
+ '400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
- 409:
+ '409':
description: Collection already exists
content:
application/json:
@@ -112,13 +141,13 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: Collection fetched
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionResponse"
- 404:
+ '404':
description: Collection not found
content:
application/json:
@@ -146,19 +175,19 @@ paths:
$ref: "#/components/schemas/CollectionUpdateSchema"
required: true
responses:
- 200:
+ '200':
description: The updated partial collection schema
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionUpdateSchema"
- 400:
+ '400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
- 404:
+ '404':
description: The collection was not found
content:
application/json:
@@ -180,13 +209,13 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: Collection deleted
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionResponse"
- 404:
+ '404':
description: Collection not found
content:
application/json:
@@ -214,8 +243,12 @@ paths:
schema:
type: string
example: upsert
- enum:
- - upsert
+ $ref: "#/components/schemas/IndexAction"
+ - name: dirty_values
+ in: query
+ description: Dealing with Dirty Data
+ schema:
+ $ref: "#/components/schemas/DirtyValues"
requestBody:
description: The document object to be indexed
content:
@@ -226,14 +259,14 @@ paths:
x-go-type: "interface{}"
required: true
responses:
- 201:
+ '201':
description: Document successfully created/indexed
content:
application/json:
schema:
type: object
description: Can be any key-value pair
- 404:
+ '404':
description: Collection not found
content:
application/json:
@@ -320,6 +353,8 @@ paths:
in: query
schema:
type: object
+ required:
+ - filter_by
properties:
filter_by:
type: string
@@ -330,8 +365,13 @@ paths:
at a time. A larger value will speed up deletions, but will impact performance
of other operations running on the server.
type: integer
+ ignore_not_found:
+ type: boolean
+ truncate:
+ description: When true, removes all documents from the collection while preserving the collection and its schema.
+ type: boolean
responses:
- 200:
+ '200':
description: Documents successfully deleted
content:
application/json:
@@ -342,7 +382,7 @@ paths:
properties:
num_deleted:
type: integer
- 404:
+ '404':
description: Collection not found
content:
application/json:
@@ -368,19 +408,19 @@ paths:
schema:
$ref: "#/components/schemas/SearchParameters"
responses:
- 200:
+ '200':
description: Search results
content:
application/json:
schema:
$ref: "#/components/schemas/SearchResult"
- 400:
+ '400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
- 404:
+ '404':
description: The collection or field was not found
content:
application/json:
@@ -390,7 +430,7 @@ paths:
get:
tags:
- documents
- - promote
+ - curation
summary: List all collection overrides
operationId: getSearchOverrides
parameters:
@@ -401,7 +441,7 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: List of all search overrides
content:
application/json:
@@ -429,7 +469,7 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: Search override fetched
content:
application/json:
@@ -438,7 +478,7 @@ paths:
put:
tags:
- documents
- - promote
+ - curation
summary: Create or update an override to promote certain documents over others
description:
Create or update an override to promote certain documents over others.
@@ -465,13 +505,13 @@ paths:
$ref: "#/components/schemas/SearchOverrideSchema"
required: true
responses:
- 200:
+ '200':
description: Created/updated search override
content:
application/json:
schema:
$ref: "#/components/schemas/SearchOverride"
- 404:
+ '404':
description: Search override not found
content:
application/json:
@@ -480,7 +520,7 @@ paths:
delete:
tags:
- documents
- - promote
+ - curation
summary: Delete an override associated with a collection
operationId: deleteSearchOverride
parameters:
@@ -497,13 +537,13 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: The ID of the deleted search override
content:
application/json:
schema:
- $ref: "#/components/schemas/SearchOverride"
- 404:
+ $ref: "#/components/schemas/SearchOverrideDeleteResponse"
+ '404':
description: Search override not found
content:
application/json:
@@ -512,7 +552,7 @@ paths:
/collections/{collectionName}/synonyms:
get:
tags:
- - documents
+ - synonyms
summary: List all collection synonyms
operationId: getSearchSynonyms
parameters:
@@ -523,13 +563,13 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: List of all search synonyms
content:
application/json:
schema:
$ref: "#/components/schemas/SearchSynonymsResponse"
- 404:
+ '404':
description: Search synonyms was not found
content:
application/json:
@@ -538,7 +578,7 @@ paths:
/collections/{collectionName}/synonyms/{synonymId}:
get:
tags:
- - documents
+ - synonyms
summary: Retrieve a single search synonym
description: Retrieve the details of a search synonym, given its id.
operationId: getSearchSynonym
@@ -556,13 +596,13 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: Search synonym fetched
content:
application/json:
schema:
$ref: "#/components/schemas/SearchSynonym"
- 404:
+ '404':
description: Search synonym was not found
content:
application/json:
@@ -570,7 +610,7 @@ paths:
$ref: "#/components/schemas/ApiResponse"
put:
tags:
- - documents
+ - synonyms
summary: Create or update a synonym
description: Create or update a synonym to define search terms that should be considered equivalent.
operationId: upsertSearchSynonym
@@ -595,13 +635,13 @@ paths:
$ref: "#/components/schemas/SearchSynonymSchema"
required: true
responses:
- 200:
+ '200':
description: Created/updated search synonym
content:
application/json:
schema:
$ref: "#/components/schemas/SearchSynonym"
- 404:
+ '404':
description: Search synonym was not found
content:
application/json:
@@ -609,7 +649,7 @@ paths:
$ref: "#/components/schemas/ApiResponse"
delete:
tags:
- - documents
+ - synonyms
summary: Delete a synonym associated with a collection
operationId: deleteSearchSynonym
parameters:
@@ -626,13 +666,13 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: The ID of the deleted search synonym
content:
application/json:
schema:
- $ref: "#/components/schemas/SearchSynonym"
- 404:
+ $ref: "#/components/schemas/SearchSynonymDeleteResponse"
+ '404':
description: Search synonym not found
content:
application/json:
@@ -657,9 +697,6 @@ paths:
in: query
schema:
type: object
- required:
- - include_fields
- - exclude_fields
properties:
filter_by:
description:
@@ -674,7 +711,7 @@ paths:
type: string
responses:
- 200:
+ '200':
description: Exports all the documents in a given collection.
content:
application/octet-stream:
@@ -684,7 +721,7 @@ paths:
{"id": "124", "company_name": "Stark Industries", "num_employees": 5215, "country": "US"}
{"id": "125", "company_name": "Future Technology", "num_employees": 1232,"country": "UK"}
{"id": "126", "company_name": "Random Corp.", "num_employees": 531,"country": "AU"}
- 404:
+ '404':
description: The collection was not found
content:
application/json:
@@ -707,24 +744,28 @@ paths:
required: true
schema:
type: string
+ # Do not change the index position of this param
- name: importDocumentsParameters
in: query
schema:
type: object
properties:
- action:
- type: string
batch_size:
type: integer
- dirty_values:
- type: string
- enum:
- - coerce_or_reject
- - coerce_or_drop
- - drop
- - reject
+ return_id:
+ type: boolean
+ description:
+ Returning the id of the imported documents. If you want the
+ import response to return the ingested document's id in the
+ response, you can use the return_id parameter.
remote_embedding_batch_size:
type: integer
+ return_doc:
+ type: boolean
+ action:
+ $ref: "#/components/schemas/IndexAction"
+ dirty_values:
+ $ref: "#/components/schemas/DirtyValues"
requestBody:
description: The json array of documents or the JSONL file to import
content:
@@ -734,7 +775,7 @@ paths:
description: The JSONL file to import
required: true
responses:
- 200:
+ '200':
description:
Result of the import operation. Each line of the response indicates the result
of each document present in the request body (in the same order). If the import
@@ -748,13 +789,13 @@ paths:
example: |
{"success": true}
{"success": false, "error": "Bad JSON.", "document": "[bad doc"}
- 400:
+ '400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
- 404:
+ '404':
description: The collection was not found
content:
application/json:
@@ -781,14 +822,14 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: The document referenced by the ID
content:
application/json:
schema:
type: object
description: Can be any key-value pair
- 404:
+ '404':
description: The document or collection was not found
content:
application/json:
@@ -815,6 +856,11 @@ paths:
required: true
schema:
type: string
+ - name: dirty_values
+ in: query
+ description: Dealing with Dirty Data
+ schema:
+ $ref: "#/components/schemas/DirtyValues"
requestBody:
description: The document object with fields to be updated
content:
@@ -825,14 +871,14 @@ paths:
x-go-type: "interface{}"
required: true
responses:
- 200:
+ '200':
description: The document referenced by the ID was updated
content:
application/json:
schema:
type: object
description: Can be any key-value pair
- 404:
+ '404':
description: The document or collection was not found
content:
application/json:
@@ -858,19 +904,127 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: The document referenced by the ID was deleted
content:
application/json:
schema:
type: object
description: Can be any key-value pair
- 404:
+ '404':
description: The document or collection was not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
+ /conversations/models:
+ get:
+ description: Retrieve all conversation models
+ operationId: retrieveAllConversationModels
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ items:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ type: array
+ x-go-type: '[]*ConversationModelSchema'
+ description: List of all conversation models
+ summary: List all conversation models
+ tags:
+ - conversations
+ post:
+ description: Create a Conversation Model
+ operationId: createConversationModel
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelCreateSchema'
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ description: Created Conversation Model
+ '400':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ description: Bad request, see error message for details
+ tags:
+ - conversations
+ /conversations/models/{modelId}:
+ get:
+ description: Retrieve a conversation model
+ operationId: retrieveConversationModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The id of the conversation model to retrieve
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ description: A conversation model
+ summary: Retrieve a conversation model
+ tags:
+ - conversations
+ put:
+ description: Update a conversation model
+ operationId: updateConversationModel
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelUpdateSchema'
+ required: true
+ parameters:
+ - name: modelId
+ in: path
+ description: The id of the conversation model to update
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ description: The conversation model was successfully updated
+ summary: Update a conversation model
+ tags:
+ - conversations
+ delete:
+ description: Delete a conversation model
+ operationId: deleteConversationModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The id of the conversation model to delete
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ description: The conversation model was successfully deleted
+ summary: Delete a conversation model
+ tags:
+ - conversations
/keys:
get:
tags:
@@ -878,7 +1032,7 @@ paths:
summary: Retrieve (metadata about) all keys.
operationId: getKeys
responses:
- 200:
+ '200':
description: List of all keys
content:
application/json:
@@ -901,19 +1055,19 @@ paths:
schema:
$ref: "#/components/schemas/ApiKeySchema"
responses:
- 201:
+ '201':
description: Created API key
content:
application/json:
schema:
$ref: "#/components/schemas/ApiKey"
- 400:
+ '400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
- 409:
+ '409':
description: API key generation conflict
content:
application/json:
@@ -938,13 +1092,13 @@ paths:
type: integer
format: int64
responses:
- 200:
+ '200':
description: The key referenced by the ID
content:
application/json:
schema:
$ref: "#/components/schemas/ApiKey"
- 404:
+ '404':
description: The key was not found
content:
application/json:
@@ -964,19 +1118,19 @@ paths:
type: integer
format: int64
responses:
- 200:
+ '200':
description: The key referenced by the ID
content:
application/json:
schema:
- $ref: "#/components/schemas/ApiKey"
- 400:
+ $ref: "#/components/schemas/ApiKeyDeleteResponse"
+ '400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
- 404:
+ '404':
description: Key not found
content:
application/json:
@@ -990,7 +1144,7 @@ paths:
description: List all aliases and the corresponding collections that they map to.
operationId: getAliases
responses:
- 200:
+ '200':
description: List of all collection aliases
content:
application/json:
@@ -1022,19 +1176,19 @@ paths:
schema:
$ref: "#/components/schemas/CollectionAliasSchema"
responses:
- 200:
+ '200':
description: The collection alias was created/updated
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionAlias"
- 400:
+ '400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
- 404:
+ '404':
description: Alias not found
content:
application/json:
@@ -1054,13 +1208,13 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: Collection alias fetched
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionAlias"
- 404:
+ '404':
description: The alias was not found
content:
application/json:
@@ -1079,13 +1233,13 @@ paths:
schema:
type: string
responses:
- 200:
+ '200':
description: Collection alias was deleted
content:
application/json:
schema:
$ref: "#/components/schemas/CollectionAlias"
- 404:
+ '404':
description: Alias not found
content:
application/json:
@@ -1099,7 +1253,7 @@ paths:
description: Print debugging information
operationId: debug
responses:
- 200:
+ '200':
description: Debugging information
content:
application/json:
@@ -1116,12 +1270,28 @@ paths:
description: Checks if Typesense server is ready to accept requests.
operationId: health
responses:
- 200:
+ '200':
description: Search service is ready for requests.
content:
application/json:
schema:
$ref: "#/components/schemas/HealthStatus"
+ /operations/schema_changes:
+ get:
+ tags:
+ - operations
+ summary: Get the status of in-progress schema change operations
+ description: Returns the status of any ongoing schema change operations. If no schema changes are in progress, returns an empty response.
+ operationId: getSchemaChanges
+ responses:
+ '200':
+ description: List of schema changes in progress
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: "#/components/schemas/SchemaChangeStatus"
/operations/snapshot:
post:
tags:
@@ -1140,7 +1310,7 @@ paths:
schema:
type: string
responses:
- 201:
+ '201':
description: Snapshot is created.
content:
application/json:
@@ -1157,7 +1327,7 @@ paths:
once this command succeeds.
operationId: vote
responses:
- 200:
+ '200':
description: Re-election is performed.
content:
application/json:
@@ -1184,18 +1354,45 @@ paths:
schema:
$ref: "#/components/schemas/MultiSearchSearchesParameter"
responses:
- 200:
+ '200':
description: Search results
content:
application/json:
schema:
$ref: "#/components/schemas/MultiSearchResult"
- 400:
+ '400':
description: Bad request, see error message for details
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
+ /analytics/events:
+ post:
+ tags:
+ - analytics
+ summary: Create an analytics event
+ description: Sending events for analytics e.g rank search results based on popularity.
+ operationId: createAnalyticsEvent
+ requestBody:
+ description: The Analytics event to be created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsEventCreateSchema'
+ required: true
+ responses:
+ '201':
+ description: Analytics event successfully created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsEventCreateResponse'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
/analytics/rules:
post:
tags:
@@ -1212,13 +1409,13 @@ paths:
$ref: "#/components/schemas/AnalyticsRuleSchema"
required: true
responses:
- 201:
+ '201':
description: Analytics rule successfully created
content:
application/json:
schema:
$ref: "#/components/schemas/AnalyticsRuleSchema"
- 400:
+ '400':
description: Bad request, see error message for details
content:
application/json:
@@ -1232,13 +1429,47 @@ paths:
Retrieve the details of all analytics rules
operationId: retrieveAnalyticsRules
responses:
- 200:
+ '200':
description: Analytics rules fetched
content:
application/json:
schema:
$ref: "#/components/schemas/AnalyticsRulesRetrieveSchema"
/analytics/rules/{ruleName}:
+ put:
+ tags:
+ - analytics
+ summary: Upserts an analytics rule
+ description:
+ Upserts an analytics rule with the given name.
+ operationId: upsertAnalyticsRule
+ parameters:
+ - in: path
+ name: ruleName
+ description: The name of the analytics rule to upsert
+ schema:
+ type: string
+ required: true
+ requestBody:
+ description: The Analytics rule to be upserted
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/AnalyticsRuleUpsertSchema"
+ required: true
+ responses:
+ '200':
+ description: Analytics rule successfully upserted
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/AnalyticsRuleSchema"
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiResponse"
get:
tags:
- analytics
@@ -1254,13 +1485,13 @@ paths:
type: string
required: true
responses:
- 200:
+ '200':
description: Analytics rule fetched
content:
application/json:
schema:
$ref: "#/components/schemas/AnalyticsRuleSchema"
- 404:
+ '404':
description: Analytics rule not found
content:
application/json:
@@ -1281,47 +1512,520 @@ paths:
type: string
required: true
responses:
- 200:
+ '200':
description: Analytics rule deleted
content:
application/json:
schema:
- $ref: "#/components/schemas/AnalyticsRuleSchema"
- 404:
+ $ref: "#/components/schemas/AnalyticsRuleDeleteResponse"
+ '404':
description: Analytics rule not found
content:
application/json:
schema:
$ref: "#/components/schemas/ApiResponse"
-components:
- schemas:
- CollectionSchema:
- required:
- - name
- - fields
- type: object
- properties:
- name:
- type: string
- description: Name of the collection
- example: companies
- fields:
- type: array
- description: A list of fields for querying, filtering and faceting
- example:
- - name: num_employees
- type: int32
- facet: false
- - name: company_name
- type: string
- facet: false
- - name: country
- type: string
- facet: true
- items:
- $ref: "#/components/schemas/Field"
- default_sorting_field:
- type: string
+ /metrics.json:
+ get:
+ tags:
+ - operations
+ summary: Get current RAM, CPU, Disk & Network usage metrics.
+ description:
+ Retrieve the metrics.
+ operationId: retrieveMetrics
+ responses:
+ '200':
+ description: Metrics fetched.
+ content:
+ application/json:
+ schema:
+ type: object
+ /stats.json:
+ get:
+ tags:
+ - operations
+ summary: Get stats about API endpoints.
+ description:
+ Retrieve the stats about API endpoints.
+ operationId: retrieveAPIStats
+ responses:
+ '200':
+ description: Stats fetched.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/APIStatsResponse"
+ /stopwords:
+ get:
+ tags:
+ - stopwords
+ summary: Retrieves all stopwords sets.
+ description:
+ Retrieve the details of all stopwords sets
+ operationId: retrieveStopwordsSets
+ responses:
+ '200':
+ description: Stopwords sets fetched.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/StopwordsSetsRetrieveAllSchema"
+ /stopwords/{setId}:
+ put:
+ tags:
+ - stopwords
+ summary: Upserts a stopwords set.
+ description:
+ When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection.
+ operationId: upsertStopwordsSet
+ parameters:
+ - in: path
+ name: setId
+ description: The ID of the stopwords set to upsert.
+ schema:
+ type: string
+ required: true
+ example: countries
+ requestBody:
+ description: The stopwords set to upsert.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/StopwordsSetUpsertSchema"
+ required: true
+ responses:
+ '200':
+ description: Stopwords set successfully upserted.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/StopwordsSetSchema"
+ '400':
+ description: Bad request, see error message for details.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiResponse"
+ get:
+ tags:
+ - stopwords
+ summary: Retrieves a stopwords set.
+ description:
+ Retrieve the details of a stopwords set, given it's name.
+ operationId: retrieveStopwordsSet
+ parameters:
+ - in: path
+ name: setId
+ description: The ID of the stopwords set to retrieve.
+ schema:
+ type: string
+ required: true
+ example: countries
+ responses:
+ '200':
+ description: Stopwords set fetched.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/StopwordsSetRetrieveSchema"
+ '404':
+ description: Stopwords set not found.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiResponse"
+ delete:
+ tags:
+ - stopwords
+ summary: Delete a stopwords set.
+ description:
+ Permanently deletes a stopwords set, given it's name.
+ operationId: deleteStopwordsSet
+ parameters:
+ - in: path
+ name: setId
+ description: The ID of the stopwords set to delete.
+ schema:
+ type: string
+ required: true
+ example: countries
+ responses:
+ '200':
+ description: Stopwords set rule deleted.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: string
+ required:
+ - id
+ example: |
+ {"id": "countries"}
+ '404':
+ description: Stopwords set not found.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiResponse"
+ /presets:
+ get:
+ tags:
+ - presets
+ summary: Retrieves all presets.
+ description: Retrieve the details of all presets
+ operationId: retrieveAllPresets
+ responses:
+ '200':
+ description: Presets fetched.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetsRetrieveSchema'
+ /presets/{presetId}:
+ get:
+ tags:
+ - presets
+ summary: Retrieves a preset.
+ description: Retrieve the details of a preset, given it's name.
+ operationId: retrievePreset
+ parameters:
+ - in: path
+ name: presetId
+ description: The ID of the preset to retrieve.
+ schema:
+ type: string
+ required: true
+ example: listing_view
+ responses:
+ '200':
+ description: Preset fetched.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetSchema'
+ '404':
+ description: Preset not found.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ put:
+ tags:
+ - presets
+ summary: Upserts a preset.
+ description: Create or update an existing preset.
+ operationId: upsertPreset
+ parameters:
+ - in: path
+ name: presetId
+ description: The name of the preset set to upsert.
+ schema:
+ type: string
+ required: true
+ example: listing_view
+ requestBody:
+ description: The stopwords set to upsert.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetUpsertSchema'
+ required: true
+ responses:
+ '200':
+ description: Preset successfully upserted.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - presets
+ summary: Delete a preset.
+ description: Permanently deletes a preset, given it's name.
+ operationId: deletePreset
+ parameters:
+ - in: path
+ name: presetId
+ description: The ID of the preset to delete.
+ schema:
+ type: string
+ required: true
+ example: listing_view
+ responses:
+ '200':
+ description: Preset deleted.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetDeleteSchema'
+ '404':
+ description: Preset not found.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /stemming/dictionaries:
+ get:
+ tags:
+ - stemming
+ summary: List all stemming dictionaries
+ description: Retrieve a list of all available stemming dictionaries.
+ operationId: listStemmingDictionaries
+ responses:
+ '200':
+ description: List of all dictionaries
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ dictionaries:
+ type: array
+ items:
+ type: string
+ example: ["irregular-plurals", "company-terms"]
+
+ /stemming/dictionaries/{dictionaryId}:
+ get:
+ tags:
+ - stemming
+ summary: Retrieve a stemming dictionary
+ description: Fetch details of a specific stemming dictionary.
+ operationId: getStemmingDictionary
+ parameters:
+ - name: dictionaryId
+ in: path
+ description: The ID of the dictionary to retrieve
+ required: true
+ schema:
+ type: string
+ example: irregular-plurals
+ responses:
+ '200':
+ description: Stemming dictionary details
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/StemmingDictionary"
+ '404':
+ description: Dictionary not found
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiResponse"
+
+ /stemming/dictionaries/import:
+ post:
+ tags:
+ - stemming
+ summary: Import a stemming dictionary
+ description: Upload a JSONL file containing word mappings to create or update a stemming dictionary.
+ operationId: importStemmingDictionary
+ parameters:
+ - name: id
+ in: query
+ description: The ID to assign to the dictionary
+ required: true
+ schema:
+ type: string
+ example: irregular-plurals
+ requestBody:
+ description: The JSONL file containing word mappings
+ required: true
+ content:
+ application/json:
+ schema:
+ type: string
+ example: |
+ {"word": "people", "root": "person"}
+ {"word": "children", "root": "child"}
+ responses:
+ '200':
+ description: Dictionary successfully imported
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ example: >
+ {"word": "people", "root": "person"}
+ {"word": "children", "root": "child"}
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiResponse"
+ /nl_search_models:
+ get:
+ tags:
+ - nl_search_models
+ summary: List all NL search models
+ description: Retrieve all NL search models.
+ operationId: retrieveAllNLSearchModels
+ responses:
+ '200':
+ description: List of all NL search models
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/NLSearchModelSchema'
+ post:
+ tags:
+ - nl_search_models
+ summary: Create a NL search model
+ description: Create a new NL search model.
+ operationId: createNLSearchModel
+ requestBody:
+ description: The NL search model to be created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelCreateSchema'
+ required: true
+ responses:
+ '201':
+ description: NL search model successfully created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /nl_search_models/{modelId}:
+ get:
+ tags:
+ - nl_search_models
+ summary: Retrieve a NL search model
+ description: Retrieve a specific NL search model by its ID.
+ operationId: retrieveNLSearchModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The ID of the NL search model to retrieve
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: NL search model fetched
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelSchema'
+ '404':
+ description: NL search model not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ put:
+ tags:
+ - nl_search_models
+ summary: Update a NL search model
+ description: Update an existing NL search model.
+ operationId: updateNLSearchModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The ID of the NL search model to update
+ required: true
+ schema:
+ type: string
+ requestBody:
+ description: The NL search model fields to update
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelUpdateSchema'
+ required: true
+ responses:
+ '200':
+ description: NL search model successfully updated
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '404':
+ description: NL search model not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - nl_search_models
+ summary: Delete a NL search model
+ description: Delete a specific NL search model by its ID.
+ operationId: deleteNLSearchModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The ID of the NL search model to delete
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: NL search model successfully deleted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelDeleteSchema'
+ '404':
+ description: NL search model not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+
+components:
+ schemas:
+ CollectionSchema:
+ required:
+ - name
+ - fields
+ type: object
+ properties:
+ name:
+ type: string
+ description: Name of the collection
+ example: companies
+ fields:
+ type: array
+ description: A list of fields for querying, filtering and faceting
+ example:
+ - name: num_employees
+ type: int32
+ facet: false
+ - name: company_name
+ type: string
+ facet: false
+ - name: country
+ type: string
+ facet: true
+ items:
+ $ref: "#/components/schemas/Field"
+ default_sorting_field:
+ type: string
description:
The name of an int32 / float field that determines the order in which
the search results are ranked when a sort_by clause is not provided during
@@ -1331,7 +2035,7 @@ components:
token_separators:
type: array
description: >
- List of symbols or special characters to be used for
+ List of symbols or special characters to be used for
splitting the text into individual words in addition to space and new-line characters.
items:
type: string # characters only
@@ -1341,12 +2045,12 @@ components:
maxLength: 1
default: []
enable_nested_fields:
- type: boolean
- description:
- Enables experimental support at a collection level for nested object or object array fields.
- This field is only available if the Typesense server is version `0.24.0.rcn34` or later.
- default: false
- example: true
+ type: boolean
+ description:
+ Enables experimental support at a collection level for nested object or object array fields.
+ This field is only available if the Typesense server is version `0.24.0.rcn34` or later.
+ default: false
+ example: true
symbols_to_index:
type: array
description: >
@@ -1358,6 +2062,8 @@ components:
minLength: 1
maxLength: 1
default: []
+ voice_query_model:
+ $ref: "#/components/schemas/VoiceQueryModelCollectionConfig"
CollectionUpdateSchema:
required:
- fields
@@ -1428,6 +2134,10 @@ components:
type: boolean
example: true
default: false
+ reference:
+ type: string
+ description: >
+ Name of a field in another collection that should be linked to this collection so that it can be joined during query.
num_dim:
type: integer
example: 256
@@ -1435,6 +2145,49 @@ components:
type: boolean
example: true
# omitting default value since we want it to be null
+ store:
+ type: boolean
+ description: >
+ When set to false, the field value will not be stored on disk. Default: true.
+ vec_dist:
+ type: string
+ description: >
+ The distance metric to be used for vector search. Default: `cosine`. You can also use `ip` for inner product.
+ range_index:
+ type: boolean
+ description: >
+ Enables an index optimized for range filtering on numerical fields (e.g. rating:>3.5). Default: false.
+ stem:
+ type: boolean
+ description: >
+ Values are stemmed before indexing in-memory. Default: false.
+ stem_dictionary:
+ type: string
+ description: Name of the stemming dictionary to use for this field
+ example: irregular-plurals
+ token_separators:
+ type: array
+ description: >
+ List of symbols or special characters to be used for
+ splitting the text into individual words in addition to space and new-line characters.
+ items:
+ type: string # characters only
+ # Could `enum` be used instead, given it's symbols/special *characters*, e.g.:
+ # enum: ["@", "!", ".", "/", ","]
+ minLength: 1
+ maxLength: 1
+ default: []
+ symbols_to_index:
+ type: array
+ description: >
+ List of symbols or special characters to be indexed.
+ items:
+ type: string # characters only
+ # Could `enum` be used instead, given it's symbols/special *characters*, e.g.:
+ # enum: ["@", "!", ".", "/", ","]
+ minLength: 1
+ maxLength: 1
+ default: []
embed:
type: object
required:
@@ -1454,14 +2207,30 @@ components:
type: string
api_key:
type: string
+ url:
+ type: string
access_token:
type: string
+ refresh_token:
+ type: string
client_id:
type: string
client_secret:
type: string
project_id:
type: string
+ indexing_prefix:
+ type: string
+ query_prefix:
+ type: string
+ VoiceQueryModelCollectionConfig:
+ type: object
+ description: >
+ Configuration for the voice query model
+ properties:
+ model_name:
+ type: string
+ example: "ts/whisper/base.en"
CollectionAliasSchema:
type: object
required:
@@ -1503,6 +2272,8 @@ components:
found:
type: integer
description: The number of documents found
+ found_docs:
+ type: integer
search_time_ms:
type: integer
description: The number of milliseconds the search took
@@ -1537,7 +2308,31 @@ components:
type: string
per_page:
type: integer
-
+ voice_query:
+ type: object
+ properties:
+ transcribed_query:
+ type: string
+ conversation:
+ $ref: "#/components/schemas/SearchResultConversation"
+ SearchResultConversation:
+ type: object
+ required:
+ - answer
+ - conversation_history
+ - conversation_id
+ - query
+ properties:
+ answer:
+ type: string
+ conversation_history:
+ type: array
+ items:
+ type: object
+ conversation_id:
+ type: string
+ query:
+ type: string
SearchGroupedHit:
type: object
required:
@@ -1574,6 +2369,25 @@ components:
text_match:
type: integer
format: int64
+ text_match_info:
+ type: object
+ properties:
+ best_field_score:
+ type: string
+ best_field_weight:
+ type: integer
+ fields_matched:
+ type: integer
+ num_tokens_dropped:
+ type: integer
+ format: int64
+ x-go-type: uint64
+ score:
+ type: string
+ tokens_matched:
+ type: integer
+ typo_prefix_score:
+ type: integer
geo_distance_meters:
type: object
description: Can be any key-value pair
@@ -1664,6 +2478,37 @@ components:
type: boolean
description: >
Indicates whether search query tokens that exist in the override's rule should be removed from the search query.
+ metadata:
+ type: object
+ description: >
+ Return a custom JSON object in the Search API response, when this rule is triggered. This can can be used to display a pre-defined message (eg: a promotion banner) on the front-end when a particular rule is triggered.
+ sort_by:
+ type: string
+ description: >
+ A sort by clause that is applied to any search query that matches the override rule.
+ replace_query:
+ type: string
+ description: >
+ Replaces the current search query with this value, when the search query matches the override rule.
+ filter_curated_hits:
+ type: boolean
+ description: >
+ When set to true, the filter conditions of the query is applied to the curated records as well.
+ Default: false.
+ effective_from_ts:
+ type: integer
+ description: >
+ A Unix timestamp that indicates the date/time from which the override will be active. You can use this to create override rules that start applying from a future point in time.
+ effective_to_ts:
+ type: integer
+ description: >
+ A Unix timestamp that indicates the date/time until which the override will be active. You can use this to create override rules that stop applying after a period of time.
+ stop_processing:
+ type: boolean
+ description: >
+ When set to true, override processing will stop at the first matching rule. When set to false override processing will continue and multiple override actions will be triggered in sequence.
+ Overrides are processed in the lexical sort order of their id field.
+ Default: true.
SearchOverride:
allOf:
- $ref: "#/components/schemas/SearchOverrideSchema"
@@ -1674,12 +2519,22 @@ components:
id:
type: string
readOnly: true
- SearchOverrideRule:
+ SearchOverrideDeleteResponse:
type: object
required:
- - query
- - match
+ - id
+ properties:
+ id:
+ type: string
+ description: The id of the override that was deleted
+ SearchOverrideRule:
+ type: object
properties:
+ tags:
+ type: array
+ description: List of tag values to associate with this override rule.
+ items:
+ type: string
query:
type: string
description: Indicates what search queries should be overridden
@@ -1692,6 +2547,10 @@ components:
enum:
- exact
- contains
+ filter_by:
+ type: string
+ description: >
+ Indicates that the override should apply when the filter_by parameter in a search query exactly matches the string specified here (including backticks, spaces, brackets, etc).
SearchOverrideInclude:
type: object
required:
@@ -1735,6 +2594,14 @@ components:
description: Array of words that should be considered as synonyms.
items:
type: string
+ locale:
+ type: string
+ description: Locale for the synonym, leave blank to use the standard tokenizer.
+ symbols_to_index:
+ type: array
+ description: By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is.
+ items:
+ type: string
SearchSynonym:
allOf:
- $ref: "#/components/schemas/SearchSynonymSchema"
@@ -1745,6 +2612,14 @@ components:
id:
type: string
readOnly: true
+ SearchSynonymDeleteResponse:
+ type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: The id of the synonym that was deleted
SearchSynonymsResponse:
type: object
required:
@@ -1762,6 +2637,18 @@ components:
properties:
ok:
type: boolean
+ SchemaChangeStatus:
+ type: object
+ properties:
+ collection:
+ type: string
+ description: Name of the collection being modified
+ validated_docs:
+ type: integer
+ description: Number of documents that have been validated
+ altered_docs:
+ type: integer
+ description: Number of documents that have been altered
SuccessStatus:
type: object
required:
@@ -1810,6 +2697,15 @@ components:
value_prefix:
type: string
readOnly: true
+ ApiKeyDeleteResponse:
+ type: object
+ required:
+ - id
+ properties:
+ id:
+ type: integer
+ format: int64
+ description: The id of the API key that was deleted
ApiKeysResponse:
type: object
required:
@@ -1846,13 +2742,23 @@ components:
results:
type: array
items:
- $ref: "#/components/schemas/SearchResult"
+ $ref: "#/components/schemas/MultiSearchResultItem"
+ conversation:
+ $ref: "#/components/schemas/SearchResultConversation"
+ MultiSearchResultItem:
+ allOf:
+ - $ref: "#/components/schemas/SearchResult"
+ - type: object
+ properties:
+ code:
+ type: integer
+ description: HTTP error code
+ format: int64
+ error:
+ type: string
+ description: Error description
SearchParameters:
type: object
- required:
- - q
- - query_by
-
properties:
q:
description: The query text to search for in the collection.
@@ -1865,6 +2771,14 @@ components:
against. Multiple fields are separated with a comma.
type: string
+ nl_query:
+ description: Whether to use natural language processing to parse the query.
+ type: boolean
+
+ nl_model_id:
+ description: The ID of the natural language model to use.
+ type: string
+
query_by_weights:
description:
The relative weight to give each `query_by` field when ranking results.
@@ -1874,7 +2788,7 @@ components:
text_match_type:
description:
- In a multi-field matching context, this parameter determines how the representative text match
+ In a multi-field matching context, this parameter determines how the representative text match
score of a record is calculated. Possible values are max_score (default) or max_weight.
type: string
@@ -1887,26 +2801,26 @@ components:
infix:
description:
- If infix index is enabled for this field, infix searching can be done on a per-field
- basis by sending a comma separated string parameter called infix to the search query.
+ If infix index is enabled for this field, infix searching can be done on a per-field
+ basis by sending a comma separated string parameter called infix to the search query.
This parameter can have 3 values; `off` infix search is disabled, which is default
- `always` infix search is performed along with regular search
- `fallback` infix search is performed if regular search does not produce results
+ `always` infix search is performed along with regular search
+ `fallback` infix search is performed if regular search does not produce results
type: string
max_extra_prefix:
description:
- There are also 2 parameters that allow you to control the extent of infix searching
- max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before
- or after the query that can be present in the token. For example query "K2100" has 2 extra
+ There are also 2 parameters that allow you to control the extent of infix searching
+ max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before
+ or after the query that can be present in the token. For example query "K2100" has 2 extra
symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
type: integer
max_extra_suffix:
description:
- There are also 2 parameters that allow you to control the extent of infix searching
- max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before
- or after the query that can be present in the token. For example query "K2100" has 2 extra
+ There are also 2 parameters that allow you to control the extent of infix searching
+ max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before
+ or after the query that can be present in the token. For example query "K2100" has 2 extra
symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
type: integer
@@ -1917,6 +2831,12 @@ components:
type: string
example: "num_employees:>100 && country: [USA, UK]"
+ max_filter_by_candidates:
+ description:
+ Controls the number of similar words that Typesense considers during fuzzy search
+ on filter_by values. Useful for controlling prefix matches like company_name:Acm*.
+ type: integer
+
sort_by:
description:
A list of numerical fields and their corresponding sort orders
@@ -1963,7 +2883,7 @@ components:
limit:
description: >
- Number of hits to fetch. Can be used as an alternative to the per_page parameter.
+ Number of hits to fetch. Can be used as an alternative to the per_page parameter.
Default: 10.
type: integer
@@ -1985,6 +2905,13 @@ components:
Default: 3
type: integer
+ group_missing_values:
+ description: >
+ Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group.
+ Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents.
+ Default: true
+ type: boolean
+
include_fields:
description: List of fields from the document to include in the search result
type: string
@@ -2034,12 +2961,35 @@ components:
enough results are found. Tokens that have the least individual hits
are dropped first. Set to 0 to disable. Default: 10
type: integer
+ drop_tokens_mode:
+ $ref: "#/components/schemas/DropTokensMode"
typo_tokens_threshold:
description: >
If the number of results found for a specific query is less than this number,
Typesense will attempt to look for tokens with more typos until
enough results are found. Default: 100
type: integer
+ enable_typos_for_alpha_numerical_tokens:
+ type: boolean
+ description: >
+ Set this parameter to false to disable typos on alphanumerical query tokens. Default: true.
+
+ filter_curated_hits:
+ type: boolean
+ description: >
+ Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false
+ enable_synonyms:
+ type: boolean
+ description: >
+ If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true
+ synonym_prefix:
+ type: boolean
+ description: >
+ Allow synonym resolution on word prefixes in the query. Default: false
+ synonym_num_typos:
+ type: integer
+ description: >
+ Allow synonym resolution on typo-corrected words in the query. Default: 0
pinned_hits:
description: >
@@ -2051,7 +3001,7 @@ components:
you'd specify `123:1,456:5`.
You could also use the Overrides feature to override search results based
- on rules. Overrides are applied first, followed by `pinned_hits` and
+ on rules. Overrides are applied first, followed by `pinned_hits` and
finally `hidden_hits`.
type: string
@@ -2066,9 +3016,13 @@ components:
finally `hidden_hits`.
type: string
+ override_tags:
+ description: Comma separated list of tags to trigger the curations rules that match the tags.
+ type: string
+
highlight_fields:
description: >
- A list of custom fields that must be highlighted even if you don't query
+ A list of custom fields that must be highlighted even if you don't query
for them
type: string
@@ -2083,7 +3037,7 @@ components:
pre_segmented_query:
description: >
You can index content from any logographic language into Typesense if you
- are able to segment / split the text into space-separated words yourself
+ are able to segment / split the text into space-separated words yourself
before indexing and querying.
Set this parameter to true to do the same
@@ -2100,12 +3054,14 @@ components:
If you have some overrides defined but want to disable all of them during
query time, you can do that by setting this parameter to false
type: boolean
+ default: false
prioritize_exact_match:
description: >
Set this parameter to true to ensure that an exact match is ranked above
the others
type: boolean
+ default: true
max_candidates:
description: >
Control the number of words that Typesense considers for typo and prefix searching.
@@ -2114,15 +3070,26 @@ components:
description: >
Make Typesense prioritize documents where the query words appear earlier in the text.
type: boolean
+ default: false
+ prioritize_num_matching_fields:
+ description: >
+ Make Typesense prioritize documents where the query words appear in more number of fields.
+ type: boolean
+ default: true
+ enable_typos_for_numerical_tokens:
+ description: >
+ Make Typesense disable typos for numerical tokens.
+ type: boolean
+ default: true
exhaustive_search:
description: >
- Setting this to true will make Typesense consider all prefixes and typo
- corrections of the words in the query without stopping early when enough results are found
+ Setting this to true will make Typesense consider all prefixes and typo
+ corrections of the words in the query without stopping early when enough results are found
(drop_tokens_threshold and typo_tokens_threshold configurations are ignored).
type: boolean
search_cutoff_ms:
description: >
- Typesense will attempt to return results early if the cutoff time has elapsed.
+ Typesense will attempt to return results early if the cutoff time has elapsed.
This is not a strict guarantee and facet computation is not bound by this parameter.
type: integer
use_cache:
@@ -2131,17 +3098,17 @@ components:
type: boolean
cache_ttl:
description: >
- The duration (in seconds) that determines how long the search query is cached.
+ The duration (in seconds) that determines how long the search query is cached.
This value can be set on a per-query basis. Default: 60.
type: integer
min_len_1typo:
description: >
- Minimum word length for 1-typo correction to be applied.
+ Minimum word length for 1-typo correction to be applied.
The value of num_typos is still treated as the maximum allowed typos.
type: integer
min_len_2typo:
description: >
- Minimum word length for 2-typo correction to be applied.
+ Minimum word length for 2-typo correction to be applied.
The value of num_typos is still treated as the maximum allowed typos.
type: integer
vector_query:
@@ -2156,6 +3123,36 @@ components:
description: >
Number of times to retry fetching remote embeddings.
type: integer
+ facet_strategy:
+ description: >
+ Choose the underlying faceting strategy used. Comma separated string of allows values:
+ exhaustive, top_values or automatic (default).
+ type: string
+ stopwords:
+ description: >
+ Name of the stopwords set to apply for this search,
+ the keywords present in the set will be removed from the search query.
+ type: string
+ facet_return_parent:
+ description: >
+ Comma separated string of nested facet fields whose parent object should be returned in facet response.
+ type: string
+ voice_query:
+ description: >
+ The base64 encoded audio file in 16 khz 16-bit WAV format.
+ type: string
+ conversation:
+ description: >
+ Enable conversational search.
+ type: boolean
+ conversation_model_id:
+ description: >
+ The Id of Conversation Model to be used.
+ type: string
+ conversation_id:
+ description: >
+ The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM.
+ type: string
MultiSearchParameters:
description: >
@@ -2195,26 +3192,26 @@ components:
infix:
description:
- If infix index is enabled for this field, infix searching can be done on a per-field
- basis by sending a comma separated string parameter called infix to the search query.
+ If infix index is enabled for this field, infix searching can be done on a per-field
+ basis by sending a comma separated string parameter called infix to the search query.
This parameter can have 3 values; `off` infix search is disabled, which is default
- `always` infix search is performed along with regular search
- `fallback` infix search is performed if regular search does not produce results
+ `always` infix search is performed along with regular search
+ `fallback` infix search is performed if regular search does not produce results
type: string
max_extra_prefix:
description:
- There are also 2 parameters that allow you to control the extent of infix searching
- max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before
- or after the query that can be present in the token. For example query "K2100" has 2 extra
+ There are also 2 parameters that allow you to control the extent of infix searching
+ max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before
+ or after the query that can be present in the token. For example query "K2100" has 2 extra
symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
type: integer
max_extra_suffix:
description:
- There are also 2 parameters that allow you to control the extent of infix searching
- max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before
- or after the query that can be present in the token. For example query "K2100" has 2 extra
+ There are also 2 parameters that allow you to control the extent of infix searching
+ max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before
+ or after the query that can be present in the token. For example query "K2100" has 2 extra
symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
type: integer
@@ -2270,7 +3267,7 @@ components:
limit:
description: >
- Number of hits to fetch. Can be used as an alternative to the per_page parameter.
+ Number of hits to fetch. Can be used as an alternative to the per_page parameter.
Default: 10.
type: integer
@@ -2292,6 +3289,13 @@ components:
Default: 3
type: integer
+ group_missing_values:
+ description: >
+ Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group.
+ Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents.
+ Default: true
+ type: boolean
+
include_fields:
description: List of fields from the document to include in the search result
type: string
@@ -2334,12 +3338,35 @@ components:
enough results are found. Tokens that have the least individual hits
are dropped first. Set to 0 to disable. Default: 10
type: integer
+ drop_tokens_mode:
+ $ref: "#/components/schemas/DropTokensMode"
typo_tokens_threshold:
description: >
- If the number of results found for a specific query is less than this number,
- Typesense will attempt to look for tokens with more typos until
- enough results are found. Default: 100
+ If the number of results found for a specific query is less than this number,
+ Typesense will attempt to look for tokens with more typos until
+ enough results are found. Default: 100
+ type: integer
+ enable_typos_for_alpha_numerical_tokens:
+ type: boolean
+ description: >
+ Set this parameter to false to disable typos on alphanumerical query tokens. Default: true.
+
+ filter_curated_hits:
+ type: boolean
+ description: >
+ Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false
+ enable_synonyms:
+ type: boolean
+ description: >
+ If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true
+ synonym_prefix:
+ type: boolean
+ description: >
+ Allow synonym resolution on word prefixes in the query. Default: false
+ synonym_num_typos:
type: integer
+ description: >
+ Allow synonym resolution on typo-corrected words in the query. Default: 0
pinned_hits:
description: >
@@ -2351,7 +3378,7 @@ components:
you'd specify `123:1,456:5`.
You could also use the Overrides feature to override search results based
- on rules. Overrides are applied first, followed by `pinned_hits` and
+ on rules. Overrides are applied first, followed by `pinned_hits` and
finally `hidden_hits`.
type: string
@@ -2366,20 +3393,25 @@ components:
finally `hidden_hits`.
type: string
+ override_tags:
+ description: Comma separated list of tags to trigger the curations rules that match the tags.
+ type: string
+
highlight_fields:
description: >
- A list of custom fields that must be highlighted even if you don't query
+ A list of custom fields that must be highlighted even if you don't query
for them
type: string
pre_segmented_query:
description: >
You can index content from any logographic language into Typesense if you
- are able to segment / split the text into space-separated words yourself
+ are able to segment / split the text into space-separated words yourself
before indexing and querying.
Set this parameter to true to do the same
type: boolean
+ default: false
preset:
description: >
@@ -2392,21 +3424,42 @@ components:
If you have some overrides defined but want to disable all of them during
query time, you can do that by setting this parameter to false
type: boolean
+ default: false
prioritize_exact_match:
description: >
Set this parameter to true to ensure that an exact match is ranked above
the others
type: boolean
+ default: true
+
+ prioritize_token_position:
+ description: >
+ Make Typesense prioritize documents where the query words appear earlier in the text.
+ type: boolean
+ default: false
+
+ prioritize_num_matching_fields:
+ description: >
+ Make Typesense prioritize documents where the query words appear in more number of fields.
+ type: boolean
+ default: true
+
+ enable_typos_for_numerical_tokens:
+ description: >
+ Make Typesense disable typos for numerical tokens.
+ type: boolean
+ default: true
+
exhaustive_search:
description: >
- Setting this to true will make Typesense consider all prefixes and typo
- corrections of the words in the query without stopping early when enough results are found
+ Setting this to true will make Typesense consider all prefixes and typo
+ corrections of the words in the query without stopping early when enough results are found
(drop_tokens_threshold and typo_tokens_threshold configurations are ignored).
type: boolean
search_cutoff_ms:
description: >
- Typesense will attempt to return results early if the cutoff time has elapsed.
+ Typesense will attempt to return results early if the cutoff time has elapsed.
This is not a strict guarantee and facet computation is not bound by this parameter.
type: integer
use_cache:
@@ -2415,17 +3468,17 @@ components:
type: boolean
cache_ttl:
description: >
- The duration (in seconds) that determines how long the search query is cached.
+ The duration (in seconds) that determines how long the search query is cached.
This value can be set on a per-query basis. Default: 60.
type: integer
min_len_1typo:
description: >
- Minimum word length for 1-typo correction to be applied.
+ Minimum word length for 1-typo correction to be applied.
The value of num_typos is still treated as the maximum allowed typos.
type: integer
min_len_2typo:
description: >
- Minimum word length for 2-typo correction to be applied.
+ Minimum word length for 2-typo correction to be applied.
The value of num_typos is still treated as the maximum allowed typos.
type: integer
vector_query:
@@ -2440,11 +3493,44 @@ components:
description: >
Number of times to retry fetching remote embeddings.
type: integer
+ facet_strategy:
+ description: >
+ Choose the underlying faceting strategy used. Comma separated string of allows values:
+ exhaustive, top_values or automatic (default).
+ type: string
+ stopwords:
+ description: >
+ Name of the stopwords set to apply for this search,
+ the keywords present in the set will be removed from the search query.
+ type: string
+ facet_return_parent:
+ description: >
+ Comma separated string of nested facet fields whose parent object should be returned in facet response.
+ type: string
+ voice_query:
+ description: >
+ The base64 encoded audio file in 16 khz 16-bit WAV format.
+ type: string
+ conversation:
+ description: >
+ Enable conversational search.
+ type: boolean
+ conversation_model_id:
+ description: >
+ The Id of Conversation Model to be used.
+ type: string
+ conversation_id:
+ description: >
+ The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM.
+ type: string
MultiSearchSearchesParameter:
type: object
required:
- searches
properties:
+ union:
+ type: boolean
+ description: When true, merges the search results from each search query into a single ordered set of hits.
searches:
type: array
items:
@@ -2453,13 +3539,21 @@ components:
allOf:
- $ref: "#/components/schemas/MultiSearchParameters"
- type: object
- required:
- - collection
properties:
collection:
type: string
description: >
The collection to search in.
+ x-typesense-api-key:
+ type: string
+ description: A separate search API key for each search within a multi_search request
+ rerank_hybrid_matches:
+ type: boolean
+ description: >
+ When true, computes both text match and vector distance scores for all matches in hybrid search.
+ Documents found only through keyword search will get a vector distance score, and
+ documents found only through vector search will get a text match score.
+ default: false
FacetCounts:
type: object
properties:
@@ -2474,6 +3568,8 @@ components:
type: string
value:
type: string
+ parent:
+ type: object
field_name:
type: string
stats:
@@ -2493,17 +3589,38 @@ components:
avg:
type: number
format: double
- AnalyticsRuleSchema:
+ AnalyticsEventCreateResponse:
+ type: object
+ required:
+ - ok
+ properties:
+ ok:
+ type: boolean
+ AnalyticsEventCreateSchema:
type: object
required:
- - name
- type
- - params
+ - name
+ - data
properties:
+ type:
+ type: string
name:
type: string
+ data:
+ type: object
+ AnalyticsRuleUpsertSchema:
+ type: object
+ required:
+ - type
+ - params
+ properties:
type:
type: string
+ enum:
+ - popular_queries
+ - nohits_queries
+ - counter
params:
$ref: "#/components/schemas/AnalyticsRuleParameters"
AnalyticsRuleParameters:
@@ -2511,22 +3628,65 @@ components:
required:
- source
- destination
- - limit
properties:
source:
- type: object
- properties:
- collections:
- type: array
- items:
- type: string
+ $ref: '#/components/schemas/AnalyticsRuleParametersSource'
destination:
- type: object
- properties:
- collection:
- type: string
+ $ref: '#/components/schemas/AnalyticsRuleParametersDestination'
limit:
type: integer
+ expand_query:
+ type: boolean
+ AnalyticsRuleParametersSource:
+ type: object
+ required:
+ - collections
+ properties:
+ collections:
+ type: array
+ items:
+ type: string
+ events:
+ type: array
+ items:
+ type: object
+ required:
+ - type
+ - weight
+ - name
+ properties:
+ type:
+ type: string
+ weight:
+ type: number
+ format: float
+ name:
+ type: string
+ AnalyticsRuleParametersDestination:
+ type: object
+ required:
+ - collection
+ properties:
+ collection:
+ type: string
+ counter_field:
+ type: string
+ AnalyticsRuleDeleteResponse:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ AnalyticsRuleSchema:
+ allOf:
+ - $ref: '#/components/schemas/AnalyticsRuleUpsertSchema'
+ - type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
AnalyticsRulesRetrieveSchema:
type: object
properties:
@@ -2534,6 +3694,335 @@ components:
type: array
items:
$ref: "#/components/schemas/AnalyticsRuleSchema"
+ x-go-type: '[]*AnalyticsRuleSchema'
+ APIStatsResponse:
+ type: object
+ properties:
+ delete_latency_ms:
+ type: number
+ format: double
+ delete_requests_per_second:
+ type: number
+ format: double
+ import_latency_ms:
+ type: number
+ format: double
+ import_requests_per_second:
+ type: number
+ format: double
+ latency_ms:
+ type: object
+ x-go-type: "map[string]float64"
+ overloaded_requests_per_second:
+ type: number
+ format: double
+ pending_write_batches:
+ type: number
+ format: double
+ requests_per_second:
+ type: object
+ x-go-type: "map[string]float64"
+ search_latency_ms:
+ type: number
+ format: double
+ search_requests_per_second:
+ type: number
+ format: double
+ total_requests_per_second:
+ type: number
+ format: double
+ write_latency_ms:
+ type: number
+ format: double
+ write_requests_per_second:
+ type: number
+ format: double
+ StopwordsSetUpsertSchema:
+ type: object
+ properties:
+ stopwords:
+ type: array
+ items:
+ type: string
+ locale:
+ type: string
+ required:
+ - stopwords
+ example: |
+ {"stopwords": ["Germany", "France", "Italy"], "locale": "en"}
+ StopwordsSetSchema:
+ type: object
+ properties:
+ id:
+ type: string
+ stopwords:
+ type: array
+ items:
+ type: string
+ locale:
+ type: string
+ required:
+ - id
+ - stopwords
+ example: |
+ {"id": "countries", "stopwords": ["Germany", "France", "Italy"], "locale": "en"}
+ StopwordsSetRetrieveSchema:
+ type: object
+ properties:
+ stopwords:
+ $ref: "#/components/schemas/StopwordsSetSchema"
+ required:
+ - stopwords
+ example: |
+ {"stopwords": {"id": "countries", "stopwords": ["Germany", "France", "Italy"], "locale": "en"}}
+ StopwordsSetsRetrieveAllSchema:
+ type: object
+ properties:
+ stopwords:
+ type: array
+ items:
+ $ref: "#/components/schemas/StopwordsSetSchema"
+ required:
+ - stopwords
+ example: |
+ {"stopwords": [{"id": "countries", "stopwords": ["Germany", "France", "Italy"], "locale": "en"}]}
+ PresetUpsertSchema:
+ properties:
+ value:
+ oneOf:
+ - $ref: '#/components/schemas/SearchParameters'
+ - $ref: '#/components/schemas/MultiSearchSearchesParameter'
+ required:
+ - value
+ PresetSchema:
+ allOf:
+ - $ref: '#/components/schemas/PresetUpsertSchema'
+ - type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ PresetsRetrieveSchema:
+ type: object
+ required:
+ - presets
+ properties:
+ presets:
+ type: array
+ items:
+ $ref: '#/components/schemas/PresetSchema'
+ x-go-type: '[]*PresetSchema'
+ PresetDeleteSchema:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ # client libraries already have .create, .upsert,... methods so we omit the `action` param
+ DocumentIndexParameters:
+ type: object
+ properties:
+ dirty_values:
+ $ref: "#/components/schemas/DirtyValues"
+ DirtyValues:
+ type: string
+ enum: [coerce_or_reject, coerce_or_drop, drop, reject]
+ IndexAction:
+ type: string
+ enum: [create, update, upsert, emplace]
+ DropTokensMode:
+ type: string
+ enum: [right_to_left, left_to_right, both_sides:3]
+ description: >
+ Dictates the direction in which the words in the query must be dropped when the original words in the query do not appear in any document.
+ Values: right_to_left (default), left_to_right, both_sides:3
+ A note on both_sides:3 - for queries upto 3 tokens (words) in length, this mode will drop tokens from both sides and exhaustively rank all matching results.
+ If query length is greater than 3 words, Typesense will just fallback to default behavior of right_to_left
+ ConversationModelCreateSchema:
+ required:
+ - model_name
+ - max_bytes
+ allOf:
+ - $ref: '#/components/schemas/ConversationModelUpdateSchema'
+ - type: object
+ required:
+ - model_name
+ - max_bytes
+ - history_collection
+ properties:
+ model_name:
+ description: Name of the LLM model offered by OpenAI, Cloudflare or vLLM
+ type: string
+ max_bytes:
+ description: |
+ The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window.
+ type: integer
+ history_collection:
+ type: string
+ description: Typesense collection that stores the historical conversations
+ ConversationModelUpdateSchema:
+ type: object
+ properties:
+ id:
+ type: string
+ description: An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id.
+ model_name:
+ description: Name of the LLM model offered by OpenAI, Cloudflare or vLLM
+ type: string
+ api_key:
+ description: The LLM service's API Key
+ type: string
+ history_collection:
+ type: string
+ description: Typesense collection that stores the historical conversations
+ account_id:
+ description: LLM service's account ID (only applicable for Cloudflare)
+ type: string
+ system_prompt:
+ description: The system prompt that contains special instructions to the LLM
+ type: string
+ ttl:
+ type: integer
+ description: |
+ Time interval in seconds after which the messages would be deleted. Default: 86400 (24 hours)
+ max_bytes:
+ description: |
+ The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window.
+ type: integer
+ vllm_url:
+ description: URL of vLLM service
+ type: string
+ ConversationModelSchema:
+ allOf:
+ - $ref: '#/components/schemas/ConversationModelCreateSchema'
+ - type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id.
+ StemmingDictionary:
+ type: object
+ required:
+ - id
+ - words
+ properties:
+ id:
+ type: string
+ description: Unique identifier for the dictionary
+ example: irregular-plurals
+ words:
+ type: array
+ description: List of word mappings in the dictionary
+ items:
+ type: object
+ required:
+ - word
+ - root
+ properties:
+ word:
+ type: string
+ description: The word form to be stemmed
+ example: people
+ root:
+ type: string
+ description: The root form of the word
+ example: person
+ NLSearchModelBase:
+ type: object
+ properties:
+ model_name:
+ type: string
+ description: Name of the NL model to use
+ api_key:
+ type: string
+ description: API key for the NL model service
+ api_url:
+ type: string
+ description: Custom API URL for the NL model service
+ max_bytes:
+ type: integer
+ description: Maximum number of bytes to process
+ temperature:
+ type: number
+ description: Temperature parameter for the NL model
+ system_prompt:
+ type: string
+ description: System prompt for the NL model
+ top_p:
+ type: number
+ description: Top-p parameter for the NL model (Google-specific)
+ top_k:
+ type: integer
+ description: Top-k parameter for the NL model (Google-specific)
+ stop_sequences:
+ type: array
+ items:
+ type: string
+ description: Stop sequences for the NL model (Google-specific)
+ api_version:
+ type: string
+ description: API version for the NL model service
+ project_id:
+ type: string
+ description: Project ID for GCP Vertex AI
+ access_token:
+ type: string
+ description: Access token for GCP Vertex AI
+ refresh_token:
+ type: string
+ description: Refresh token for GCP Vertex AI
+ client_id:
+ type: string
+ description: Client ID for GCP Vertex AI
+ client_secret:
+ type: string
+ description: Client secret for GCP Vertex AI
+ region:
+ type: string
+ description: Region for GCP Vertex AI
+ max_output_tokens:
+ type: integer
+ description: Maximum output tokens for GCP Vertex AI
+ account_id:
+ type: string
+ description: Account ID for Cloudflare-specific models
+
+ NLSearchModelCreateSchema:
+ allOf:
+ - $ref: '#/components/schemas/NLSearchModelBase'
+ - type: object
+ properties:
+ id:
+ type: string
+ description: Optional ID for the NL search model
+
+ NLSearchModelSchema:
+ allOf:
+ - $ref: '#/components/schemas/NLSearchModelCreateSchema'
+ - type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: ID of the NL search model
+
+ NLSearchModelUpdateSchema:
+ $ref: '#/components/schemas/NLSearchModelCreateSchema'
+
+ NLSearchModelDeleteSchema:
+ type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: ID of the deleted NL search model
+
securitySchemes:
api_key_header:
type: apiKey
diff --git a/preprocessed_openapi.yml b/preprocessed_openapi.yml
new file mode 100644
index 0000000..b2740e7
--- /dev/null
+++ b/preprocessed_openapi.yml
@@ -0,0 +1,4481 @@
+openapi: 3.0.3
+info:
+ title: Typesense API
+ description: An open source search engine for building delightful search experiences.
+ version: '28.0'
+externalDocs:
+ description: Find out more about Typsesense
+ url: https://typesense.org
+security:
+- api_key_header: []
+tags:
+- name: collections
+ description: A collection is defined by a schema
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/api/#create-collection
+- name: documents
+ description: A document is an individual record to be indexed and belongs to a collection
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/api/#index-document
+- name: curation
+ description: Hand-curate search results based on conditional business rules
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/0.23.0/api/#curation
+- name: analytics
+ description: Typesense can aggregate search queries for both analytics purposes and for query suggestions.
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/analytics-query-suggestions.html
+- name: keys
+ description: Manage API Keys with fine-grain access control
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/0.23.0/api/#api-keys
+- name: debug
+ description: Debugging information
+- name: operations
+ description: Manage Typesense cluster
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/cluster-operations.html
+- name: stopwords
+ description: Manage stopwords sets
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/stopwords.html
+- name: presets
+ description: Store and reference search parameters
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/search.html#presets
+- name: conversations
+ description: Conversational Search (RAG)
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/conversational-search-rag.html
+- name: synonyms
+ description: Manage synonyms
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/synonyms.html
+- name: stemming
+ description: Manage stemming dictionaries
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/28.0/api/stemming.html
+- name: nl_search_models
+ description: Manage NL search models
+ externalDocs:
+ description: Find out more
+ url: https://typesense.org/docs/29.0/api/natural-language-search.html
+paths:
+ /collections:
+ get:
+ tags:
+ - collections
+ summary: List all collections
+ description: Returns a summary of all your collections. The collections are returned sorted by creation date, with the most recent collections appearing first.
+ operationId: getCollections
+ responses:
+ '200':
+ description: List of all collections
+ content:
+ application/json:
+ schema:
+ type: array
+ x-go-type: '[]*CollectionResponse'
+ items:
+ $ref: '#/components/schemas/CollectionResponse'
+ post:
+ tags:
+ - collections
+ summary: Create a new collection
+ description: When a collection is created, we give it a name and describe the fields that will be indexed from the documents added to the collection.
+ operationId: createCollection
+ requestBody:
+ description: The collection object to be created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionSchema'
+ required: true
+ responses:
+ '201':
+ description: Collection successfully created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionResponse'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '409':
+ description: Collection already exists
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}:
+ get:
+ tags:
+ - collections
+ summary: Retrieve a single collection
+ description: Retrieve the details of a collection, given its name.
+ operationId: getCollection
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to retrieve
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Collection fetched
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionResponse'
+ '404':
+ description: Collection not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ patch:
+ tags:
+ - collections
+ summary: Update a collection
+ description: Update a collection's schema to modify the fields and their types.
+ operationId: updateCollection
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to update
+ required: true
+ schema:
+ type: string
+ requestBody:
+ description: The document object with fields to be updated
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionUpdateSchema'
+ required: true
+ responses:
+ '200':
+ description: The updated partial collection schema
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionUpdateSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '404':
+ description: The collection was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - collections
+ summary: Delete a collection
+ description: Permanently drops a collection. This action cannot be undone. For large collections, this might have an impact on read latencies.
+ operationId: deleteCollection
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to delete
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Collection deleted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionResponse'
+ '404':
+ description: Collection not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}/documents:
+ post:
+ tags:
+ - documents
+ summary: Index a document
+ description: A document to be indexed in a given collection must conform to the schema of the collection.
+ operationId: indexDocument
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to add the document to
+ required: true
+ schema:
+ type: string
+ - name: action
+ in: query
+ description: Additional action to perform
+ schema:
+ type: string
+ example: upsert
+ $ref: '#/components/schemas/IndexAction'
+ - name: dirty_values
+ in: query
+ description: Dealing with Dirty Data
+ schema:
+ $ref: '#/components/schemas/DirtyValues'
+ requestBody:
+ description: The document object to be indexed
+ content:
+ application/json:
+ schema:
+ type: object
+ description: Can be any key-value pair
+ x-go-type: interface{}
+ required: true
+ responses:
+ '201':
+ description: Document successfully created/indexed
+ content:
+ application/json:
+ schema:
+ type: object
+ description: Can be any key-value pair
+ '404':
+ description: Collection not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ patch:
+ tags:
+ - documents
+ summary: Update documents with conditional query
+ description: The filter_by query parameter is used to filter to specify a condition against which the documents are matched. The request body contains the fields that should be updated for any documents that match the filter condition. This endpoint is only available if the Typesense server is version `0.25.0.rc12` or later.
+ operationId: updateDocuments
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to update documents in
+ required: true
+ schema:
+ type: string
+ - name: filter_by
+ in: query
+ schema:
+ type: string
+ example: 'num_employees:>100 && country: [USA, UK]'
+ responses:
+ '200':
+ description: The response contains a single field, `num_updated`, indicating the number of documents affected.
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - num_updated
+ properties:
+ num_updated:
+ type: integer
+ description: The number of documents that have been updated
+ example: 1
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '404':
+ description: The collection was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ requestBody:
+ description: The document fields to be updated
+ content:
+ application/json:
+ schema:
+ type: object
+ description: Can be any key-value pair
+ x-go-type: interface{}
+ required: true
+ delete:
+ tags:
+ - documents
+ summary: Delete a bunch of documents
+ description: Delete a bunch of documents that match a specific filter condition. Use the `batch_size` parameter to control the number of documents that should deleted at a time. A larger value will speed up deletions, but will impact performance of other operations running on the server.
+ operationId: deleteDocuments
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to delete documents from
+ required: true
+ schema:
+ type: string
+ - name: filter_by
+ in: query
+ schema:
+ type: string
+ example: 'num_employees:>100 && country: [USA, UK]'
+ - name: batch_size
+ in: query
+ schema:
+ description: Batch size parameter controls the number of documents that should be deleted at a time. A larger value will speed up deletions, but will impact performance of other operations running on the server.
+ type: integer
+ - name: ignore_not_found
+ in: query
+ schema:
+ type: boolean
+ - name: truncate
+ in: query
+ schema:
+ description: When true, removes all documents from the collection while preserving the collection and its schema.
+ type: boolean
+ responses:
+ '200':
+ description: Documents successfully deleted
+ content:
+ application/json:
+ schema:
+ type: object
+ required:
+ - num_deleted
+ properties:
+ num_deleted:
+ type: integer
+ '404':
+ description: Collection not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}/documents/search:
+ get:
+ tags:
+ - documents
+ summary: Search for documents in a collection
+ description: Search for documents in a collection that match the search criteria.
+ operationId: searchCollection
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to search for the document under
+ required: true
+ schema:
+ type: string
+ - name: q
+ in: query
+ schema:
+ description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by.
+ type: string
+ - name: query_by
+ in: query
+ schema:
+ description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma.
+ type: string
+ - name: nl_query
+ in: query
+ schema:
+ description: Whether to use natural language processing to parse the query.
+ type: boolean
+ - name: nl_model_id
+ in: query
+ schema:
+ description: The ID of the natural language model to use.
+ type: string
+ - name: query_by_weights
+ in: query
+ schema:
+ description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma.
+ type: string
+ - name: text_match_type
+ in: query
+ schema:
+ description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight.
+ type: string
+ - name: prefix
+ in: query
+ schema:
+ description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true.
+ type: string
+ - name: infix
+ in: query
+ schema:
+ description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results
+ type: string
+ - name: max_extra_prefix
+ in: query
+ schema:
+ description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
+ type: integer
+ - name: max_extra_suffix
+ in: query
+ schema:
+ description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
+ type: integer
+ - name: filter_by
+ in: query
+ schema:
+ description: Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&.
+ type: string
+ example: 'num_employees:>100 && country: [USA, UK]'
+ - name: max_filter_by_candidates
+ in: query
+ schema:
+ description: Controls the number of similar words that Typesense considers during fuzzy search on filter_by values. Useful for controlling prefix matches like company_name:Acm*.
+ type: integer
+ - name: sort_by
+ in: query
+ schema:
+ description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc`
+ type: string
+ example: num_employees:desc
+ - name: facet_by
+ in: query
+ schema:
+ description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma.
+ type: string
+ - name: max_facet_values
+ in: query
+ schema:
+ description: Maximum number of facet values to be returned.
+ type: integer
+ - name: facet_query
+ in: query
+ schema:
+ description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe".
+ type: string
+ - name: num_typos
+ in: query
+ schema:
+ description: |
+ The number of typographical errors (1 or 2) that would be tolerated. Default: 2
+ type: string
+ - name: page
+ in: query
+ schema:
+ description: Results from this specific page number would be fetched.
+ type: integer
+ - name: per_page
+ in: query
+ schema:
+ description: 'Number of results to fetch per page. Default: 10'
+ type: integer
+ - name: limit
+ in: query
+ schema:
+ description: |
+ Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10.
+ type: integer
+ - name: offset
+ in: query
+ schema:
+ description: Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter.
+ type: integer
+ - name: group_by
+ in: query
+ schema:
+ description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field.
+ type: string
+ - name: group_limit
+ in: query
+ schema:
+ description: |
+ Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3
+ type: integer
+ - name: group_missing_values
+ in: query
+ schema:
+ description: |
+ Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true
+ type: boolean
+ - name: include_fields
+ in: query
+ schema:
+ description: List of fields from the document to include in the search result
+ type: string
+ - name: exclude_fields
+ in: query
+ schema:
+ description: List of fields from the document to exclude in the search result
+ type: string
+ - name: highlight_full_fields
+ in: query
+ schema:
+ description: List of fields which should be highlighted fully without snippeting
+ type: string
+ - name: highlight_affix_num_tokens
+ in: query
+ schema:
+ description: |
+ The number of tokens that should surround the highlighted text on each side. Default: 4
+ type: integer
+ - name: highlight_start_tag
+ in: query
+ schema:
+ description: |
+ The start tag used for the highlighted snippets. Default: ``
+ type: string
+ - name: highlight_end_tag
+ in: query
+ schema:
+ description: |
+ The end tag used for the highlighted snippets. Default: ``
+ type: string
+ - name: enable_highlight_v1
+ in: query
+ schema:
+ description: |
+ Flag for enabling/disabling the deprecated, old highlight structure in the response. Default: true
+ type: boolean
+ default: true
+ - name: snippet_threshold
+ in: query
+ schema:
+ description: |
+ Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30
+ type: integer
+ - name: drop_tokens_threshold
+ in: query
+ schema:
+ description: |
+ If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10
+ type: integer
+ - name: drop_tokens_mode
+ in: query
+ schema:
+ $ref: '#/components/schemas/DropTokensMode'
+ - name: typo_tokens_threshold
+ in: query
+ schema:
+ description: |
+ If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100
+ type: integer
+ - name: enable_typos_for_alpha_numerical_tokens
+ in: query
+ schema:
+ type: boolean
+ description: |
+ Set this parameter to false to disable typos on alphanumerical query tokens. Default: true.
+ - name: filter_curated_hits
+ in: query
+ schema:
+ type: boolean
+ description: |
+ Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false
+ - name: enable_synonyms
+ in: query
+ schema:
+ type: boolean
+ description: |
+ If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true
+ - name: synonym_prefix
+ in: query
+ schema:
+ type: boolean
+ description: |
+ Allow synonym resolution on word prefixes in the query. Default: false
+ - name: synonym_num_typos
+ in: query
+ schema:
+ type: integer
+ description: |
+ Allow synonym resolution on typo-corrected words in the query. Default: 0
+ - name: pinned_hits
+ in: query
+ schema:
+ description: |
+ A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`.
+ You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ type: string
+ - name: hidden_hits
+ in: query
+ schema:
+ description: |
+ A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`.
+ You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ type: string
+ - name: override_tags
+ in: query
+ schema:
+ description: Comma separated list of tags to trigger the curations rules that match the tags.
+ type: string
+ - name: highlight_fields
+ in: query
+ schema:
+ description: |
+ A list of custom fields that must be highlighted even if you don't query for them
+ type: string
+ - name: split_join_tokens
+ in: query
+ schema:
+ description: |
+ Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`.
+ type: string
+ - name: pre_segmented_query
+ in: query
+ schema:
+ description: |
+ You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying.
+ Set this parameter to true to do the same
+ type: boolean
+ - name: preset
+ in: query
+ schema:
+ description: |
+ Search using a bunch of search parameters by setting this parameter to the name of the existing Preset.
+ type: string
+ - name: enable_overrides
+ in: query
+ schema:
+ description: |
+ If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false
+ type: boolean
+ default: false
+ - name: prioritize_exact_match
+ in: query
+ schema:
+ description: |
+ Set this parameter to true to ensure that an exact match is ranked above the others
+ type: boolean
+ default: true
+ - name: max_candidates
+ in: query
+ schema:
+ description: |
+ Control the number of words that Typesense considers for typo and prefix searching.
+ type: integer
+ - name: prioritize_token_position
+ in: query
+ schema:
+ description: |
+ Make Typesense prioritize documents where the query words appear earlier in the text.
+ type: boolean
+ default: false
+ - name: prioritize_num_matching_fields
+ in: query
+ schema:
+ description: |
+ Make Typesense prioritize documents where the query words appear in more number of fields.
+ type: boolean
+ default: true
+ - name: enable_typos_for_numerical_tokens
+ in: query
+ schema:
+ description: |
+ Make Typesense disable typos for numerical tokens.
+ type: boolean
+ default: true
+ - name: exhaustive_search
+ in: query
+ schema:
+ description: |
+ Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored).
+ type: boolean
+ - name: search_cutoff_ms
+ in: query
+ schema:
+ description: |
+ Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter.
+ type: integer
+ - name: use_cache
+ in: query
+ schema:
+ description: |
+ Enable server side caching of search query results. By default, caching is disabled.
+ type: boolean
+ - name: cache_ttl
+ in: query
+ schema:
+ description: |
+ The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60.
+ type: integer
+ - name: min_len_1typo
+ in: query
+ schema:
+ description: |
+ Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ type: integer
+ - name: min_len_2typo
+ in: query
+ schema:
+ description: |
+ Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ type: integer
+ - name: vector_query
+ in: query
+ schema:
+ description: |
+ Vector query expression for fetching documents "closest" to a given query/document vector.
+ type: string
+ - name: remote_embedding_timeout_ms
+ in: query
+ schema:
+ description: |
+ Timeout (in milliseconds) for fetching remote embeddings.
+ type: integer
+ - name: remote_embedding_num_tries
+ in: query
+ schema:
+ description: |
+ Number of times to retry fetching remote embeddings.
+ type: integer
+ - name: facet_strategy
+ in: query
+ schema:
+ description: |
+ Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default).
+ type: string
+ - name: stopwords
+ in: query
+ schema:
+ description: |
+ Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query.
+ type: string
+ - name: facet_return_parent
+ in: query
+ schema:
+ description: |
+ Comma separated string of nested facet fields whose parent object should be returned in facet response.
+ type: string
+ - name: voice_query
+ in: query
+ schema:
+ description: |
+ The base64 encoded audio file in 16 khz 16-bit WAV format.
+ type: string
+ - name: conversation
+ in: query
+ schema:
+ description: |
+ Enable conversational search.
+ type: boolean
+ - name: conversation_model_id
+ in: query
+ schema:
+ description: |
+ The Id of Conversation Model to be used.
+ type: string
+ - name: conversation_id
+ in: query
+ schema:
+ description: |
+ The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM.
+ type: string
+ responses:
+ '200':
+ description: Search results
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchResult'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '404':
+ description: The collection or field was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}/overrides:
+ get:
+ tags:
+ - documents
+ - curation
+ summary: List all collection overrides
+ operationId: getSearchOverrides
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: List of all search overrides
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchOverridesResponse'
+ /collections/{collectionName}/overrides/{overrideId}:
+ get:
+ tags:
+ - documents
+ - override
+ summary: Retrieve a single search override
+ description: Retrieve the details of a search override, given its id.
+ operationId: getSearchOverride
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ - name: overrideId
+ in: path
+ description: The id of the search override
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Search override fetched
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchOverride'
+ put:
+ tags:
+ - documents
+ - curation
+ summary: Create or update an override to promote certain documents over others
+ description: Create or update an override to promote certain documents over others. Using overrides, you can include or exclude specific documents for a given query.
+ operationId: upsertSearchOverride
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ - name: overrideId
+ in: path
+ description: The ID of the search override to create/update
+ required: true
+ schema:
+ type: string
+ requestBody:
+ description: The search override object to be created/updated
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchOverrideSchema'
+ required: true
+ responses:
+ '200':
+ description: Created/updated search override
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchOverride'
+ '404':
+ description: Search override not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - documents
+ - curation
+ summary: Delete an override associated with a collection
+ operationId: deleteSearchOverride
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ - name: overrideId
+ in: path
+ description: The ID of the search override to delete
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: The ID of the deleted search override
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchOverrideDeleteResponse'
+ '404':
+ description: Search override not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}/synonyms:
+ get:
+ tags:
+ - synonyms
+ summary: List all collection synonyms
+ operationId: getSearchSynonyms
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: List of all search synonyms
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchSynonymsResponse'
+ '404':
+ description: Search synonyms was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}/synonyms/{synonymId}:
+ get:
+ tags:
+ - synonyms
+ summary: Retrieve a single search synonym
+ description: Retrieve the details of a search synonym, given its id.
+ operationId: getSearchSynonym
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ - name: synonymId
+ in: path
+ description: The id of the search synonym
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Search synonym fetched
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchSynonym'
+ '404':
+ description: Search synonym was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ put:
+ tags:
+ - synonyms
+ summary: Create or update a synonym
+ description: Create or update a synonym to define search terms that should be considered equivalent.
+ operationId: upsertSearchSynonym
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ - name: synonymId
+ in: path
+ description: The ID of the search synonym to create/update
+ required: true
+ schema:
+ type: string
+ requestBody:
+ description: The search synonym object to be created/updated
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchSynonymSchema'
+ required: true
+ responses:
+ '200':
+ description: Created/updated search synonym
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchSynonym'
+ '404':
+ description: Search synonym was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - synonyms
+ summary: Delete a synonym associated with a collection
+ operationId: deleteSearchSynonym
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ - name: synonymId
+ in: path
+ description: The ID of the search synonym to delete
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: The ID of the deleted search synonym
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SearchSynonymDeleteResponse'
+ '404':
+ description: Search synonym not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}/documents/export:
+ get:
+ tags:
+ - documents
+ summary: Export all documents in a collection
+ description: Export all documents in a collection in JSON lines format.
+ operationId: exportDocuments
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ - name: filter_by
+ in: query
+ schema:
+ description: Filter conditions for refining your search results. Separate multiple conditions with &&.
+ type: string
+ - name: include_fields
+ in: query
+ schema:
+ description: List of fields from the document to include in the search result
+ type: string
+ - name: exclude_fields
+ in: query
+ schema:
+ description: List of fields from the document to exclude in the search result
+ type: string
+ responses:
+ '200':
+ description: Exports all the documents in a given collection.
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ example: |
+ {"id": "124", "company_name": "Stark Industries", "num_employees": 5215, "country": "US"}
+ {"id": "125", "company_name": "Future Technology", "num_employees": 1232,"country": "UK"}
+ {"id": "126", "company_name": "Random Corp.", "num_employees": 531,"country": "AU"}
+ '404':
+ description: The collection was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}/documents/import:
+ post:
+ tags:
+ - documents
+ summary: Import documents into a collection
+ description: The documents to be imported must be formatted in a newline delimited JSON structure. You can feed the output file from a Typesense export operation directly as import.
+ operationId: importDocuments
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection
+ required: true
+ schema:
+ type: string
+ - name: batch_size
+ in: query
+ schema:
+ type: integer
+ - name: return_id
+ in: query
+ schema:
+ type: boolean
+ description: Returning the id of the imported documents. If you want the import response to return the ingested document's id in the response, you can use the return_id parameter.
+ - name: remote_embedding_batch_size
+ in: query
+ schema:
+ type: integer
+ - name: return_doc
+ in: query
+ schema:
+ type: boolean
+ - name: action
+ in: query
+ schema:
+ $ref: '#/components/schemas/IndexAction'
+ - name: dirty_values
+ in: query
+ schema:
+ $ref: '#/components/schemas/DirtyValues'
+ requestBody:
+ description: The json array of documents or the JSONL file to import
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ description: The JSONL file to import
+ required: true
+ responses:
+ '200':
+ description: Result of the import operation. Each line of the response indicates the result of each document present in the request body (in the same order). If the import of a single document fails, it does not affect the other documents. If there is a failure, the response line will include a corresponding error message and as well as the actual document content.
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ example: |
+ {"success": true}
+ {"success": false, "error": "Bad JSON.", "document": "[bad doc"}
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '404':
+ description: The collection was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /collections/{collectionName}/documents/{documentId}:
+ get:
+ tags:
+ - documents
+ summary: Retreive a document
+ description: Fetch an individual document from a collection by using its ID.
+ operationId: getDocument
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to search for the document under
+ required: true
+ schema:
+ type: string
+ - name: documentId
+ in: path
+ description: The Document ID
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: The document referenced by the ID
+ content:
+ application/json:
+ schema:
+ type: object
+ description: Can be any key-value pair
+ '404':
+ description: The document or collection was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ patch:
+ tags:
+ - documents
+ summary: Update a document
+ description: Update an individual document from a collection by using its ID. The update can be partial.
+ operationId: updateDocument
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to search for the document under
+ required: true
+ schema:
+ type: string
+ - name: documentId
+ in: path
+ description: The Document ID
+ required: true
+ schema:
+ type: string
+ - name: dirty_values
+ in: query
+ description: Dealing with Dirty Data
+ schema:
+ $ref: '#/components/schemas/DirtyValues'
+ requestBody:
+ description: The document object with fields to be updated
+ content:
+ application/json:
+ schema:
+ type: object
+ description: Can be any key-value pair
+ x-go-type: interface{}
+ required: true
+ responses:
+ '200':
+ description: The document referenced by the ID was updated
+ content:
+ application/json:
+ schema:
+ type: object
+ description: Can be any key-value pair
+ '404':
+ description: The document or collection was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - documents
+ summary: Delete a document
+ description: Delete an individual document from a collection by using its ID.
+ operationId: deleteDocument
+ parameters:
+ - name: collectionName
+ in: path
+ description: The name of the collection to search for the document under
+ required: true
+ schema:
+ type: string
+ - name: documentId
+ in: path
+ description: The Document ID
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: The document referenced by the ID was deleted
+ content:
+ application/json:
+ schema:
+ type: object
+ description: Can be any key-value pair
+ '404':
+ description: The document or collection was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /conversations/models:
+ get:
+ description: Retrieve all conversation models
+ operationId: retrieveAllConversationModels
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ items:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ type: array
+ x-go-type: '[]*ConversationModelSchema'
+ description: List of all conversation models
+ summary: List all conversation models
+ tags:
+ - conversations
+ post:
+ description: Create a Conversation Model
+ operationId: createConversationModel
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelCreateSchema'
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ description: Created Conversation Model
+ '400':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ description: Bad request, see error message for details
+ tags:
+ - conversations
+ /conversations/models/{modelId}:
+ get:
+ description: Retrieve a conversation model
+ operationId: retrieveConversationModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The id of the conversation model to retrieve
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ description: A conversation model
+ summary: Retrieve a conversation model
+ tags:
+ - conversations
+ put:
+ description: Update a conversation model
+ operationId: updateConversationModel
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelUpdateSchema'
+ required: true
+ parameters:
+ - name: modelId
+ in: path
+ description: The id of the conversation model to update
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ description: The conversation model was successfully updated
+ summary: Update a conversation model
+ tags:
+ - conversations
+ delete:
+ description: Delete a conversation model
+ operationId: deleteConversationModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The id of the conversation model to delete
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ConversationModelSchema'
+ description: The conversation model was successfully deleted
+ summary: Delete a conversation model
+ tags:
+ - conversations
+ /keys:
+ get:
+ tags:
+ - keys
+ summary: Retrieve (metadata about) all keys.
+ operationId: getKeys
+ responses:
+ '200':
+ description: List of all keys
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiKeysResponse'
+ post:
+ tags:
+ - keys
+ summary: Create an API Key
+ description: Create an API Key with fine-grain access control. You can restrict access on both a per-collection and per-action level. The generated key is returned only during creation. You want to store this key carefully in a secure place.
+ operationId: createKey
+ requestBody:
+ description: The object that describes API key scope
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiKeySchema'
+ responses:
+ '201':
+ description: Created API key
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiKey'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '409':
+ description: API key generation conflict
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /keys/{keyId}:
+ get:
+ tags:
+ - keys
+ summary: Retrieve (metadata about) a key
+ description: Retrieve (metadata about) a key. Only the key prefix is returned when you retrieve a key. Due to security reasons, only the create endpoint returns the full API key.
+ operationId: getKey
+ parameters:
+ - name: keyId
+ in: path
+ description: The ID of the key to retrieve
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: The key referenced by the ID
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiKey'
+ '404':
+ description: The key was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - keys
+ summary: Delete an API key given its ID.
+ operationId: deleteKey
+ parameters:
+ - name: keyId
+ in: path
+ description: The ID of the key to delete
+ required: true
+ schema:
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: The key referenced by the ID
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiKeyDeleteResponse'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '404':
+ description: Key not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /aliases:
+ get:
+ tags:
+ - collections
+ summary: List all aliases
+ description: List all aliases and the corresponding collections that they map to.
+ operationId: getAliases
+ responses:
+ '200':
+ description: List of all collection aliases
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionAliasesResponse'
+ /aliases/{aliasName}:
+ put:
+ tags:
+ - collections
+ summary: Create or update a collection alias
+ description: Create or update a collection alias. An alias is a virtual collection name that points to a real collection. If you're familiar with symbolic links on Linux, it's very similar to that. Aliases are useful when you want to reindex your data in the background on a new collection and switch your application to it without any changes to your code.
+ operationId: upsertAlias
+ parameters:
+ - name: aliasName
+ in: path
+ description: The name of the alias to create/update
+ required: true
+ schema:
+ type: string
+ requestBody:
+ description: Collection alias to be created/updated
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionAliasSchema'
+ responses:
+ '200':
+ description: The collection alias was created/updated
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionAlias'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '404':
+ description: Alias not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ get:
+ tags:
+ - collections
+ summary: Retrieve an alias
+ description: Find out which collection an alias points to by fetching it
+ operationId: getAlias
+ parameters:
+ - name: aliasName
+ in: path
+ description: The name of the alias to retrieve
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Collection alias fetched
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionAlias'
+ '404':
+ description: The alias was not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - collections
+ summary: Delete an alias
+ operationId: deleteAlias
+ parameters:
+ - name: aliasName
+ in: path
+ description: The name of the alias to delete
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Collection alias was deleted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CollectionAlias'
+ '404':
+ description: Alias not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /debug:
+ get:
+ tags:
+ - debug
+ summary: Print debugging information
+ description: Print debugging information
+ operationId: debug
+ responses:
+ '200':
+ description: Debugging information
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ version:
+ type: string
+ /health:
+ get:
+ tags:
+ - health
+ summary: Checks if Typesense server is ready to accept requests.
+ description: Checks if Typesense server is ready to accept requests.
+ operationId: health
+ responses:
+ '200':
+ description: Search service is ready for requests.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HealthStatus'
+ /operations/schema_changes:
+ get:
+ tags:
+ - operations
+ summary: Get the status of in-progress schema change operations
+ description: Returns the status of any ongoing schema change operations. If no schema changes are in progress, returns an empty response.
+ operationId: getSchemaChanges
+ responses:
+ '200':
+ description: List of schema changes in progress
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/SchemaChangeStatus'
+ /operations/snapshot:
+ post:
+ tags:
+ - operations
+ summary: Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory.
+ description: Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory. You can then backup the snapshot directory that gets created and later restore it as a data directory, as needed.
+ operationId: takeSnapshot
+ parameters:
+ - name: snapshot_path
+ in: query
+ description: The directory on the server where the snapshot should be saved.
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: Snapshot is created.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SuccessStatus'
+ /operations/vote:
+ post:
+ tags:
+ - operations
+ summary: Triggers a follower node to initiate the raft voting process, which triggers leader re-election.
+ description: Triggers a follower node to initiate the raft voting process, which triggers leader re-election. The follower node that you run this operation against will become the new leader, once this command succeeds.
+ operationId: vote
+ responses:
+ '200':
+ description: Re-election is performed.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SuccessStatus'
+ /multi_search:
+ post:
+ operationId: multiSearch
+ tags:
+ - documents
+ summary: send multiple search requests in a single HTTP request
+ description: This is especially useful to avoid round-trip network latencies incurred otherwise if each of these requests are sent in separate HTTP requests. You can also use this feature to do a federated search across multiple collections in a single HTTP request.
+ parameters:
+ - name: q
+ in: query
+ schema:
+ description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by.
+ type: string
+ - name: query_by
+ in: query
+ schema:
+ description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma.
+ type: string
+ - name: query_by_weights
+ in: query
+ schema:
+ description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma.
+ type: string
+ - name: text_match_type
+ in: query
+ schema:
+ description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight.
+ type: string
+ - name: prefix
+ in: query
+ schema:
+ description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true.
+ type: string
+ - name: infix
+ in: query
+ schema:
+ description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results
+ type: string
+ - name: max_extra_prefix
+ in: query
+ schema:
+ description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
+ type: integer
+ - name: max_extra_suffix
+ in: query
+ schema:
+ description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
+ type: integer
+ - name: filter_by
+ in: query
+ schema:
+ description: Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&.
+ type: string
+ example: 'num_employees:>100 && country: [USA, UK]'
+ - name: sort_by
+ in: query
+ schema:
+ description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc`
+ type: string
+ - name: facet_by
+ in: query
+ schema:
+ description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma.
+ type: string
+ - name: max_facet_values
+ in: query
+ schema:
+ description: Maximum number of facet values to be returned.
+ type: integer
+ - name: facet_query
+ in: query
+ schema:
+ description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe".
+ type: string
+ - name: num_typos
+ in: query
+ schema:
+ description: |
+ The number of typographical errors (1 or 2) that would be tolerated. Default: 2
+ type: string
+ - name: page
+ in: query
+ schema:
+ description: Results from this specific page number would be fetched.
+ type: integer
+ - name: per_page
+ in: query
+ schema:
+ description: 'Number of results to fetch per page. Default: 10'
+ type: integer
+ - name: limit
+ in: query
+ schema:
+ description: |
+ Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10.
+ type: integer
+ - name: offset
+ in: query
+ schema:
+ description: Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter.
+ type: integer
+ - name: group_by
+ in: query
+ schema:
+ description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field.
+ type: string
+ - name: group_limit
+ in: query
+ schema:
+ description: |
+ Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3
+ type: integer
+ - name: group_missing_values
+ in: query
+ schema:
+ description: |
+ Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true
+ type: boolean
+ - name: include_fields
+ in: query
+ schema:
+ description: List of fields from the document to include in the search result
+ type: string
+ - name: exclude_fields
+ in: query
+ schema:
+ description: List of fields from the document to exclude in the search result
+ type: string
+ - name: highlight_full_fields
+ in: query
+ schema:
+ description: List of fields which should be highlighted fully without snippeting
+ type: string
+ - name: highlight_affix_num_tokens
+ in: query
+ schema:
+ description: |
+ The number of tokens that should surround the highlighted text on each side. Default: 4
+ type: integer
+ - name: highlight_start_tag
+ in: query
+ schema:
+ description: |
+ The start tag used for the highlighted snippets. Default: ``
+ type: string
+ - name: highlight_end_tag
+ in: query
+ schema:
+ description: |
+ The end tag used for the highlighted snippets. Default: ``
+ type: string
+ - name: snippet_threshold
+ in: query
+ schema:
+ description: |
+ Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30
+ type: integer
+ - name: drop_tokens_threshold
+ in: query
+ schema:
+ description: |
+ If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10
+ type: integer
+ - name: drop_tokens_mode
+ in: query
+ schema:
+ $ref: '#/components/schemas/DropTokensMode'
+ - name: typo_tokens_threshold
+ in: query
+ schema:
+ description: |
+ If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100
+ type: integer
+ - name: enable_typos_for_alpha_numerical_tokens
+ in: query
+ schema:
+ type: boolean
+ description: |
+ Set this parameter to false to disable typos on alphanumerical query tokens. Default: true.
+ - name: filter_curated_hits
+ in: query
+ schema:
+ type: boolean
+ description: |
+ Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false
+ - name: enable_synonyms
+ in: query
+ schema:
+ type: boolean
+ description: |
+ If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true
+ - name: synonym_prefix
+ in: query
+ schema:
+ type: boolean
+ description: |
+ Allow synonym resolution on word prefixes in the query. Default: false
+ - name: synonym_num_typos
+ in: query
+ schema:
+ type: integer
+ description: |
+ Allow synonym resolution on typo-corrected words in the query. Default: 0
+ - name: pinned_hits
+ in: query
+ schema:
+ description: |
+ A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`.
+ You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ type: string
+ - name: hidden_hits
+ in: query
+ schema:
+ description: |
+ A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`.
+ You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ type: string
+ - name: override_tags
+ in: query
+ schema:
+ description: Comma separated list of tags to trigger the curations rules that match the tags.
+ type: string
+ - name: highlight_fields
+ in: query
+ schema:
+ description: |
+ A list of custom fields that must be highlighted even if you don't query for them
+ type: string
+ - name: pre_segmented_query
+ in: query
+ schema:
+ description: |
+ You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying.
+ Set this parameter to true to do the same
+ type: boolean
+ default: false
+ - name: preset
+ in: query
+ schema:
+ description: |
+ Search using a bunch of search parameters by setting this parameter to the name of the existing Preset.
+ type: string
+ - name: enable_overrides
+ in: query
+ schema:
+ description: |
+ If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false
+ type: boolean
+ default: false
+ - name: prioritize_exact_match
+ in: query
+ schema:
+ description: |
+ Set this parameter to true to ensure that an exact match is ranked above the others
+ type: boolean
+ default: true
+ - name: prioritize_token_position
+ in: query
+ schema:
+ description: |
+ Make Typesense prioritize documents where the query words appear earlier in the text.
+ type: boolean
+ default: false
+ - name: prioritize_num_matching_fields
+ in: query
+ schema:
+ description: |
+ Make Typesense prioritize documents where the query words appear in more number of fields.
+ type: boolean
+ default: true
+ - name: enable_typos_for_numerical_tokens
+ in: query
+ schema:
+ description: |
+ Make Typesense disable typos for numerical tokens.
+ type: boolean
+ default: true
+ - name: exhaustive_search
+ in: query
+ schema:
+ description: |
+ Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored).
+ type: boolean
+ - name: search_cutoff_ms
+ in: query
+ schema:
+ description: |
+ Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter.
+ type: integer
+ - name: use_cache
+ in: query
+ schema:
+ description: |
+ Enable server side caching of search query results. By default, caching is disabled.
+ type: boolean
+ - name: cache_ttl
+ in: query
+ schema:
+ description: |
+ The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60.
+ type: integer
+ - name: min_len_1typo
+ in: query
+ schema:
+ description: |
+ Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ type: integer
+ - name: min_len_2typo
+ in: query
+ schema:
+ description: |
+ Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ type: integer
+ - name: vector_query
+ in: query
+ schema:
+ description: |
+ Vector query expression for fetching documents "closest" to a given query/document vector.
+ type: string
+ - name: remote_embedding_timeout_ms
+ in: query
+ schema:
+ description: |
+ Timeout (in milliseconds) for fetching remote embeddings.
+ type: integer
+ - name: remote_embedding_num_tries
+ in: query
+ schema:
+ description: |
+ Number of times to retry fetching remote embeddings.
+ type: integer
+ - name: facet_strategy
+ in: query
+ schema:
+ description: |
+ Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default).
+ type: string
+ - name: stopwords
+ in: query
+ schema:
+ description: |
+ Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query.
+ type: string
+ - name: facet_return_parent
+ in: query
+ schema:
+ description: |
+ Comma separated string of nested facet fields whose parent object should be returned in facet response.
+ type: string
+ - name: voice_query
+ in: query
+ schema:
+ description: |
+ The base64 encoded audio file in 16 khz 16-bit WAV format.
+ type: string
+ - name: conversation
+ in: query
+ schema:
+ description: |
+ Enable conversational search.
+ type: boolean
+ - name: conversation_model_id
+ in: query
+ schema:
+ description: |
+ The Id of Conversation Model to be used.
+ type: string
+ - name: conversation_id
+ in: query
+ schema:
+ description: |
+ The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM.
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MultiSearchSearchesParameter'
+ responses:
+ '200':
+ description: Search results
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MultiSearchResult'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /analytics/events:
+ post:
+ tags:
+ - analytics
+ summary: Create an analytics event
+ description: Sending events for analytics e.g rank search results based on popularity.
+ operationId: createAnalyticsEvent
+ requestBody:
+ description: The Analytics event to be created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsEventCreateSchema'
+ required: true
+ responses:
+ '201':
+ description: Analytics event successfully created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsEventCreateResponse'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /analytics/rules:
+ post:
+ tags:
+ - analytics
+ summary: Creates an analytics rule
+ description: When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection.
+ operationId: createAnalyticsRule
+ requestBody:
+ description: The Analytics rule to be created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsRuleSchema'
+ required: true
+ responses:
+ '201':
+ description: Analytics rule successfully created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsRuleSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ get:
+ tags:
+ - analytics
+ summary: Retrieves all analytics rules
+ description: Retrieve the details of all analytics rules
+ operationId: retrieveAnalyticsRules
+ responses:
+ '200':
+ description: Analytics rules fetched
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsRulesRetrieveSchema'
+ /analytics/rules/{ruleName}:
+ put:
+ tags:
+ - analytics
+ summary: Upserts an analytics rule
+ description: Upserts an analytics rule with the given name.
+ operationId: upsertAnalyticsRule
+ parameters:
+ - in: path
+ name: ruleName
+ description: The name of the analytics rule to upsert
+ schema:
+ type: string
+ required: true
+ requestBody:
+ description: The Analytics rule to be upserted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsRuleUpsertSchema'
+ required: true
+ responses:
+ '200':
+ description: Analytics rule successfully upserted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsRuleSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ get:
+ tags:
+ - analytics
+ summary: Retrieves an analytics rule
+ description: Retrieve the details of an analytics rule, given it's name
+ operationId: retrieveAnalyticsRule
+ parameters:
+ - in: path
+ name: ruleName
+ description: The name of the analytics rule to retrieve
+ schema:
+ type: string
+ required: true
+ responses:
+ '200':
+ description: Analytics rule fetched
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsRuleSchema'
+ '404':
+ description: Analytics rule not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - analytics
+ summary: Delete an analytics rule
+ description: Permanently deletes an analytics rule, given it's name
+ operationId: deleteAnalyticsRule
+ parameters:
+ - in: path
+ name: ruleName
+ description: The name of the analytics rule to delete
+ schema:
+ type: string
+ required: true
+ responses:
+ '200':
+ description: Analytics rule deleted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AnalyticsRuleDeleteResponse'
+ '404':
+ description: Analytics rule not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /metrics.json:
+ get:
+ tags:
+ - operations
+ summary: Get current RAM, CPU, Disk & Network usage metrics.
+ description: Retrieve the metrics.
+ operationId: retrieveMetrics
+ responses:
+ '200':
+ description: Metrics fetched.
+ content:
+ application/json:
+ schema:
+ type: object
+ /stats.json:
+ get:
+ tags:
+ - operations
+ summary: Get stats about API endpoints.
+ description: Retrieve the stats about API endpoints.
+ operationId: retrieveAPIStats
+ responses:
+ '200':
+ description: Stats fetched.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/APIStatsResponse'
+ /stopwords:
+ get:
+ tags:
+ - stopwords
+ summary: Retrieves all stopwords sets.
+ description: Retrieve the details of all stopwords sets
+ operationId: retrieveStopwordsSets
+ responses:
+ '200':
+ description: Stopwords sets fetched.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/StopwordsSetsRetrieveAllSchema'
+ /stopwords/{setId}:
+ put:
+ tags:
+ - stopwords
+ summary: Upserts a stopwords set.
+ description: When an analytics rule is created, we give it a name and describe the type, the source collections and the destination collection.
+ operationId: upsertStopwordsSet
+ parameters:
+ - in: path
+ name: setId
+ description: The ID of the stopwords set to upsert.
+ schema:
+ type: string
+ required: true
+ example: countries
+ requestBody:
+ description: The stopwords set to upsert.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/StopwordsSetUpsertSchema'
+ required: true
+ responses:
+ '200':
+ description: Stopwords set successfully upserted.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/StopwordsSetSchema'
+ '400':
+ description: Bad request, see error message for details.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ get:
+ tags:
+ - stopwords
+ summary: Retrieves a stopwords set.
+ description: Retrieve the details of a stopwords set, given it's name.
+ operationId: retrieveStopwordsSet
+ parameters:
+ - in: path
+ name: setId
+ description: The ID of the stopwords set to retrieve.
+ schema:
+ type: string
+ required: true
+ example: countries
+ responses:
+ '200':
+ description: Stopwords set fetched.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/StopwordsSetRetrieveSchema'
+ '404':
+ description: Stopwords set not found.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - stopwords
+ summary: Delete a stopwords set.
+ description: Permanently deletes a stopwords set, given it's name.
+ operationId: deleteStopwordsSet
+ parameters:
+ - in: path
+ name: setId
+ description: The ID of the stopwords set to delete.
+ schema:
+ type: string
+ required: true
+ example: countries
+ responses:
+ '200':
+ description: Stopwords set rule deleted.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: string
+ required:
+ - id
+ example: |
+ {"id": "countries"}
+ '404':
+ description: Stopwords set not found.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /presets:
+ get:
+ tags:
+ - presets
+ summary: Retrieves all presets.
+ description: Retrieve the details of all presets
+ operationId: retrieveAllPresets
+ responses:
+ '200':
+ description: Presets fetched.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetsRetrieveSchema'
+ /presets/{presetId}:
+ get:
+ tags:
+ - presets
+ summary: Retrieves a preset.
+ description: Retrieve the details of a preset, given it's name.
+ operationId: retrievePreset
+ parameters:
+ - in: path
+ name: presetId
+ description: The ID of the preset to retrieve.
+ schema:
+ type: string
+ required: true
+ example: listing_view
+ responses:
+ '200':
+ description: Preset fetched.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetSchema'
+ '404':
+ description: Preset not found.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ put:
+ tags:
+ - presets
+ summary: Upserts a preset.
+ description: Create or update an existing preset.
+ operationId: upsertPreset
+ parameters:
+ - in: path
+ name: presetId
+ description: The name of the preset set to upsert.
+ schema:
+ type: string
+ required: true
+ example: listing_view
+ requestBody:
+ description: The stopwords set to upsert.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetUpsertSchema'
+ required: true
+ responses:
+ '200':
+ description: Preset successfully upserted.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - presets
+ summary: Delete a preset.
+ description: Permanently deletes a preset, given it's name.
+ operationId: deletePreset
+ parameters:
+ - in: path
+ name: presetId
+ description: The ID of the preset to delete.
+ schema:
+ type: string
+ required: true
+ example: listing_view
+ responses:
+ '200':
+ description: Preset deleted.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PresetDeleteSchema'
+ '404':
+ description: Preset not found.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /stemming/dictionaries:
+ get:
+ tags:
+ - stemming
+ summary: List all stemming dictionaries
+ description: Retrieve a list of all available stemming dictionaries.
+ operationId: listStemmingDictionaries
+ responses:
+ '200':
+ description: List of all dictionaries
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ dictionaries:
+ type: array
+ items:
+ type: string
+ example:
+ - irregular-plurals
+ - company-terms
+ /stemming/dictionaries/{dictionaryId}:
+ get:
+ tags:
+ - stemming
+ summary: Retrieve a stemming dictionary
+ description: Fetch details of a specific stemming dictionary.
+ operationId: getStemmingDictionary
+ parameters:
+ - name: dictionaryId
+ in: path
+ description: The ID of the dictionary to retrieve
+ required: true
+ schema:
+ type: string
+ example: irregular-plurals
+ responses:
+ '200':
+ description: Stemming dictionary details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/StemmingDictionary'
+ '404':
+ description: Dictionary not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /stemming/dictionaries/import:
+ post:
+ tags:
+ - stemming
+ summary: Import a stemming dictionary
+ description: Upload a JSONL file containing word mappings to create or update a stemming dictionary.
+ operationId: importStemmingDictionary
+ parameters:
+ - name: id
+ in: query
+ description: The ID to assign to the dictionary
+ required: true
+ schema:
+ type: string
+ example: irregular-plurals
+ requestBody:
+ description: The JSONL file containing word mappings
+ required: true
+ content:
+ application/json:
+ schema:
+ type: string
+ example: |
+ {"word": "people", "root": "person"}
+ {"word": "children", "root": "child"}
+ responses:
+ '200':
+ description: Dictionary successfully imported
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ example: |
+ {"word": "people", "root": "person"} {"word": "children", "root": "child"}
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /nl_search_models:
+ get:
+ tags:
+ - nl_search_models
+ summary: List all NL search models
+ description: Retrieve all NL search models.
+ operationId: retrieveAllNLSearchModels
+ responses:
+ '200':
+ description: List of all NL search models
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/NLSearchModelSchema'
+ post:
+ tags:
+ - nl_search_models
+ summary: Create a NL search model
+ description: Create a new NL search model.
+ operationId: createNLSearchModel
+ requestBody:
+ description: The NL search model to be created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelCreateSchema'
+ required: true
+ responses:
+ '201':
+ description: NL search model successfully created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ /nl_search_models/{modelId}:
+ get:
+ tags:
+ - nl_search_models
+ summary: Retrieve a NL search model
+ description: Retrieve a specific NL search model by its ID.
+ operationId: retrieveNLSearchModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The ID of the NL search model to retrieve
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: NL search model fetched
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelSchema'
+ '404':
+ description: NL search model not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ put:
+ tags:
+ - nl_search_models
+ summary: Update a NL search model
+ description: Update an existing NL search model.
+ operationId: updateNLSearchModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The ID of the NL search model to update
+ required: true
+ schema:
+ type: string
+ requestBody:
+ description: The NL search model fields to update
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelUpdateSchema'
+ required: true
+ responses:
+ '200':
+ description: NL search model successfully updated
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelSchema'
+ '400':
+ description: Bad request, see error message for details
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ '404':
+ description: NL search model not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+ delete:
+ tags:
+ - nl_search_models
+ summary: Delete a NL search model
+ description: Delete a specific NL search model by its ID.
+ operationId: deleteNLSearchModel
+ parameters:
+ - name: modelId
+ in: path
+ description: The ID of the NL search model to delete
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: NL search model successfully deleted
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NLSearchModelDeleteSchema'
+ '404':
+ description: NL search model not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ApiResponse'
+components:
+ schemas:
+ CollectionSchema:
+ required:
+ - name
+ - fields
+ type: object
+ properties:
+ name:
+ type: string
+ description: Name of the collection
+ example: companies
+ fields:
+ type: array
+ description: A list of fields for querying, filtering and faceting
+ example:
+ - name: num_employees
+ type: int32
+ facet: false
+ - name: company_name
+ type: string
+ facet: false
+ - name: country
+ type: string
+ facet: true
+ items:
+ $ref: '#/components/schemas/Field'
+ default_sorting_field:
+ type: string
+ description: The name of an int32 / float field that determines the order in which the search results are ranked when a sort_by clause is not provided during searching. This field must indicate some kind of popularity.
+ example: num_employees
+ default: ''
+ token_separators:
+ type: array
+ description: |
+ List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters.
+ items:
+ type: string
+ minLength: 1
+ maxLength: 1
+ default: []
+ enable_nested_fields:
+ type: boolean
+ description: Enables experimental support at a collection level for nested object or object array fields. This field is only available if the Typesense server is version `0.24.0.rcn34` or later.
+ default: false
+ example: true
+ symbols_to_index:
+ type: array
+ description: |
+ List of symbols or special characters to be indexed.
+ items:
+ type: string
+ minLength: 1
+ maxLength: 1
+ default: []
+ voice_query_model:
+ $ref: '#/components/schemas/VoiceQueryModelCollectionConfig'
+ CollectionUpdateSchema:
+ required:
+ - fields
+ type: object
+ properties:
+ fields:
+ type: array
+ description: A list of fields for querying, filtering and faceting
+ example:
+ - name: company_name
+ type: string
+ facet: false
+ - name: num_employees
+ type: int32
+ facet: false
+ - name: country
+ type: string
+ facet: true
+ items:
+ $ref: '#/components/schemas/Field'
+ CollectionResponse:
+ allOf:
+ - $ref: '#/components/schemas/CollectionSchema'
+ - type: object
+ required:
+ - num_documents
+ - created_at
+ properties:
+ num_documents:
+ type: integer
+ description: Number of documents in the collection
+ format: int64
+ readOnly: true
+ created_at:
+ type: integer
+ description: Timestamp of when the collection was created (Unix epoch in seconds)
+ format: int64
+ readOnly: true
+ Field:
+ required:
+ - name
+ - type
+ type: object
+ properties:
+ name:
+ type: string
+ example: company_name
+ type:
+ type: string
+ example: string
+ optional:
+ type: boolean
+ example: true
+ facet:
+ type: boolean
+ example: false
+ index:
+ type: boolean
+ example: true
+ default: true
+ locale:
+ type: string
+ example: el
+ sort:
+ type: boolean
+ example: true
+ infix:
+ type: boolean
+ example: true
+ default: false
+ reference:
+ type: string
+ description: |
+ Name of a field in another collection that should be linked to this collection so that it can be joined during query.
+ num_dim:
+ type: integer
+ example: 256
+ drop:
+ type: boolean
+ example: true
+ store:
+ type: boolean
+ description: |
+ When set to false, the field value will not be stored on disk. Default: true.
+ vec_dist:
+ type: string
+ description: |
+ The distance metric to be used for vector search. Default: `cosine`. You can also use `ip` for inner product.
+ range_index:
+ type: boolean
+ description: |
+ Enables an index optimized for range filtering on numerical fields (e.g. rating:>3.5). Default: false.
+ stem:
+ type: boolean
+ description: |
+ Values are stemmed before indexing in-memory. Default: false.
+ stem_dictionary:
+ type: string
+ description: Name of the stemming dictionary to use for this field
+ example: irregular-plurals
+ token_separators:
+ type: array
+ description: |
+ List of symbols or special characters to be used for splitting the text into individual words in addition to space and new-line characters.
+ items:
+ type: string
+ minLength: 1
+ maxLength: 1
+ default: []
+ symbols_to_index:
+ type: array
+ description: |
+ List of symbols or special characters to be indexed.
+ items:
+ type: string
+ minLength: 1
+ maxLength: 1
+ default: []
+ embed:
+ type: object
+ required:
+ - from
+ - model_config
+ properties:
+ from:
+ type: array
+ items:
+ type: string
+ model_config:
+ type: object
+ required:
+ - model_name
+ properties:
+ model_name:
+ type: string
+ api_key:
+ type: string
+ url:
+ type: string
+ access_token:
+ type: string
+ refresh_token:
+ type: string
+ client_id:
+ type: string
+ client_secret:
+ type: string
+ project_id:
+ type: string
+ indexing_prefix:
+ type: string
+ query_prefix:
+ type: string
+ VoiceQueryModelCollectionConfig:
+ type: object
+ description: |
+ Configuration for the voice query model
+ properties:
+ model_name:
+ type: string
+ example: ts/whisper/base.en
+ CollectionAliasSchema:
+ type: object
+ required:
+ - collection_name
+ properties:
+ collection_name:
+ type: string
+ description: Name of the collection you wish to map the alias to
+ CollectionAlias:
+ type: object
+ required:
+ - collection_name
+ - name
+ properties:
+ name:
+ type: string
+ readOnly: true
+ description: Name of the collection alias
+ collection_name:
+ type: string
+ description: Name of the collection the alias mapped to
+ CollectionAliasesResponse:
+ type: object
+ required:
+ - aliases
+ properties:
+ aliases:
+ type: array
+ x-go-type: '[]*CollectionAlias'
+ items:
+ $ref: '#/components/schemas/CollectionAlias'
+ SearchResult:
+ type: object
+ properties:
+ facet_counts:
+ type: array
+ items:
+ $ref: '#/components/schemas/FacetCounts'
+ found:
+ type: integer
+ description: The number of documents found
+ found_docs:
+ type: integer
+ search_time_ms:
+ type: integer
+ description: The number of milliseconds the search took
+ out_of:
+ type: integer
+ description: The total number of documents in the collection
+ search_cutoff:
+ type: boolean
+ description: Whether the search was cut off
+ page:
+ type: integer
+ description: The search result page number
+ grouped_hits:
+ type: array
+ items:
+ $ref: '#/components/schemas/SearchGroupedHit'
+ hits:
+ type: array
+ description: The documents that matched the search query
+ items:
+ $ref: '#/components/schemas/SearchResultHit'
+ request_params:
+ type: object
+ required:
+ - collection_name
+ - q
+ - per_page
+ properties:
+ collection_name:
+ type: string
+ q:
+ type: string
+ per_page:
+ type: integer
+ voice_query:
+ type: object
+ properties:
+ transcribed_query:
+ type: string
+ conversation:
+ $ref: '#/components/schemas/SearchResultConversation'
+ SearchResultConversation:
+ type: object
+ required:
+ - answer
+ - conversation_history
+ - conversation_id
+ - query
+ properties:
+ answer:
+ type: string
+ conversation_history:
+ type: array
+ items:
+ type: object
+ conversation_id:
+ type: string
+ query:
+ type: string
+ SearchGroupedHit:
+ type: object
+ required:
+ - group_key
+ - hits
+ properties:
+ found:
+ type: integer
+ group_key:
+ type: array
+ items: {}
+ hits:
+ type: array
+ description: The documents that matched the search query
+ items:
+ $ref: '#/components/schemas/SearchResultHit'
+ SearchResultHit:
+ type: object
+ properties:
+ highlights:
+ type: array
+ description: (Deprecated) Contains highlighted portions of the search fields
+ items:
+ $ref: '#/components/schemas/SearchHighlight'
+ highlight:
+ type: object
+ description: Highlighted version of the matching document
+ additionalProperties: true
+ document:
+ type: object
+ description: Can be any key-value pair
+ text_match:
+ type: integer
+ format: int64
+ text_match_info:
+ type: object
+ properties:
+ best_field_score:
+ type: string
+ best_field_weight:
+ type: integer
+ fields_matched:
+ type: integer
+ num_tokens_dropped:
+ type: integer
+ format: int64
+ x-go-type: uint64
+ score:
+ type: string
+ tokens_matched:
+ type: integer
+ typo_prefix_score:
+ type: integer
+ geo_distance_meters:
+ type: object
+ description: Can be any key-value pair
+ additionalProperties:
+ type: integer
+ vector_distance:
+ type: number
+ format: float
+ description: Distance between the query vector and matching document's vector value
+ example:
+ highlights:
+ company_name:
+ field: company_name
+ snippet: Stark Industries
+ document:
+ id: '124'
+ company_name: Stark Industries
+ num_employees: 5215
+ country: USA
+ text_match: 1234556
+ SearchHighlight:
+ type: object
+ properties:
+ field:
+ type: string
+ example: company_name
+ snippet:
+ type: string
+ description: Present only for (non-array) string fields
+ example: Stark Industries
+ snippets:
+ type: array
+ description: Present only for (array) string[] fields
+ example:
+ - Stark Industries
+ - Stark Corp
+ items:
+ type: string
+ value:
+ type: string
+ description: Full field value with highlighting, present only for (non-array) string fields
+ example: Stark Industries is a major supplier of space equipment.
+ values:
+ type: array
+ description: Full field value with highlighting, present only for (array) string[] fields
+ example:
+ - Stark Industries
+ - Stark Corp
+ items:
+ type: string
+ indices:
+ type: array
+ description: The indices property will be present only for string[] fields and will contain the corresponding indices of the snippets in the search field
+ example: 1
+ items:
+ type: integer
+ matched_tokens:
+ type: array
+ items:
+ type: object
+ x-go-type: interface{}
+ SearchOverrideSchema:
+ type: object
+ required:
+ - rule
+ properties:
+ rule:
+ $ref: '#/components/schemas/SearchOverrideRule'
+ includes:
+ type: array
+ description: List of document `id`s that should be included in the search results with their corresponding `position`s.
+ items:
+ $ref: '#/components/schemas/SearchOverrideInclude'
+ excludes:
+ type: array
+ description: List of document `id`s that should be excluded from the search results.
+ items:
+ $ref: '#/components/schemas/SearchOverrideExclude'
+ filter_by:
+ type: string
+ description: |
+ A filter by clause that is applied to any search query that matches the override rule.
+ remove_matched_tokens:
+ type: boolean
+ description: |
+ Indicates whether search query tokens that exist in the override's rule should be removed from the search query.
+ metadata:
+ type: object
+ description: |
+ Return a custom JSON object in the Search API response, when this rule is triggered. This can can be used to display a pre-defined message (eg: a promotion banner) on the front-end when a particular rule is triggered.
+ sort_by:
+ type: string
+ description: |
+ A sort by clause that is applied to any search query that matches the override rule.
+ replace_query:
+ type: string
+ description: |
+ Replaces the current search query with this value, when the search query matches the override rule.
+ filter_curated_hits:
+ type: boolean
+ description: |
+ When set to true, the filter conditions of the query is applied to the curated records as well. Default: false.
+ effective_from_ts:
+ type: integer
+ description: |
+ A Unix timestamp that indicates the date/time from which the override will be active. You can use this to create override rules that start applying from a future point in time.
+ effective_to_ts:
+ type: integer
+ description: |
+ A Unix timestamp that indicates the date/time until which the override will be active. You can use this to create override rules that stop applying after a period of time.
+ stop_processing:
+ type: boolean
+ description: |
+ When set to true, override processing will stop at the first matching rule. When set to false override processing will continue and multiple override actions will be triggered in sequence. Overrides are processed in the lexical sort order of their id field. Default: true.
+ SearchOverride:
+ allOf:
+ - $ref: '#/components/schemas/SearchOverrideSchema'
+ - type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ readOnly: true
+ SearchOverrideDeleteResponse:
+ type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: The id of the override that was deleted
+ SearchOverrideRule:
+ type: object
+ properties:
+ tags:
+ type: array
+ description: List of tag values to associate with this override rule.
+ items:
+ type: string
+ query:
+ type: string
+ description: Indicates what search queries should be overridden
+ match:
+ type: string
+ description: |
+ Indicates whether the match on the query term should be `exact` or `contains`. If we want to match all queries that contained the word `apple`, we will use the `contains` match instead.
+ enum:
+ - exact
+ - contains
+ filter_by:
+ type: string
+ description: |
+ Indicates that the override should apply when the filter_by parameter in a search query exactly matches the string specified here (including backticks, spaces, brackets, etc).
+ SearchOverrideInclude:
+ type: object
+ required:
+ - id
+ - position
+ properties:
+ id:
+ type: string
+ description: document id that should be included
+ position:
+ type: integer
+ description: position number where document should be included in the search results
+ SearchOverrideExclude:
+ type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: document id that should be excluded from the search results.
+ SearchOverridesResponse:
+ type: object
+ required:
+ - overrides
+ properties:
+ overrides:
+ type: array
+ x-go-type: '[]*SearchOverride'
+ items:
+ $ref: '#/components/schemas/SearchOverride'
+ SearchSynonymSchema:
+ type: object
+ required:
+ - synonyms
+ properties:
+ root:
+ type: string
+ description: For 1-way synonyms, indicates the root word that words in the `synonyms` parameter map to.
+ synonyms:
+ type: array
+ description: Array of words that should be considered as synonyms.
+ items:
+ type: string
+ locale:
+ type: string
+ description: Locale for the synonym, leave blank to use the standard tokenizer.
+ symbols_to_index:
+ type: array
+ description: By default, special characters are dropped from synonyms. Use this attribute to specify which special characters should be indexed as is.
+ items:
+ type: string
+ SearchSynonym:
+ allOf:
+ - $ref: '#/components/schemas/SearchSynonymSchema'
+ - type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ readOnly: true
+ SearchSynonymDeleteResponse:
+ type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: The id of the synonym that was deleted
+ SearchSynonymsResponse:
+ type: object
+ required:
+ - synonyms
+ properties:
+ synonyms:
+ type: array
+ x-go-type: '[]*SearchSynonym'
+ items:
+ $ref: '#/components/schemas/SearchSynonym'
+ HealthStatus:
+ type: object
+ required:
+ - ok
+ properties:
+ ok:
+ type: boolean
+ SchemaChangeStatus:
+ type: object
+ properties:
+ collection:
+ type: string
+ description: Name of the collection being modified
+ validated_docs:
+ type: integer
+ description: Number of documents that have been validated
+ altered_docs:
+ type: integer
+ description: Number of documents that have been altered
+ SuccessStatus:
+ type: object
+ required:
+ - success
+ properties:
+ success:
+ type: boolean
+ ApiResponse:
+ type: object
+ required:
+ - message
+ properties:
+ message:
+ type: string
+ ApiKeySchema:
+ type: object
+ required:
+ - actions
+ - collections
+ - description
+ properties:
+ value:
+ type: string
+ description:
+ type: string
+ actions:
+ type: array
+ items:
+ type: string
+ collections:
+ type: array
+ items:
+ type: string
+ expires_at:
+ type: integer
+ format: int64
+ ApiKey:
+ allOf:
+ - $ref: '#/components/schemas/ApiKeySchema'
+ - type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ readOnly: true
+ value_prefix:
+ type: string
+ readOnly: true
+ ApiKeyDeleteResponse:
+ type: object
+ required:
+ - id
+ properties:
+ id:
+ type: integer
+ format: int64
+ description: The id of the API key that was deleted
+ ApiKeysResponse:
+ type: object
+ required:
+ - keys
+ properties:
+ keys:
+ type: array
+ x-go-type: '[]*ApiKey'
+ items:
+ $ref: '#/components/schemas/ApiKey'
+ ScopedKeyParameters:
+ type: object
+ properties:
+ filter_by:
+ type: string
+ expires_at:
+ type: integer
+ format: int64
+ SnapshotParameters:
+ type: object
+ properties:
+ snapshot_path:
+ type: string
+ ErrorResponse:
+ type: object
+ properties:
+ message:
+ type: string
+ MultiSearchResult:
+ type: object
+ required:
+ - results
+ properties:
+ results:
+ type: array
+ items:
+ $ref: '#/components/schemas/MultiSearchResultItem'
+ conversation:
+ $ref: '#/components/schemas/SearchResultConversation'
+ MultiSearchResultItem:
+ allOf:
+ - $ref: '#/components/schemas/SearchResult'
+ - type: object
+ properties:
+ code:
+ type: integer
+ description: HTTP error code
+ format: int64
+ error:
+ type: string
+ description: Error description
+ SearchParameters:
+ type: object
+ properties:
+ q:
+ description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by.
+ type: string
+ query_by:
+ description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma.
+ type: string
+ nl_query:
+ description: Whether to use natural language processing to parse the query.
+ type: boolean
+ nl_model_id:
+ description: The ID of the natural language model to use.
+ type: string
+ query_by_weights:
+ description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma.
+ type: string
+ text_match_type:
+ description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight.
+ type: string
+ prefix:
+ description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true.
+ type: string
+ infix:
+ description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results
+ type: string
+ max_extra_prefix:
+ description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
+ type: integer
+ max_extra_suffix:
+ description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
+ type: integer
+ filter_by:
+ description: Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&.
+ type: string
+ example: 'num_employees:>100 && country: [USA, UK]'
+ max_filter_by_candidates:
+ description: Controls the number of similar words that Typesense considers during fuzzy search on filter_by values. Useful for controlling prefix matches like company_name:Acm*.
+ type: integer
+ sort_by:
+ description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc`
+ type: string
+ example: num_employees:desc
+ facet_by:
+ description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma.
+ type: string
+ max_facet_values:
+ description: Maximum number of facet values to be returned.
+ type: integer
+ facet_query:
+ description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe".
+ type: string
+ num_typos:
+ description: |
+ The number of typographical errors (1 or 2) that would be tolerated. Default: 2
+ type: string
+ page:
+ description: Results from this specific page number would be fetched.
+ type: integer
+ per_page:
+ description: 'Number of results to fetch per page. Default: 10'
+ type: integer
+ limit:
+ description: |
+ Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10.
+ type: integer
+ offset:
+ description: Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter.
+ type: integer
+ group_by:
+ description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field.
+ type: string
+ group_limit:
+ description: |
+ Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3
+ type: integer
+ group_missing_values:
+ description: |
+ Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true
+ type: boolean
+ include_fields:
+ description: List of fields from the document to include in the search result
+ type: string
+ exclude_fields:
+ description: List of fields from the document to exclude in the search result
+ type: string
+ highlight_full_fields:
+ description: List of fields which should be highlighted fully without snippeting
+ type: string
+ highlight_affix_num_tokens:
+ description: |
+ The number of tokens that should surround the highlighted text on each side. Default: 4
+ type: integer
+ highlight_start_tag:
+ description: |
+ The start tag used for the highlighted snippets. Default: ``
+ type: string
+ highlight_end_tag:
+ description: |
+ The end tag used for the highlighted snippets. Default: ``
+ type: string
+ enable_highlight_v1:
+ description: |
+ Flag for enabling/disabling the deprecated, old highlight structure in the response. Default: true
+ type: boolean
+ default: true
+ snippet_threshold:
+ description: |
+ Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30
+ type: integer
+ drop_tokens_threshold:
+ description: |
+ If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10
+ type: integer
+ drop_tokens_mode:
+ $ref: '#/components/schemas/DropTokensMode'
+ typo_tokens_threshold:
+ description: |
+ If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100
+ type: integer
+ enable_typos_for_alpha_numerical_tokens:
+ type: boolean
+ description: |
+ Set this parameter to false to disable typos on alphanumerical query tokens. Default: true.
+ filter_curated_hits:
+ type: boolean
+ description: |
+ Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false
+ enable_synonyms:
+ type: boolean
+ description: |
+ If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true
+ synonym_prefix:
+ type: boolean
+ description: |
+ Allow synonym resolution on word prefixes in the query. Default: false
+ synonym_num_typos:
+ type: integer
+ description: |
+ Allow synonym resolution on typo-corrected words in the query. Default: 0
+ pinned_hits:
+ description: |
+ A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`.
+ You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ type: string
+ hidden_hits:
+ description: |
+ A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`.
+ You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ type: string
+ override_tags:
+ description: Comma separated list of tags to trigger the curations rules that match the tags.
+ type: string
+ highlight_fields:
+ description: |
+ A list of custom fields that must be highlighted even if you don't query for them
+ type: string
+ split_join_tokens:
+ description: |
+ Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`.
+ type: string
+ pre_segmented_query:
+ description: |
+ You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying.
+ Set this parameter to true to do the same
+ type: boolean
+ preset:
+ description: |
+ Search using a bunch of search parameters by setting this parameter to the name of the existing Preset.
+ type: string
+ enable_overrides:
+ description: |
+ If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false
+ type: boolean
+ default: false
+ prioritize_exact_match:
+ description: |
+ Set this parameter to true to ensure that an exact match is ranked above the others
+ type: boolean
+ default: true
+ max_candidates:
+ description: |
+ Control the number of words that Typesense considers for typo and prefix searching.
+ type: integer
+ prioritize_token_position:
+ description: |
+ Make Typesense prioritize documents where the query words appear earlier in the text.
+ type: boolean
+ default: false
+ prioritize_num_matching_fields:
+ description: |
+ Make Typesense prioritize documents where the query words appear in more number of fields.
+ type: boolean
+ default: true
+ enable_typos_for_numerical_tokens:
+ description: |
+ Make Typesense disable typos for numerical tokens.
+ type: boolean
+ default: true
+ exhaustive_search:
+ description: |
+ Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored).
+ type: boolean
+ search_cutoff_ms:
+ description: |
+ Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter.
+ type: integer
+ use_cache:
+ description: |
+ Enable server side caching of search query results. By default, caching is disabled.
+ type: boolean
+ cache_ttl:
+ description: |
+ The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60.
+ type: integer
+ min_len_1typo:
+ description: |
+ Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ type: integer
+ min_len_2typo:
+ description: |
+ Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ type: integer
+ vector_query:
+ description: |
+ Vector query expression for fetching documents "closest" to a given query/document vector.
+ type: string
+ remote_embedding_timeout_ms:
+ description: |
+ Timeout (in milliseconds) for fetching remote embeddings.
+ type: integer
+ remote_embedding_num_tries:
+ description: |
+ Number of times to retry fetching remote embeddings.
+ type: integer
+ facet_strategy:
+ description: |
+ Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default).
+ type: string
+ stopwords:
+ description: |
+ Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query.
+ type: string
+ facet_return_parent:
+ description: |
+ Comma separated string of nested facet fields whose parent object should be returned in facet response.
+ type: string
+ voice_query:
+ description: |
+ The base64 encoded audio file in 16 khz 16-bit WAV format.
+ type: string
+ conversation:
+ description: |
+ Enable conversational search.
+ type: boolean
+ conversation_model_id:
+ description: |
+ The Id of Conversation Model to be used.
+ type: string
+ conversation_id:
+ description: |
+ The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM.
+ type: string
+ MultiSearchParameters:
+ description: |
+ Parameters for the multi search API.
+ type: object
+ properties:
+ q:
+ description: The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by.
+ type: string
+ query_by:
+ description: A list of `string` fields that should be queried against. Multiple fields are separated with a comma.
+ type: string
+ query_by_weights:
+ description: The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma.
+ type: string
+ text_match_type:
+ description: In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight.
+ type: string
+ prefix:
+ description: Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true.
+ type: string
+ infix:
+ description: If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results
+ type: string
+ max_extra_prefix:
+ description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
+ type: integer
+ max_extra_suffix:
+ description: There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query "K2100" has 2 extra symbols in "6PK2100". By default, any number of prefixes/suffixes can be present for a match.
+ type: integer
+ filter_by:
+ description: Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&.
+ type: string
+ example: 'num_employees:>100 && country: [USA, UK]'
+ sort_by:
+ description: A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc`
+ type: string
+ facet_by:
+ description: A list of fields that will be used for faceting your results on. Separate multiple fields with a comma.
+ type: string
+ max_facet_values:
+ description: Maximum number of facet values to be returned.
+ type: integer
+ facet_query:
+ description: Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix "shoe".
+ type: string
+ num_typos:
+ description: |
+ The number of typographical errors (1 or 2) that would be tolerated. Default: 2
+ type: string
+ page:
+ description: Results from this specific page number would be fetched.
+ type: integer
+ per_page:
+ description: 'Number of results to fetch per page. Default: 10'
+ type: integer
+ limit:
+ description: |
+ Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10.
+ type: integer
+ offset:
+ description: Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter.
+ type: integer
+ group_by:
+ description: You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field.
+ type: string
+ group_limit:
+ description: |
+ Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3
+ type: integer
+ group_missing_values:
+ description: |
+ Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true
+ type: boolean
+ include_fields:
+ description: List of fields from the document to include in the search result
+ type: string
+ exclude_fields:
+ description: List of fields from the document to exclude in the search result
+ type: string
+ highlight_full_fields:
+ description: List of fields which should be highlighted fully without snippeting
+ type: string
+ highlight_affix_num_tokens:
+ description: |
+ The number of tokens that should surround the highlighted text on each side. Default: 4
+ type: integer
+ highlight_start_tag:
+ description: |
+ The start tag used for the highlighted snippets. Default: ``
+ type: string
+ highlight_end_tag:
+ description: |
+ The end tag used for the highlighted snippets. Default: ``
+ type: string
+ snippet_threshold:
+ description: |
+ Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30
+ type: integer
+ drop_tokens_threshold:
+ description: |
+ If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10
+ type: integer
+ drop_tokens_mode:
+ $ref: '#/components/schemas/DropTokensMode'
+ typo_tokens_threshold:
+ description: |
+ If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100
+ type: integer
+ enable_typos_for_alpha_numerical_tokens:
+ type: boolean
+ description: |
+ Set this parameter to false to disable typos on alphanumerical query tokens. Default: true.
+ filter_curated_hits:
+ type: boolean
+ description: |
+ Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false
+ enable_synonyms:
+ type: boolean
+ description: |
+ If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true
+ synonym_prefix:
+ type: boolean
+ description: |
+ Allow synonym resolution on word prefixes in the query. Default: false
+ synonym_num_typos:
+ type: integer
+ description: |
+ Allow synonym resolution on typo-corrected words in the query. Default: 0
+ pinned_hits:
+ description: |
+ A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`.
+ You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ type: string
+ hidden_hits:
+ description: |
+ A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`.
+ You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ type: string
+ override_tags:
+ description: Comma separated list of tags to trigger the curations rules that match the tags.
+ type: string
+ highlight_fields:
+ description: |
+ A list of custom fields that must be highlighted even if you don't query for them
+ type: string
+ pre_segmented_query:
+ description: |
+ You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying.
+ Set this parameter to true to do the same
+ type: boolean
+ default: false
+ preset:
+ description: |
+ Search using a bunch of search parameters by setting this parameter to the name of the existing Preset.
+ type: string
+ enable_overrides:
+ description: |
+ If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false
+ type: boolean
+ default: false
+ prioritize_exact_match:
+ description: |
+ Set this parameter to true to ensure that an exact match is ranked above the others
+ type: boolean
+ default: true
+ prioritize_token_position:
+ description: |
+ Make Typesense prioritize documents where the query words appear earlier in the text.
+ type: boolean
+ default: false
+ prioritize_num_matching_fields:
+ description: |
+ Make Typesense prioritize documents where the query words appear in more number of fields.
+ type: boolean
+ default: true
+ enable_typos_for_numerical_tokens:
+ description: |
+ Make Typesense disable typos for numerical tokens.
+ type: boolean
+ default: true
+ exhaustive_search:
+ description: |
+ Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored).
+ type: boolean
+ search_cutoff_ms:
+ description: |
+ Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter.
+ type: integer
+ use_cache:
+ description: |
+ Enable server side caching of search query results. By default, caching is disabled.
+ type: boolean
+ cache_ttl:
+ description: |
+ The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60.
+ type: integer
+ min_len_1typo:
+ description: |
+ Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ type: integer
+ min_len_2typo:
+ description: |
+ Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ type: integer
+ vector_query:
+ description: |
+ Vector query expression for fetching documents "closest" to a given query/document vector.
+ type: string
+ remote_embedding_timeout_ms:
+ description: |
+ Timeout (in milliseconds) for fetching remote embeddings.
+ type: integer
+ remote_embedding_num_tries:
+ description: |
+ Number of times to retry fetching remote embeddings.
+ type: integer
+ facet_strategy:
+ description: |
+ Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default).
+ type: string
+ stopwords:
+ description: |
+ Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query.
+ type: string
+ facet_return_parent:
+ description: |
+ Comma separated string of nested facet fields whose parent object should be returned in facet response.
+ type: string
+ voice_query:
+ description: |
+ The base64 encoded audio file in 16 khz 16-bit WAV format.
+ type: string
+ conversation:
+ description: |
+ Enable conversational search.
+ type: boolean
+ conversation_model_id:
+ description: |
+ The Id of Conversation Model to be used.
+ type: string
+ conversation_id:
+ description: |
+ The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM.
+ type: string
+ MultiSearchSearchesParameter:
+ type: object
+ required:
+ - searches
+ properties:
+ union:
+ type: boolean
+ description: When true, merges the search results from each search query into a single ordered set of hits.
+ searches:
+ type: array
+ items:
+ $ref: '#/components/schemas/MultiSearchCollectionParameters'
+ MultiSearchCollectionParameters:
+ allOf:
+ - $ref: '#/components/schemas/MultiSearchParameters'
+ - type: object
+ properties:
+ collection:
+ type: string
+ description: |
+ The collection to search in.
+ x-typesense-api-key:
+ type: string
+ description: A separate search API key for each search within a multi_search request
+ rerank_hybrid_matches:
+ type: boolean
+ description: |
+ When true, computes both text match and vector distance scores for all matches in hybrid search. Documents found only through keyword search will get a vector distance score, and documents found only through vector search will get a text match score.
+ default: false
+ FacetCounts:
+ type: object
+ properties:
+ counts:
+ type: array
+ items:
+ type: object
+ properties:
+ count:
+ type: integer
+ highlighted:
+ type: string
+ value:
+ type: string
+ parent:
+ type: object
+ field_name:
+ type: string
+ stats:
+ type: object
+ properties:
+ max:
+ type: number
+ format: double
+ min:
+ type: number
+ format: double
+ sum:
+ type: number
+ format: double
+ total_values:
+ type: integer
+ avg:
+ type: number
+ format: double
+ AnalyticsEventCreateResponse:
+ type: object
+ required:
+ - ok
+ properties:
+ ok:
+ type: boolean
+ AnalyticsEventCreateSchema:
+ type: object
+ required:
+ - type
+ - name
+ - data
+ properties:
+ type:
+ type: string
+ name:
+ type: string
+ data:
+ type: object
+ AnalyticsRuleUpsertSchema:
+ type: object
+ required:
+ - type
+ - params
+ properties:
+ type:
+ type: string
+ enum:
+ - popular_queries
+ - nohits_queries
+ - counter
+ params:
+ $ref: '#/components/schemas/AnalyticsRuleParameters'
+ AnalyticsRuleParameters:
+ type: object
+ required:
+ - source
+ - destination
+ properties:
+ source:
+ $ref: '#/components/schemas/AnalyticsRuleParametersSource'
+ destination:
+ $ref: '#/components/schemas/AnalyticsRuleParametersDestination'
+ limit:
+ type: integer
+ expand_query:
+ type: boolean
+ AnalyticsRuleParametersSource:
+ type: object
+ required:
+ - collections
+ properties:
+ collections:
+ type: array
+ items:
+ type: string
+ events:
+ type: array
+ items:
+ type: object
+ required:
+ - type
+ - weight
+ - name
+ properties:
+ type:
+ type: string
+ weight:
+ type: number
+ format: float
+ name:
+ type: string
+ AnalyticsRuleParametersDestination:
+ type: object
+ required:
+ - collection
+ properties:
+ collection:
+ type: string
+ counter_field:
+ type: string
+ AnalyticsRuleDeleteResponse:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ AnalyticsRuleSchema:
+ allOf:
+ - $ref: '#/components/schemas/AnalyticsRuleUpsertSchema'
+ - type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ AnalyticsRulesRetrieveSchema:
+ type: object
+ properties:
+ rules:
+ type: array
+ items:
+ $ref: '#/components/schemas/AnalyticsRuleSchema'
+ x-go-type: '[]*AnalyticsRuleSchema'
+ APIStatsResponse:
+ type: object
+ properties:
+ delete_latency_ms:
+ type: number
+ format: double
+ delete_requests_per_second:
+ type: number
+ format: double
+ import_latency_ms:
+ type: number
+ format: double
+ import_requests_per_second:
+ type: number
+ format: double
+ latency_ms:
+ type: object
+ x-go-type: map[string]float64
+ overloaded_requests_per_second:
+ type: number
+ format: double
+ pending_write_batches:
+ type: number
+ format: double
+ requests_per_second:
+ type: object
+ x-go-type: map[string]float64
+ search_latency_ms:
+ type: number
+ format: double
+ search_requests_per_second:
+ type: number
+ format: double
+ total_requests_per_second:
+ type: number
+ format: double
+ write_latency_ms:
+ type: number
+ format: double
+ write_requests_per_second:
+ type: number
+ format: double
+ StopwordsSetUpsertSchema:
+ type: object
+ properties:
+ stopwords:
+ type: array
+ items:
+ type: string
+ locale:
+ type: string
+ required:
+ - stopwords
+ example: |
+ {"stopwords": ["Germany", "France", "Italy"], "locale": "en"}
+ StopwordsSetSchema:
+ type: object
+ properties:
+ id:
+ type: string
+ stopwords:
+ type: array
+ items:
+ type: string
+ locale:
+ type: string
+ required:
+ - id
+ - stopwords
+ example: |
+ {"id": "countries", "stopwords": ["Germany", "France", "Italy"], "locale": "en"}
+ StopwordsSetRetrieveSchema:
+ type: object
+ properties:
+ stopwords:
+ $ref: '#/components/schemas/StopwordsSetSchema'
+ required:
+ - stopwords
+ example: |
+ {"stopwords": {"id": "countries", "stopwords": ["Germany", "France", "Italy"], "locale": "en"}}
+ StopwordsSetsRetrieveAllSchema:
+ type: object
+ properties:
+ stopwords:
+ type: array
+ items:
+ $ref: '#/components/schemas/StopwordsSetSchema'
+ required:
+ - stopwords
+ example: |
+ {"stopwords": [{"id": "countries", "stopwords": ["Germany", "France", "Italy"], "locale": "en"}]}
+ PresetUpsertSchema:
+ properties:
+ value:
+ oneOf:
+ - $ref: '#/components/schemas/SearchParameters'
+ - $ref: '#/components/schemas/MultiSearchSearchesParameter'
+ required:
+ - value
+ PresetSchema:
+ allOf:
+ - $ref: '#/components/schemas/PresetUpsertSchema'
+ - type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ PresetsRetrieveSchema:
+ type: object
+ required:
+ - presets
+ properties:
+ presets:
+ type: array
+ items:
+ $ref: '#/components/schemas/PresetSchema'
+ x-go-type: '[]*PresetSchema'
+ PresetDeleteSchema:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ DocumentIndexParameters:
+ type: object
+ properties:
+ dirty_values:
+ $ref: '#/components/schemas/DirtyValues'
+ DirtyValues:
+ type: string
+ enum:
+ - coerce_or_reject
+ - coerce_or_drop
+ - drop
+ - reject
+ IndexAction:
+ type: string
+ enum:
+ - create
+ - update
+ - upsert
+ - emplace
+ DropTokensMode:
+ type: string
+ enum:
+ - right_to_left
+ - left_to_right
+ - both_sides:3
+ description: |
+ Dictates the direction in which the words in the query must be dropped when the original words in the query do not appear in any document. Values: right_to_left (default), left_to_right, both_sides:3 A note on both_sides:3 - for queries upto 3 tokens (words) in length, this mode will drop tokens from both sides and exhaustively rank all matching results. If query length is greater than 3 words, Typesense will just fallback to default behavior of right_to_left
+ ConversationModelCreateSchema:
+ required:
+ - model_name
+ - max_bytes
+ allOf:
+ - $ref: '#/components/schemas/ConversationModelUpdateSchema'
+ - type: object
+ required:
+ - model_name
+ - max_bytes
+ - history_collection
+ properties:
+ model_name:
+ description: Name of the LLM model offered by OpenAI, Cloudflare or vLLM
+ type: string
+ max_bytes:
+ description: |
+ The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window.
+ type: integer
+ history_collection:
+ type: string
+ description: Typesense collection that stores the historical conversations
+ ConversationModelUpdateSchema:
+ type: object
+ properties:
+ id:
+ type: string
+ description: An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id.
+ model_name:
+ description: Name of the LLM model offered by OpenAI, Cloudflare or vLLM
+ type: string
+ api_key:
+ description: The LLM service's API Key
+ type: string
+ history_collection:
+ type: string
+ description: Typesense collection that stores the historical conversations
+ account_id:
+ description: LLM service's account ID (only applicable for Cloudflare)
+ type: string
+ system_prompt:
+ description: The system prompt that contains special instructions to the LLM
+ type: string
+ ttl:
+ type: integer
+ description: |
+ Time interval in seconds after which the messages would be deleted. Default: 86400 (24 hours)
+ max_bytes:
+ description: |
+ The maximum number of bytes to send to the LLM in every API call. Consult the LLM's documentation on the number of bytes supported in the context window.
+ type: integer
+ vllm_url:
+ description: URL of vLLM service
+ type: string
+ ConversationModelSchema:
+ allOf:
+ - $ref: '#/components/schemas/ConversationModelCreateSchema'
+ - type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: An explicit id for the model, otherwise the API will return a response with an auto-generated conversation model id.
+ StemmingDictionary:
+ type: object
+ required:
+ - id
+ - words
+ properties:
+ id:
+ type: string
+ description: Unique identifier for the dictionary
+ example: irregular-plurals
+ words:
+ type: array
+ description: List of word mappings in the dictionary
+ items:
+ type: object
+ required:
+ - word
+ - root
+ properties:
+ word:
+ type: string
+ description: The word form to be stemmed
+ example: people
+ root:
+ type: string
+ description: The root form of the word
+ example: person
+ NLSearchModelBase:
+ type: object
+ properties:
+ model_name:
+ type: string
+ description: Name of the NL model to use
+ api_key:
+ type: string
+ description: API key for the NL model service
+ api_url:
+ type: string
+ description: Custom API URL for the NL model service
+ max_bytes:
+ type: integer
+ description: Maximum number of bytes to process
+ temperature:
+ type: number
+ description: Temperature parameter for the NL model
+ system_prompt:
+ type: string
+ description: System prompt for the NL model
+ top_p:
+ type: number
+ description: Top-p parameter for the NL model (Google-specific)
+ top_k:
+ type: integer
+ description: Top-k parameter for the NL model (Google-specific)
+ stop_sequences:
+ type: array
+ items:
+ type: string
+ description: Stop sequences for the NL model (Google-specific)
+ api_version:
+ type: string
+ description: API version for the NL model service
+ project_id:
+ type: string
+ description: Project ID for GCP Vertex AI
+ access_token:
+ type: string
+ description: Access token for GCP Vertex AI
+ refresh_token:
+ type: string
+ description: Refresh token for GCP Vertex AI
+ client_id:
+ type: string
+ description: Client ID for GCP Vertex AI
+ client_secret:
+ type: string
+ description: Client secret for GCP Vertex AI
+ region:
+ type: string
+ description: Region for GCP Vertex AI
+ max_output_tokens:
+ type: integer
+ description: Maximum output tokens for GCP Vertex AI
+ account_id:
+ type: string
+ description: Account ID for Cloudflare-specific models
+ NLSearchModelCreateSchema:
+ allOf:
+ - $ref: '#/components/schemas/NLSearchModelBase'
+ - type: object
+ properties:
+ id:
+ type: string
+ description: Optional ID for the NL search model
+ NLSearchModelSchema:
+ allOf:
+ - $ref: '#/components/schemas/NLSearchModelCreateSchema'
+ - type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: ID of the NL search model
+ NLSearchModelUpdateSchema:
+ $ref: '#/components/schemas/NLSearchModelCreateSchema'
+ NLSearchModelDeleteSchema:
+ type: object
+ required:
+ - id
+ properties:
+ id:
+ type: string
+ description: ID of the deleted NL search model
+ ImportDocumentsParameters:
+ type: object
+ properties:
+ batch_size:
+ type: integer
+ return_id:
+ type: boolean
+ description: Returning the id of the imported documents. If you want the import response to return the ingested document's id in the response, you can use the return_id parameter.
+ remote_embedding_batch_size:
+ type: integer
+ return_doc:
+ type: boolean
+ action:
+ $ref: '#/components/schemas/IndexAction'
+ dirty_values:
+ $ref: '#/components/schemas/DirtyValues'
+ ExportDocumentsParameters:
+ type: object
+ properties:
+ filter_by:
+ description: Filter conditions for refining your search results. Separate multiple conditions with &&.
+ type: string
+ include_fields:
+ description: List of fields from the document to include in the search result
+ type: string
+ exclude_fields:
+ description: List of fields from the document to exclude in the search result
+ type: string
+ UpdateDocumentsParameters:
+ type: object
+ properties:
+ filter_by:
+ type: string
+ example: 'num_employees:>100 && country: [USA, UK]'
+ DeleteDocumentsParameters:
+ type: object
+ required:
+ - filter_by
+ properties:
+ filter_by:
+ type: string
+ example: 'num_employees:>100 && country: [USA, UK]'
+ batch_size:
+ description: Batch size parameter controls the number of documents that should be deleted at a time. A larger value will speed up deletions, but will impact performance of other operations running on the server.
+ type: integer
+ ignore_not_found:
+ type: boolean
+ truncate:
+ description: When true, removes all documents from the collection while preserving the collection and its schema.
+ type: boolean
+ securitySchemes:
+ api_key_header:
+ type: apiKey
+ name: X-TYPESENSE-API-KEY
+ in: header
diff --git a/typesense/Cargo.toml b/typesense/Cargo.toml
index f1a0491..8f567cc 100644
--- a/typesense/Cargo.toml
+++ b/typesense/Cargo.toml
@@ -26,18 +26,38 @@ serde_json = "1.0"
sha2 = "0.10"
typesense_derive = { workspace = true, optional = true }
typesense_codegen = { workspace = true }
+thiserror = "1.0"
+bon = "3.7.0"
+reqwest-retry = "0.7.0"
+web-time = "=1.1.0"
+# strum = { version = "0.26", features = ["derive"] }
+
+# ---------- native-only dependencies (non-wasm) ----------
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+reqwest = { version = "0.12", features = ["json"] }
+reqwest-middleware = { version = "0.4.2"}
+
+# ---------- wasm deps ----------
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+# IMPORTANT: disable default features to avoid hyper/tokio/mio
+reqwest = { version = "0.12", default-features = false, features = ["json"] }
[dev-dependencies]
dotenvy = "0.15"
trybuild = "1.0.42"
+nanoid = "0.4"
+# native-only dev deps
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { version = "1.5", features = ["macros", "rt", "rt-multi-thread"] }
+wiremock = "0.5"
+# wasm test deps
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
console_error_panic_hook = "0.1.6"
wasm-bindgen = "0.2"
wasm-bindgen-test = "0.3.23"
+wasm-bindgen-futures = "0.4.50"
[[test]]
name = "derive_tests"
@@ -45,5 +65,5 @@ path = "tests/derive/lib.rs"
required-features = ["derive"]
[[test]]
-name = "api_tests"
-path = "tests/api/lib.rs"
+name = "client"
+path = "tests/client/mod.rs"
\ No newline at end of file
diff --git a/typesense/src/builders/collection_field.rs b/typesense/src/builders/collection_field.rs
new file mode 100644
index 0000000..2c92842
--- /dev/null
+++ b/typesense/src/builders/collection_field.rs
@@ -0,0 +1,54 @@
+//! Module with the common definitions for the
+//! [fields](https://github.com/typesense/typesense/blob/v0.19.0/include/field.)
+//! available in Typesense.
+
+use crate::traits::FieldType;
+use bon::builder;
+use typesense_codegen::models::{Field as TypesenseField, FieldEmbed};
+
+/// Creates a new [`TypesenseField`] builder.
+#[builder(
+ // expose a public builder type named `FieldBuilder` and a public finish_fn `build()`
+ builder_type(name = FieldBuilder, vis = "pub"),
+ finish_fn(name = build, vis = "pub"),
+ // allow passing &str into String params
+ on(String, into)
+)]
+pub fn new_collection_field(
+ #[builder(start_fn)] name: String,
+
+ #[builder(start_fn)] typesense_type: FieldType,
+
+ optional: Option,
+ facet: Option,
+ index: Option,
+ locale: Option,
+ sort: Option,
+ infix: Option,
+ num_dim: Option,
+ drop: Option,
+ embed: Option>,
+ store: Option,
+ stem: Option,
+ range_index: Option,
+ vec_dist: Option,
+) -> TypesenseField {
+ TypesenseField {
+ name,
+ r#type: typesense_type,
+ optional,
+ facet,
+ index,
+ locale,
+ sort,
+ infix,
+ num_dim,
+ drop,
+ embed,
+ store,
+ stem,
+ range_index,
+ vec_dist,
+ ..Default::default()
+ }
+}
diff --git a/typesense/src/builders/collection_schema.rs b/typesense/src/builders/collection_schema.rs
new file mode 100644
index 0000000..9480274
--- /dev/null
+++ b/typesense/src/builders/collection_schema.rs
@@ -0,0 +1,137 @@
+//! # Collection
+//!
+//! In Typesense, a group of related documents is called a collection. A collection
+//! is roughly equivalent to a table in a relational database.
+//!
+use bon::builder;
+use typesense_codegen::models::{CollectionSchema, Field, VoiceQueryModelCollectionConfig};
+
+/// Creates a new [`CollectionSchema`] builder.
+///
+/// In Typesense, a collection is a group of related documents, similar to a table
+/// in a relational database. This builder enforces that `name` must be provided
+/// before [`build`](CollectionSchemaBuilder::build) can be called.
+///
+/// # Example
+///
+/// ```
+/// use typesense::builders::new_collection_schema;
+/// let fields = vec![];
+/// let schema = new_collection_schema("companies", fields)
+/// .default_sorting_field("num_employees")
+/// .build();
+/// ```
+#[builder(
+ builder_type(name = CollectionSchemaBuilder, vis = "pub"),
+ finish_fn(name = build, vis = "pub"),
+ state_mod(name = collection_schema_builder, vis = "pub"),
+ on(String, into)
+)]
+pub fn new_collection_schema(
+ /// The name of the collection. Must be unique within the Typesense instance.
+ #[builder(start_fn)]
+ name: String,
+
+ /// The list of fields that describe the schema of documents in this collection.
+ #[builder(start_fn)]
+ fields: Vec,
+
+ /// The name of the default sorting field for the collection.
+ default_sorting_field: Option,
+
+ /// A list of token separators to use when indexing text fields.
+ token_separators: Option>,
+
+ /// Whether nested fields are enabled.
+ enable_nested_fields: Option,
+
+ /// Symbols that should be indexed for this collection.
+ symbols_to_index: Option>,
+
+ /// Configuration for Typesense’s Voice Query Model.
+ voice_query_model: Option>,
+) -> CollectionSchema {
+ CollectionSchema {
+ name,
+ fields,
+ default_sorting_field,
+ token_separators,
+ enable_nested_fields,
+ symbols_to_index,
+ voice_query_model,
+ }
+}
+
+// custom convenience methods; the typestate module name matches `state_mod`
+impl CollectionSchemaBuilder {
+ /// Adds a single [`Field`] to the collection schema.
+ ///
+ /// This is a convenience method for pushing one field at a time.
+ pub fn add_field(mut self, field: Field) -> Self {
+ self.fields.push(field);
+ self
+ }
+
+ /// Adds multiple [`Field`] values to the collection schema.
+ ///
+ /// This is a convenience method for appending a slice of fields.
+ pub fn add_fields(mut self, fields: &[Field]) -> Self
+ where
+ Field: Clone,
+ {
+ self.fields.extend_from_slice(fields);
+ self
+ }
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+ use crate::builders::new_collection_field;
+ use serde_json::json;
+
+ #[test]
+ fn collection_schema_serializes_as_expected() {
+ let fields = [
+ ("company_name", "string".to_owned(), None),
+ ("num_employees", "int32".to_owned(), None),
+ ("country", "string".to_owned(), Some(true)),
+ ]
+ .map(|(name, typesense_type, facet)| {
+ if facet.is_some() {
+ new_collection_field(name, typesense_type.into())
+ .facet(facet.unwrap())
+ .build()
+ } else {
+ new_collection_field(name, typesense_type.into()).build()
+ }
+ });
+
+ let collection: CollectionSchema =
+ new_collection_schema("companies", fields.clone().to_vec())
+ .add_fields(&fields)
+ .add_field(new_collection_field("size", "string".into()).build())
+ .default_sorting_field("num_employees")
+ .build();
+
+ let expected = json!(
+ {
+ "name": "companies",
+ "fields": [
+ { "name": "company_name", "type": "string" },
+ { "name": "num_employees", "type": "int32" },
+ { "name": "country", "type": "string", "facet": true },
+
+ { "name": "company_name", "type": "string" },
+ { "name": "num_employees", "type": "int32" },
+ { "name": "country", "type": "string", "facet": true },
+
+ { "name": "size", "type": "string" },
+ ],
+ "default_sorting_field": "num_employees"
+ }
+ );
+
+ assert_eq!(serde_json::to_value(&collection).unwrap(), expected)
+ }
+}
diff --git a/typesense/src/builders/mod.rs b/typesense/src/builders/mod.rs
new file mode 100644
index 0000000..6749bf7
--- /dev/null
+++ b/typesense/src/builders/mod.rs
@@ -0,0 +1,21 @@
+//! Contain convenient builders for Typesense schemas.
+
+mod collection_field;
+mod collection_schema;
+mod multi_search_collection_parameters;
+mod multi_search_parameters;
+mod multi_search_searches_parameters;
+mod search_parameters;
+
+pub use collection_field::{FieldBuilder, new_collection_field};
+pub use collection_schema::{CollectionSchemaBuilder, new_collection_schema};
+
+pub use search_parameters::{SearchParametersBuilder, new_search_parameters};
+
+pub use multi_search_collection_parameters::{
+ MultiSearchCollectionParametersBuilder, new_multi_search_collection_parameters,
+};
+pub use multi_search_parameters::{MultiSearchParametersBuilder, new_multi_search_parameters};
+pub use multi_search_searches_parameters::{
+ MultiSearchSearchesParameterBuilder, new_multi_search_searches_parameter,
+};
diff --git a/typesense/src/builders/multi_search_collection_parameters.rs b/typesense/src/builders/multi_search_collection_parameters.rs
new file mode 100644
index 0000000..5cad599
--- /dev/null
+++ b/typesense/src/builders/multi_search_collection_parameters.rs
@@ -0,0 +1,265 @@
+//! Module for the `MultiSearchCollectionParameters` builder.
+
+use crate::models::{DropTokensMode, MultiSearchCollectionParameters};
+use bon::builder;
+
+/// Creates a new [`MultiSearchCollectionParameters`] builder.
+///
+/// This builder helps construct an individual search query for a multi-search request.
+/// All parameters are optional.
+#[builder(
+ // expose a public builder type and a public finish_fn
+ builder_type(name = MultiSearchCollectionParametersBuilder, vis = "pub"),
+ finish_fn(name = build, vis = "pub"),
+ // allow passing &str into String params
+ on(String, into)
+)]
+pub fn new_multi_search_collection_parameters(
+ /// The collection to search in.
+ collection: Option,
+ /// The query text to search for in the collection.
+ q: Option,
+ /// A list of `string` fields that should be queried against.
+ query_by: Option,
+ /// The relative weight to give each `query_by` field when ranking results.
+ query_by_weights: Option,
+ /// How the representative text match score is calculated.
+ text_match_type: Option,
+ /// Indicates if the last word in the query should be treated as a prefix.
+ prefix: Option,
+ /// Infix search configuration. Can be `off`, `always`, or `fallback`.
+ infix: Option,
+ /// Maximum number of extra symbols before a query token for infix searching.
+ max_extra_prefix: Option,
+ /// Maximum number of extra symbols after a query token for infix searching.
+ max_extra_suffix: Option,
+ /// Filter conditions for refining search results.
+ filter_by: Option,
+ /// A list of fields and their sort orders.
+ sort_by: Option,
+ /// A list of fields to facet by.
+ facet_by: Option,
+ /// Maximum number of facet values to be returned.
+ max_facet_values: Option,
+ /// A query to filter facet values.
+ facet_query: Option,
+ /// The number of typographical errors (1 or 2) that would be tolerated.
+ num_typos: Option,
+ /// The page number to fetch.
+ page: Option,
+ /// Number of results to fetch per page.
+ per_page: Option,
+ /// Number of hits to fetch.
+ limit: Option,
+ /// The starting point of the result set.
+ offset: Option,
+ /// Fields to group results by.
+ group_by: Option,
+ /// Maximum number of hits to return for every group.
+ group_limit: Option,
+ /// Whether to group documents with null values in the `group_by` field.
+ group_missing_values: Option,
+ /// List of fields to include in the search result.
+ include_fields: Option,
+ /// List of fields to exclude from the search result.
+ exclude_fields: Option,
+ /// List of fields which should be highlighted fully.
+ highlight_full_fields: Option,
+ /// The number of tokens surrounding the highlighted text.
+ highlight_affix_num_tokens: Option,
+ /// The start tag for highlighted snippets.
+ highlight_start_tag: Option,
+ /// The end tag for highlighted snippets.
+ highlight_end_tag: Option,
+ /// Field values under this length will be fully highlighted.
+ snippet_threshold: Option,
+ /// Threshold for dropping query tokens to find more results.
+ drop_tokens_threshold: Option,
+ drop_tokens_mode: Option,
+ /// Threshold for trying more typos to find more results.
+ typo_tokens_threshold: Option,
+ /// Whether to enable typos on alphanumerical tokens.
+ enable_typos_for_alpha_numerical_tokens: Option,
+ /// Whether the `filter_by` condition applies to curated results.
+ filter_curated_hits: Option,
+ /// Whether to enable synonyms for the query.
+ enable_synonyms: Option,
+ /// Allow synonym resolution on word prefixes.
+ synonym_prefix: Option,
+ /// Number of typos allowed for synonym resolution.
+ synonym_num_typos: Option,
+ /// A list of records to unconditionally include at specific positions.
+ pinned_hits: Option,
+ /// A list of records to unconditionally hide from search results.
+ hidden_hits: Option,
+ /// Comma-separated list of tags to trigger curation rules.
+ override_tags: Option,
+ /// A list of custom fields that must be highlighted.
+ highlight_fields: Option,
+ /// You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. Set this parameter to true to do the same
+ pre_segmented_query: Option,
+ /// Search using a preset of search parameters.
+ preset: Option,
+ /// Whether to enable overrides for the query.
+ enable_overrides: Option,
+ /// Whether to prioritize an exact match.
+ prioritize_exact_match: Option,
+ /// Prioritize documents where query words appear earlier in the text.
+ prioritize_token_position: Option,
+ /// Prioritize documents where query words appear in more fields.
+ prioritize_num_matching_fields: Option,
+ /// Disable typos for numerical tokens.
+ enable_typos_for_numerical_tokens: Option,
+ /// Whether to perform an exhaustive search.
+ exhaustive_search: Option,
+ /// Search cutoff time in milliseconds.
+ search_cutoff_ms: Option,
+ /// Enable server-side caching of search results.
+ use_cache: Option,
+ /// The TTL for the search query cache.
+ cache_ttl: Option,
+ /// Minimum word length for 1-typo correction.
+ min_len_1typo: Option,
+ /// Minimum word length for 2-typo correction.
+ min_len_2typo: Option,
+ /// Vector query expression.
+ vector_query: Option,
+ /// Timeout for fetching remote embeddings.
+ remote_embedding_timeout_ms: Option,
+ /// Number of retries for fetching remote embeddings.
+ remote_embedding_num_tries: Option,
+ /// The underlying faceting strategy to use.
+ facet_strategy: Option,
+ /// Name of the stopwords set to apply for this search.
+ stopwords: Option,
+ /// Nested facet fields whose parent object should be returned.
+ facet_return_parent: Option,
+ /// The base64 encoded audio file.
+ voice_query: Option,
+ /// Enable conversational search.
+ conversation: Option,
+ /// The ID of the Conversation Model to use.
+ conversation_model_id: Option,
+ /// The ID of a previous conversation to continue.
+ conversation_id: Option,
+ /// A separate search API key for this specific search.
+ x_typesense_api_key: Option,
+ /// When true, computes both text match and vector distance scores for all matches in hybrid search.
+ rerank_hybrid_matches: Option,
+) -> MultiSearchCollectionParameters {
+ MultiSearchCollectionParameters {
+ collection,
+ q,
+ query_by,
+ query_by_weights,
+ text_match_type,
+ prefix,
+ infix,
+ max_extra_prefix,
+ max_extra_suffix,
+ filter_by,
+ sort_by,
+ facet_by,
+ max_facet_values,
+ facet_query,
+ num_typos,
+ page,
+ per_page,
+ limit,
+ offset,
+ group_by,
+ group_limit,
+ group_missing_values,
+ include_fields,
+ exclude_fields,
+ highlight_full_fields,
+ highlight_affix_num_tokens,
+ highlight_start_tag,
+ highlight_end_tag,
+ snippet_threshold,
+ drop_tokens_threshold,
+ drop_tokens_mode,
+ typo_tokens_threshold,
+ enable_typos_for_alpha_numerical_tokens,
+ filter_curated_hits,
+ enable_synonyms,
+ synonym_prefix,
+ synonym_num_typos,
+ pinned_hits,
+ hidden_hits,
+ override_tags,
+ highlight_fields,
+ pre_segmented_query,
+ preset,
+ enable_overrides,
+ prioritize_exact_match,
+ prioritize_token_position,
+ prioritize_num_matching_fields,
+ enable_typos_for_numerical_tokens,
+ exhaustive_search,
+ search_cutoff_ms,
+ use_cache,
+ cache_ttl,
+ min_len_1typo,
+ min_len_2typo,
+ vector_query,
+ remote_embedding_timeout_ms,
+ remote_embedding_num_tries,
+ facet_strategy,
+ stopwords,
+ facet_return_parent,
+ voice_query,
+ conversation,
+ conversation_model_id,
+ conversation_id,
+ x_typesense_api_key,
+ rerank_hybrid_matches,
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::models::MultiSearchCollectionParameters;
+
+ #[test]
+ fn test_multi_search_collection_parameters_builder_basic() {
+ let built = new_multi_search_collection_parameters()
+ .collection("products")
+ .q("phone")
+ .limit(10)
+ .build();
+
+ let expected = MultiSearchCollectionParameters {
+ collection: Some("products".to_string()),
+ q: Some("phone".to_string()),
+ limit: Some(10),
+ ..Default::default()
+ };
+
+ assert_eq!(built, expected);
+ }
+
+ #[test]
+ fn test_multi_search_collection_parameters_builder_api_key() {
+ let built = new_multi_search_collection_parameters()
+ .collection("private_docs")
+ .x_typesense_api_key("specific_key_for_this_search")
+ .build();
+
+ let expected = MultiSearchCollectionParameters {
+ collection: Some("private_docs".to_string()),
+ x_typesense_api_key: Some("specific_key_for_this_search".to_string()),
+ ..Default::default()
+ };
+
+ assert_eq!(built, expected);
+ }
+
+ #[test]
+ fn test_multi_search_collection_parameters_builder_defaults() {
+ let built = new_multi_search_collection_parameters().build();
+ let expected = MultiSearchCollectionParameters::default();
+ assert_eq!(built, expected);
+ }
+}
diff --git a/typesense/src/builders/multi_search_parameters.rs b/typesense/src/builders/multi_search_parameters.rs
new file mode 100644
index 0000000..9375697
--- /dev/null
+++ b/typesense/src/builders/multi_search_parameters.rs
@@ -0,0 +1,260 @@
+//! Module for the `MultiSearchParameters` builder.
+
+use crate::models::{DropTokensMode, MultiSearchParameters};
+use bon::builder;
+
+/// Creates a new [`MultiSearchParameters`] builder.
+///
+/// This builder helps construct a set of common search parameters that can be applied
+/// to all search queries within a multi-search request.
+#[builder(
+ // expose a public builder type and a public finish_fn
+ builder_type(name = MultiSearchParametersBuilder, vis = "pub"),
+ finish_fn(name = build, vis = "pub"),
+ // allow passing &str into String params
+ on(String, into)
+)]
+pub fn new_multi_search_parameters(
+ /// The query text to search for in the collection.
+ q: Option,
+ /// A list of `string` fields that should be queried against.
+ query_by: Option,
+ /// The relative weight to give each `query_by` field when ranking results.
+ query_by_weights: Option,
+ /// How the representative text match score is calculated.
+ text_match_type: Option,
+ /// Indicates if the last word in the query should be treated as a prefix.
+ prefix: Option,
+ /// Infix search configuration. Can be `off`, `always`, or `fallback`.
+ infix: Option,
+ /// Maximum number of extra symbols before a query token for infix searching.
+ max_extra_prefix: Option,
+ /// Maximum number of extra symbols after a query token for infix searching.
+ max_extra_suffix: Option,
+ /// Filter conditions for refining search results.
+ filter_by: Option,
+ /// A list of fields and their sort orders.
+ sort_by: Option,
+ /// A list of fields to facet by.
+ facet_by: Option,
+ /// Maximum number of facet values to be returned.
+ max_facet_values: Option,
+ /// A query to filter facet values.
+ facet_query: Option,
+ /// The number of typographical errors (1 or 2) that would be tolerated.
+ num_typos: Option,
+ /// The page number to fetch.
+ page: Option,
+ /// Number of results to fetch per page.
+ per_page: Option,
+ /// Number of hits to fetch.
+ limit: Option,
+ /// The starting point of the result set.
+ offset: Option,
+ /// Fields to group results by.
+ group_by: Option,
+ /// Maximum number of hits to return for every group.
+ group_limit: Option,
+ /// Whether to group documents with null values in the `group_by` field.
+ group_missing_values: Option,
+ /// List of fields to include in the search result.
+ include_fields: Option,
+ /// List of fields to exclude from the search result.
+ exclude_fields: Option,
+ /// List of fields which should be highlighted fully.
+ highlight_full_fields: Option,
+ /// The number of tokens surrounding the highlighted text.
+ highlight_affix_num_tokens: Option,
+ /// The start tag for highlighted snippets.
+ highlight_start_tag: Option,
+ /// The end tag for highlighted snippets.
+ highlight_end_tag: Option,
+ /// Field values under this length will be fully highlighted.
+ snippet_threshold: Option,
+ /// Threshold for dropping query tokens to find more results.
+ drop_tokens_threshold: Option,
+ drop_tokens_mode: Option,
+ /// Threshold for trying more typos to find more results.
+ typo_tokens_threshold: Option,
+ /// Whether to enable typos on alphanumerical tokens.
+ enable_typos_for_alpha_numerical_tokens: Option,
+ /// Whether the `filter_by` condition applies to curated results.
+ filter_curated_hits: Option,
+ /// Whether to enable synonyms for the query.
+ enable_synonyms: Option,
+ /// Allow synonym resolution on word prefixes.
+ synonym_prefix: Option,
+ /// Number of typos allowed for synonym resolution.
+ synonym_num_typos: Option,
+ /// A list of records to unconditionally include at specific positions.
+ pinned_hits: Option,
+ /// A list of records to unconditionally hide from search results.
+ hidden_hits: Option,
+ /// Comma-separated list of tags to trigger curation rules.
+ override_tags: Option,
+ /// A list of custom fields that must be highlighted.
+ highlight_fields: Option,
+ /// You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. Set this parameter to true to do the same
+ pre_segmented_query: Option,
+ /// Search using a preset of search parameters.
+ preset: Option,
+ /// Whether to enable overrides for the query.
+ enable_overrides: Option,
+ /// Whether to prioritize an exact match.
+ prioritize_exact_match: Option,
+ /// Prioritize documents where query words appear earlier in the text.
+ prioritize_token_position: Option,
+ /// Prioritize documents where query words appear in more fields.
+ prioritize_num_matching_fields: Option,
+ /// Disable typos for numerical tokens.
+ enable_typos_for_numerical_tokens: Option,
+ /// Whether to perform an exhaustive search.
+ exhaustive_search: Option,
+ /// Search cutoff time in milliseconds.
+ search_cutoff_ms: Option,
+ /// Enable server-side caching of search results.
+ use_cache: Option,
+ /// The TTL for the search query cache.
+ cache_ttl: Option,
+ /// Minimum word length for 1-typo correction.
+ min_len_1typo: Option,
+ /// Minimum word length for 2-typo correction.
+ min_len_2typo: Option,
+ /// Vector query expression.
+ vector_query: Option,
+ /// Timeout for fetching remote embeddings.
+ remote_embedding_timeout_ms: Option,
+ /// Number of retries for fetching remote embeddings.
+ remote_embedding_num_tries: Option,
+ /// The underlying faceting strategy to use.
+ facet_strategy: Option,
+ /// Name of the stopwords set to apply for this search.
+ stopwords: Option,
+ /// Nested facet fields whose parent object should be returned.
+ facet_return_parent: Option,
+ /// The base64 encoded audio file.
+ voice_query: Option,
+ /// Enable conversational search.
+ conversation: Option,
+ /// The ID of the Conversation Model to use.
+ conversation_model_id: Option,
+ /// The ID of a previous conversation to continue.
+ conversation_id: Option,
+) -> MultiSearchParameters {
+ MultiSearchParameters {
+ q,
+ query_by,
+ query_by_weights,
+ text_match_type,
+ prefix,
+ infix,
+ max_extra_prefix,
+ max_extra_suffix,
+ filter_by,
+ sort_by,
+ facet_by,
+ max_facet_values,
+ facet_query,
+ num_typos,
+ page,
+ per_page,
+ limit,
+ offset,
+ group_by,
+ group_limit,
+ group_missing_values,
+ include_fields,
+ exclude_fields,
+ highlight_full_fields,
+ highlight_affix_num_tokens,
+ highlight_start_tag,
+ highlight_end_tag,
+ snippet_threshold,
+ drop_tokens_threshold,
+ drop_tokens_mode,
+ typo_tokens_threshold,
+ enable_typos_for_alpha_numerical_tokens,
+ filter_curated_hits,
+ enable_synonyms,
+ synonym_prefix,
+ synonym_num_typos,
+ pinned_hits,
+ hidden_hits,
+ override_tags,
+ highlight_fields,
+ pre_segmented_query,
+ preset,
+ enable_overrides,
+ prioritize_exact_match,
+ prioritize_token_position,
+ prioritize_num_matching_fields,
+ enable_typos_for_numerical_tokens,
+ exhaustive_search,
+ search_cutoff_ms,
+ use_cache,
+ cache_ttl,
+ min_len_1typo,
+ min_len_2typo,
+ vector_query,
+ remote_embedding_timeout_ms,
+ remote_embedding_num_tries,
+ facet_strategy,
+ stopwords,
+ facet_return_parent,
+ voice_query,
+ conversation,
+ conversation_model_id,
+ conversation_id,
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::models::{DropTokensMode, MultiSearchParameters};
+
+ #[test]
+ fn test_multi_search_parameters_builder_basic() {
+ let built = new_multi_search_parameters()
+ .query_by("title")
+ .per_page(5)
+ .build();
+
+ let expected = MultiSearchParameters {
+ query_by: Some("title".to_string()),
+ per_page: Some(5),
+ ..Default::default()
+ };
+
+ assert_eq!(built, expected);
+ }
+
+ #[test]
+ fn test_multi_search_parameters_builder_full() {
+ let built = new_multi_search_parameters()
+ .q("*")
+ .filter_by("category:shoes")
+ .use_cache(true)
+ .drop_tokens_mode(DropTokensMode::LeftToRight)
+ .search_cutoff_ms(100)
+ .build();
+
+ let expected = MultiSearchParameters {
+ q: Some("*".to_string()),
+ filter_by: Some("category:shoes".to_string()),
+ use_cache: Some(true),
+ drop_tokens_mode: Some(DropTokensMode::LeftToRight),
+ search_cutoff_ms: Some(100),
+ ..Default::default()
+ };
+
+ assert_eq!(built, expected);
+ }
+
+ #[test]
+ fn test_multi_search_parameters_builder_defaults() {
+ let built = new_multi_search_parameters().build();
+ let expected = MultiSearchParameters::default();
+ assert_eq!(built, expected);
+ }
+}
diff --git a/typesense/src/builders/multi_search_searches_parameters.rs b/typesense/src/builders/multi_search_searches_parameters.rs
new file mode 100644
index 0000000..60a3490
--- /dev/null
+++ b/typesense/src/builders/multi_search_searches_parameters.rs
@@ -0,0 +1,127 @@
+//! Module for the `MultiSearchSearchesParameter` builder.
+
+use crate::models::{MultiSearchCollectionParameters, MultiSearchSearchesParameter};
+
+/// A builder for creating a `MultiSearchSearchesParameter` object.
+///
+/// This builder is used to construct the body of a multi-search request by
+/// adding individual search queries one by one.
+#[derive(Debug, Default)]
+pub struct MultiSearchSearchesParameterBuilder {
+ searches: Vec,
+}
+
+impl MultiSearchSearchesParameterBuilder {
+ /// Creates a new, empty builder.
+ pub fn new() -> Self {
+ Self::default()
+ }
+
+ /// Adds a single search query to the multi-search request.
+ ///
+ /// # Arguments
+ ///
+ /// * `search` - A `MultiSearchCollectionParameters` object representing an
+ /// individual search query.
+ pub fn add_search(mut self, search: MultiSearchCollectionParameters) -> Self {
+ self.searches.push(search);
+ self
+ }
+
+ /// Adds multiple search queries to the multi-search request from an iterator.
+ ///
+ /// # Arguments
+ ///
+ /// * `searches` - An iterator that yields `MultiSearchCollectionParameters` objects.
+ pub fn add_searches(
+ mut self,
+ searches: impl IntoIterator- ,
+ ) -> Self {
+ self.searches.extend(searches);
+ self
+ }
+
+ /// Consumes the builder and returns a `MultiSearchSearchesParameter` object.
+ pub fn build(self) -> MultiSearchSearchesParameter {
+ MultiSearchSearchesParameter {
+ searches: self.searches,
+ }
+ }
+}
+
+/// Creates a new [`MultiSearchSearchesParameterBuilder`].
+///
+/// This is the entry point for building a multi-search request body.
+pub fn new_multi_search_searches_parameter() -> MultiSearchSearchesParameterBuilder {
+ MultiSearchSearchesParameterBuilder::new()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::builders::new_multi_search_collection_parameters;
+
+ #[test]
+ fn test_multi_search_builder_new_is_empty() {
+ let multi_search_request = new_multi_search_searches_parameter().build();
+ assert!(multi_search_request.searches.is_empty());
+ }
+
+ #[test]
+ fn test_multi_search_builder_add_one_search() {
+ let search1 = new_multi_search_collection_parameters()
+ .collection("products")
+ .q("shoe")
+ .build();
+
+ let multi_search_request = new_multi_search_searches_parameter()
+ .add_search(search1.clone())
+ .build();
+
+ assert_eq!(multi_search_request.searches.len(), 1);
+ assert_eq!(multi_search_request.searches[0], search1);
+ }
+
+ #[test]
+ fn test_multi_search_builder_add_multiple_searches_chained() {
+ let search1 = new_multi_search_collection_parameters()
+ .collection("products")
+ .q("shoe")
+ .build();
+ let search2 = new_multi_search_collection_parameters()
+ .collection("brands")
+ .q("Nike")
+ .build();
+
+ let multi_search_request = new_multi_search_searches_parameter()
+ .add_search(search1.clone())
+ .add_search(search2.clone())
+ .build();
+
+ assert_eq!(multi_search_request.searches.len(), 2);
+ assert_eq!(multi_search_request.searches[0], search1);
+ assert_eq!(multi_search_request.searches[1], search2);
+ }
+
+ #[test]
+ fn test_multi_search_builder_add_searches_from_iterator() {
+ let searches_vec = vec![
+ new_multi_search_collection_parameters()
+ .collection("c1")
+ .build(),
+ new_multi_search_collection_parameters()
+ .collection("c2")
+ .build(),
+ new_multi_search_collection_parameters()
+ .collection("c3")
+ .build(),
+ ];
+
+ let multi_search_request = new_multi_search_searches_parameter()
+ .add_searches(searches_vec.clone())
+ .build();
+
+ assert_eq!(multi_search_request.searches.len(), 3);
+ assert_eq!(multi_search_request.searches, searches_vec);
+ }
+}
diff --git a/typesense/src/builders/search_parameters.rs b/typesense/src/builders/search_parameters.rs
new file mode 100644
index 0000000..18efae6
--- /dev/null
+++ b/typesense/src/builders/search_parameters.rs
@@ -0,0 +1,280 @@
+//! Module for the `SearchParameters` builder.
+
+use crate::models::{DropTokensMode, SearchParameters};
+use bon::builder;
+
+/// Creates a new [`SearchParameters`] builder.
+///
+/// This builder provides a convenient way to construct a `SearchParameters` object
+/// for a Typesense search query. All parameters are optional.
+#[builder(
+ // expose a public builder type named `SearchParametersBuilder` and a public finish_fn `build()`
+ builder_type(name = SearchParametersBuilder, vis = "pub"),
+ finish_fn(name = build, vis = "pub"),
+ // allow passing &str into String params
+ on(String, into)
+)]
+pub fn new_search_parameters(
+ /// The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by.
+ q: Option,
+ /// A list of `string` fields that should be queried against. Multiple fields are separated with a comma.
+ query_by: Option,
+ /// Whether to use natural language processing to parse the query.
+ nl_query: Option,
+ /// The ID of the natural language model to use.
+ nl_model_id: Option,
+ /// The relative weight to give each `query_by` field when ranking results. This can be used to boost fields in priority, when looking for matches. Multiple fields are separated with a comma.
+ query_by_weights: Option,
+ /// In a multi-field matching context, this parameter determines how the representative text match score of a record is calculated. Possible values are max_score (default) or max_weight.
+ text_match_type: Option,
+ /// Boolean field to indicate that the last word in the query should be treated as a prefix, and not as a whole word. This is used for building autocomplete and instant search interfaces. Defaults to true.
+ prefix: Option,
+ /// If infix index is enabled for this field, infix searching can be done on a per-field basis by sending a comma separated string parameter called infix to the search query. This parameter can have 3 values; `off` infix search is disabled, which is default `always` infix search is performed along with regular search `fallback` infix search is performed if regular search does not produce results
+ infix: Option,
+ /// There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query \"K2100\" has 2 extra symbols in \"6PK2100\". By default, any number of prefixes/suffixes can be present for a match.
+ max_extra_prefix: Option,
+ /// There are also 2 parameters that allow you to control the extent of infix searching max_extra_prefix and max_extra_suffix which specify the maximum number of symbols before or after the query that can be present in the token. For example query \"K2100\" has 2 extra symbols in \"6PK2100\". By default, any number of prefixes/suffixes can be present for a match.
+ max_extra_suffix: Option,
+ /// Filter conditions for refining youropen api validator search results. Separate multiple conditions with &&.
+ filter_by: Option,
+ /// Controls the number of similar words that Typesense considers during fuzzy search on filter_by values. Useful for controlling prefix matches like company_name:Acm*.
+ max_filter_by_candidates: Option,
+ /// A list of numerical fields and their corresponding sort orders that will be used for ordering your results. Up to 3 sort fields can be specified. The text similarity score is exposed as a special `_text_match` field that you can use in the list of sorting fields. If no `sort_by` parameter is specified, results are sorted by `_text_match:desc,default_sorting_field:desc`
+ sort_by: Option,
+ /// A list of fields that will be used for faceting your results on. Separate multiple fields with a comma.
+ facet_by: Option,
+ /// Maximum number of facet values to be returned.
+ max_facet_values: Option,
+ /// Facet values that are returned can now be filtered via this parameter. The matching facet text is also highlighted. For example, when faceting by `category`, you can set `facet_query=category:shoe` to return only facet values that contain the prefix \"shoe\".
+ facet_query: Option,
+ /// The number of typographical errors (1 or 2) that would be tolerated. Default: 2
+ num_typos: Option,
+ /// Results from this specific page number would be fetched.
+ page: Option,
+ /// Number of results to fetch per page. Default: 10
+ per_page: Option,
+ /// Number of hits to fetch. Can be used as an alternative to the per_page parameter. Default: 10.
+ limit: Option,
+ /// Identifies the starting point to return hits from a result set. Can be used as an alternative to the page parameter.
+ offset: Option,
+ /// You can aggregate search results into groups or buckets by specify one or more `group_by` fields. Separate multiple fields with a comma. To group on a particular field, it must be a faceted field.
+ group_by: Option,
+ /// Maximum number of hits to be returned for every group. If the `group_limit` is set as `K` then only the top K hits in each group are returned in the response. Default: 3
+ group_limit: Option,
+ /// Setting this parameter to true will place all documents that have a null value in the group_by field, into a single group. Setting this parameter to false, will cause each document with a null value in the group_by field to not be grouped with other documents. Default: true
+ group_missing_values: Option,
+ /// List of fields from the document to include in the search result
+ include_fields: Option,
+ /// List of fields from the document to exclude in the search result
+ exclude_fields: Option,
+ /// List of fields which should be highlighted fully without snippeting
+ highlight_full_fields: Option,
+ /// The number of tokens that should surround the highlighted text on each side. Default: 4
+ highlight_affix_num_tokens: Option,
+ /// The start tag used for the highlighted snippets. Default: ``
+ highlight_start_tag: Option,
+ /// The end tag used for the highlighted snippets. Default: ``
+ highlight_end_tag: Option,
+ /// Flag for enabling/disabling the deprecated, old highlight structure in the response. Default: true
+ enable_highlight_v1: Option,
+ /// Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30
+ snippet_threshold: Option,
+ /// If the number of results found for a specific query is less than this number, Typesense will attempt to drop the tokens in the query until enough results are found. Tokens that have the least individual hits are dropped first. Set to 0 to disable. Default: 10
+ drop_tokens_threshold: Option,
+ drop_tokens_mode: Option,
+ /// If the number of results found for a specific query is less than this number, Typesense will attempt to look for tokens with more typos until enough results are found. Default: 100
+ typo_tokens_threshold: Option,
+ /// Set this parameter to false to disable typos on alphanumerical query tokens. Default: true.
+ enable_typos_for_alpha_numerical_tokens: Option,
+ /// Whether the filter_by condition of the search query should be applicable to curated results (override definitions, pinned hits, hidden hits, etc.). Default: false
+ filter_curated_hits: Option,
+ /// If you have some synonyms defined but want to disable all of them for a particular search query, set enable_synonyms to false. Default: true
+ enable_synonyms: Option,
+ /// Allow synonym resolution on word prefixes in the query. Default: false
+ synonym_prefix: Option,
+ /// Allow synonym resolution on typo-corrected words in the query. Default: 0
+ synonym_num_typos: Option,
+ /// A list of records to unconditionally include in the search results at specific positions. An example use case would be to feature or promote certain items on the top of search results. A list of `record_id:hit_position`. Eg: to include a record with ID 123 at Position 1 and another record with ID 456 at Position 5, you'd specify `123:1,456:5`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ pinned_hits: Option,
+ /// A list of records to unconditionally hide from search results. A list of `record_id`s to hide. Eg: to hide records with IDs 123 and 456, you'd specify `123,456`. You could also use the Overrides feature to override search results based on rules. Overrides are applied first, followed by `pinned_hits` and finally `hidden_hits`.
+ hidden_hits: Option,
+ /// Comma separated list of tags to trigger the curations rules that match the tags.
+ override_tags: Option,
+ /// A list of custom fields that must be highlighted even if you don't query for them
+ highlight_fields: Option,
+ /// Treat space as typo: search for q=basket ball if q=basketball is not found or vice-versa. Splitting/joining of tokens will only be attempted if the original query produces no results. To always trigger this behavior, set value to `always``. To disable, set value to `off`. Default is `fallback`.
+ split_join_tokens: Option,
+ /// You can index content from any logographic language into Typesense if you are able to segment / split the text into space-separated words yourself before indexing and querying. Set this parameter to true to do the same
+ pre_segmented_query: Option,
+ /// Search using a bunch of search parameters by setting this parameter to the name of the existing Preset.
+ preset: Option,
+ /// If you have some overrides defined but want to disable all of them during query time, you can do that by setting this parameter to false
+ enable_overrides: Option,
+ /// Set this parameter to true to ensure that an exact match is ranked above the others
+ prioritize_exact_match: Option,
+ /// Control the number of words that Typesense considers for typo and prefix searching.
+ max_candidates: Option,
+ /// Make Typesense prioritize documents where the query words appear earlier in the text.
+ prioritize_token_position: Option,
+ /// Make Typesense prioritize documents where the query words appear in more number of fields.
+ prioritize_num_matching_fields: Option,
+ /// Make Typesense disable typos for numerical tokens.
+ enable_typos_for_numerical_tokens: Option,
+ /// Setting this to true will make Typesense consider all prefixes and typo corrections of the words in the query without stopping early when enough results are found (drop_tokens_threshold and typo_tokens_threshold configurations are ignored).
+ exhaustive_search: Option,
+ /// Typesense will attempt to return results early if the cutoff time has elapsed. This is not a strict guarantee and facet computation is not bound by this parameter.
+ search_cutoff_ms: Option,
+ /// Enable server side caching of search query results. By default, caching is disabled.
+ use_cache: Option,
+ /// The duration (in seconds) that determines how long the search query is cached. This value can be set on a per-query basis. Default: 60.
+ cache_ttl: Option,
+ /// Minimum word length for 1-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ min_len_1typo: Option,
+ /// Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
+ min_len_2typo: Option,
+ /// Vector query expression for fetching documents \"closest\" to a given query/document vector.
+ vector_query: Option,
+ /// Timeout (in milliseconds) for fetching remote embeddings.
+ remote_embedding_timeout_ms: Option,
+ /// Number of times to retry fetching remote embeddings.
+ remote_embedding_num_tries: Option,
+ /// Choose the underlying faceting strategy used. Comma separated string of allows values: exhaustive, top_values or automatic (default).
+ facet_strategy: Option,
+ /// Name of the stopwords set to apply for this search, the keywords present in the set will be removed from the search query.
+ stopwords: Option,
+ /// Comma separated string of nested facet fields whose parent object should be returned in facet response.
+ facet_return_parent: Option,
+ /// The base64 encoded audio file in 16 khz 16-bit WAV format.
+ voice_query: Option,
+ /// Enable conversational search.
+ conversation: Option,
+ /// The Id of Conversation Model to be used.
+ conversation_model_id: Option,
+ /// The Id of a previous conversation to continue, this tells Typesense to include prior context when communicating with the LLM.
+ conversation_id: Option,
+) -> SearchParameters {
+ SearchParameters {
+ q,
+ query_by,
+ nl_query,
+ nl_model_id,
+ query_by_weights,
+ text_match_type,
+ prefix,
+ infix,
+ max_extra_prefix,
+ max_extra_suffix,
+ filter_by,
+ max_filter_by_candidates,
+ sort_by,
+ facet_by,
+ max_facet_values,
+ facet_query,
+ num_typos,
+ page,
+ per_page,
+ limit,
+ offset,
+ group_by,
+ group_limit,
+ group_missing_values,
+ include_fields,
+ exclude_fields,
+ highlight_full_fields,
+ highlight_affix_num_tokens,
+ highlight_start_tag,
+ highlight_end_tag,
+ enable_highlight_v1,
+ snippet_threshold,
+ drop_tokens_threshold,
+ drop_tokens_mode,
+ typo_tokens_threshold,
+ enable_typos_for_alpha_numerical_tokens,
+ filter_curated_hits,
+ enable_synonyms,
+ synonym_prefix,
+ synonym_num_typos,
+ pinned_hits,
+ hidden_hits,
+ override_tags,
+ highlight_fields,
+ split_join_tokens,
+ pre_segmented_query,
+ preset,
+ enable_overrides,
+ prioritize_exact_match,
+ max_candidates,
+ prioritize_token_position,
+ prioritize_num_matching_fields,
+ enable_typos_for_numerical_tokens,
+ exhaustive_search,
+ search_cutoff_ms,
+ use_cache,
+ cache_ttl,
+ min_len_1typo,
+ min_len_2typo,
+ vector_query,
+ remote_embedding_timeout_ms,
+ remote_embedding_num_tries,
+ facet_strategy,
+ stopwords,
+ facet_return_parent,
+ voice_query,
+ conversation,
+ conversation_model_id,
+ conversation_id,
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::models::{DropTokensMode, SearchParameters};
+
+ #[test]
+ fn test_search_parameters_builder_basic() {
+ let built = new_search_parameters()
+ .q("a test query")
+ .query_by("title,description")
+ .per_page(15)
+ .build();
+
+ let expected = SearchParameters {
+ q: Some("a test query".to_string()),
+ query_by: Some("title,description".to_string()),
+ per_page: Some(15),
+ ..Default::default()
+ };
+
+ assert_eq!(built, expected);
+ }
+
+ #[test]
+ fn test_search_parameters_builder_full() {
+ let built = new_search_parameters()
+ .q("*")
+ .filter_by("stock > 0")
+ .use_cache(true)
+ .drop_tokens_mode(DropTokensMode::LeftToRight)
+ .search_cutoff_ms(50)
+ .build();
+
+ let expected = SearchParameters {
+ q: Some("*".to_string()),
+ filter_by: Some("stock > 0".to_string()),
+ use_cache: Some(true),
+ drop_tokens_mode: Some(DropTokensMode::LeftToRight),
+ search_cutoff_ms: Some(50),
+ ..Default::default()
+ };
+
+ assert_eq!(built, expected);
+ }
+
+ #[test]
+ fn test_search_parameters_builder_defaults() {
+ let built = new_search_parameters().build();
+ let expected = SearchParameters::default();
+ assert_eq!(built, expected);
+ }
+}
diff --git a/typesense/src/client/alias.rs b/typesense/src/client/alias.rs
new file mode 100644
index 0000000..c20a769
--- /dev/null
+++ b/typesense/src/client/alias.rs
@@ -0,0 +1,55 @@
+//! Provides access to the collection alias-related API endpoints.
+//!
+//! An `Alias` instance is created via the main `client.alias()` method.
+
+use crate::{Client, Error};
+use typesense_codegen::{
+ apis::{collections_api, configuration},
+ models,
+};
+
+/// Provides methods for interacting with a specific Typesense collection alias.
+///
+/// This struct is created by calling `client.alias()`.
+pub struct Alias<'a> {
+ pub(super) client: &'a Client,
+ pub(super) name: &'a str,
+}
+
+impl<'a> Alias<'a> {
+ /// Creates a new `Alias` instance.
+ pub(super) fn new(client: &'a Client, name: &'a str) -> Self {
+ Self { client, name }
+ }
+
+ /// Retrieves the details of a collection alias, including the collection it points to.
+ pub async fn retrieve(
+ &self,
+ ) -> Result> {
+ let params = collections_api::GetAliasParams {
+ alias_name: self.name.to_owned(),
+ };
+
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { collections_api::get_alias(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Deletes a collection alias.
+ pub async fn delete(
+ &self,
+ ) -> Result> {
+ let params = collections_api::DeleteAliasParams {
+ alias_name: self.name.to_string(),
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { collections_api::delete_alias(&config, params_for_move).await }
+ })
+ .await
+ }
+}
diff --git a/typesense/src/client/aliases.rs b/typesense/src/client/aliases.rs
new file mode 100644
index 0000000..94c3852
--- /dev/null
+++ b/typesense/src/client/aliases.rs
@@ -0,0 +1,60 @@
+//! Provides access to the collection aliases-related API endpoints.
+//!
+//! An `Aliases` instance is created via the main `client.aliases()` method.
+
+use crate::{Client, Error};
+use typesense_codegen::{
+ apis::{collections_api, configuration},
+ models,
+};
+
+/// Provides methods for interacting with Typesense collection aliases.
+///
+/// This struct is created by calling `client.aliases()`.
+pub struct Aliases<'a> {
+ pub(super) client: &'a Client,
+}
+
+impl<'a> Aliases<'a> {
+ /// Creates a new `Aliases` instance.
+ pub(super) fn new(client: &'a Client) -> Self {
+ Self { client }
+ }
+
+ /// Creates or updates a collection alias.
+ ///
+ /// An alias is a virtual collection name that points to a real collection.
+ /// Aliases are useful when you want to re-index your data in the background
+ /// on a new collection and then switch your application to it without any
+ /// changes to your code.
+ ///
+ /// # Arguments
+ /// * `schema` - A `CollectionAliasSchema` pointing to the target collection.
+ pub async fn upsert(
+ &self,
+ alias_name: &str,
+ schema: models::CollectionAliasSchema,
+ ) -> Result> {
+ let params = collections_api::UpsertAliasParams {
+ alias_name: alias_name.to_string(),
+ collection_alias_schema: Some(schema),
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { collections_api::upsert_alias(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Lists all aliases and the corresponding collections that they map to.
+ pub async fn retrieve(
+ &self,
+ ) -> Result> {
+ self.client
+ .execute(|config: configuration::Configuration| async move {
+ collections_api::get_aliases(&config).await
+ })
+ .await
+ }
+}
diff --git a/typesense/src/client/analytics/events.rs b/typesense/src/client/analytics/events.rs
new file mode 100644
index 0000000..9d68924
--- /dev/null
+++ b/typesense/src/client/analytics/events.rs
@@ -0,0 +1,45 @@
+//! Provides access to the API endpoint for posting analytics events.
+//!
+//! An `Events` instance is created via the `Client::analytics().events()` method.
+
+use crate::{Client, Error};
+use typesense_codegen::{
+ apis::{analytics_api, configuration},
+ models,
+};
+
+/// Provides methods for interacting with analytics events.
+///
+/// This struct is created by calling `client.analytics().events()`.
+pub struct Events<'a> {
+ pub(super) client: &'a Client,
+}
+
+impl<'a> Events<'a> {
+ /// Creates a new `Events` instance.
+ pub(super) fn new(client: &'a Client) -> Self {
+ Self { client }
+ }
+
+ /// Posts an analytics event for tracking user behavior.
+ ///
+ /// This is useful for features like "search result ranking based on popularity."
+ ///
+ /// # Arguments
+ /// * `schema` - An `AnalyticsEventCreateSchema` object representing the event.
+ pub async fn create(
+ &self,
+ schema: models::AnalyticsEventCreateSchema,
+ ) -> Result>
+ {
+ let params = analytics_api::CreateAnalyticsEventParams {
+ analytics_event_create_schema: schema,
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { analytics_api::create_analytics_event(&config, params_for_move).await }
+ })
+ .await
+ }
+}
diff --git a/typesense/src/client/analytics/mod.rs b/typesense/src/client/analytics/mod.rs
new file mode 100644
index 0000000..1dc5f93
--- /dev/null
+++ b/typesense/src/client/analytics/mod.rs
@@ -0,0 +1,44 @@
+//! Provides access to the analytics API endpoints for managing rules and posting events.
+//!
+//! An `Analytics` instance is created via the main `Client::analytics()` method.
+pub mod events;
+pub mod rule;
+pub mod rules;
+use crate::Client;
+pub use events::Events;
+pub use rule::Rule;
+pub use rules::Rules;
+
+/// Provides methods for interacting with Typesense analytics rules and events.
+///
+/// This struct is created by calling `client.analytics()`.
+pub struct Analytics<'a> {
+ pub(super) client: &'a Client,
+}
+
+impl<'a> Analytics<'a> {
+ /// Creates a new `Analytics` instance.
+ pub(super) fn new(client: &'a Client) -> Self {
+ Self { client }
+ }
+
+ /// Provides access to endpoints for managing a collection of analytics rules.
+ pub fn rules(&self) -> Rules<'a> {
+ Rules::new(self.client)
+ }
+
+ /// Provides access to endpoints for managing a single analytics rule.
+ ///
+ /// # Arguments
+ /// * `rule_name` - The name of the analytics rule to manage.
+ pub fn rule(&self, rule_name: &'a str) -> Rule<'a> {
+ Rule::new(self.client, rule_name)
+ }
+
+ /// Provides access to the endpoint for creating analytics events.
+ ///
+ /// Example: `client.analytics().events().create(...).await`
+ pub fn events(&self) -> Events<'a> {
+ Events::new(self.client)
+ }
+}
diff --git a/typesense/src/client/analytics/rule.rs b/typesense/src/client/analytics/rule.rs
new file mode 100644
index 0000000..1496947
--- /dev/null
+++ b/typesense/src/client/analytics/rule.rs
@@ -0,0 +1,55 @@
+//! Provides access to the API endpoints for managing a single analytics rule.
+//!
+//! An `Rule` instance is created via the `Client::analytics().rule("rule_name")` method.
+
+use crate::{Client, Error};
+use typesense_codegen::{
+ apis::{analytics_api, configuration},
+ models,
+};
+
+/// Provides methods for interacting with a specific analytics rule.
+///
+/// This struct is created by calling `analytics.rule("rule_name")`.
+pub struct Rule<'a> {
+ pub(super) client: &'a Client,
+ pub(super) rule_name: &'a str,
+}
+
+impl<'a> Rule<'a> {
+ /// Creates a new `Rule` instance for a specific rule name.
+ pub(super) fn new(client: &'a Client, rule_name: &'a str) -> Self {
+ Self { client, rule_name }
+ }
+
+ /// Retrieves the details of this specific analytics rule.
+ pub async fn retrieve(
+ &self,
+ ) -> Result> {
+ let params = analytics_api::RetrieveAnalyticsRuleParams {
+ rule_name: self.rule_name.to_string(),
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { analytics_api::retrieve_analytics_rule(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Permanently deletes this specific analytics rule.
+ pub async fn delete(
+ &self,
+ ) -> Result>
+ {
+ let params = analytics_api::DeleteAnalyticsRuleParams {
+ rule_name: self.rule_name.to_string(),
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { analytics_api::delete_analytics_rule(&config, params_for_move).await }
+ })
+ .await
+ }
+}
diff --git a/typesense/src/client/analytics/rules.rs b/typesense/src/client/analytics/rules.rs
new file mode 100644
index 0000000..bca50bb
--- /dev/null
+++ b/typesense/src/client/analytics/rules.rs
@@ -0,0 +1,78 @@
+//! Provides access to the API endpoints for managing analytics rules.
+//!
+//! An `Rules` instance is created via the `Client::analytics().rules()` method.
+
+use crate::{Client, Error};
+use typesense_codegen::{
+ apis::{analytics_api, configuration},
+ models,
+};
+
+/// Provides methods for interacting with a collection of analytics rules.
+///
+/// This struct is created by calling `client.analytics().rules()`.
+pub struct Rules<'a> {
+ pub(super) client: &'a Client,
+}
+
+impl<'a> Rules<'a> {
+ /// Creates a new `Rules` instance.
+ pub(super) fn new(client: &'a Client) -> Self {
+ Self { client }
+ }
+
+ /// Creates a new analytics rule.
+ ///
+ /// # Arguments
+ /// * `schema` - An `AnalyticsRuleSchema` object describing the rule to be created.
+ pub async fn create(
+ &self,
+ schema: models::AnalyticsRuleSchema,
+ ) -> Result> {
+ let params = analytics_api::CreateAnalyticsRuleParams {
+ analytics_rule_schema: schema,
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { analytics_api::create_analytics_rule(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Creates or updates an analytics rule with the given name.
+ ///
+ /// # Arguments
+ /// * `rule_name` - The name of the analytics rule to create or update.
+ /// * `schema` - An `AnalyticsRuleUpsertSchema` object with the rule's parameters.
+ pub async fn upsert(
+ &self,
+ rule_name: &str,
+ schema: models::AnalyticsRuleUpsertSchema,
+ ) -> Result> {
+ let params = analytics_api::UpsertAnalyticsRuleParams {
+ rule_name: rule_name.to_string(),
+ analytics_rule_upsert_schema: schema,
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { analytics_api::upsert_analytics_rule(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Retrieves the details of all analytics rules.
+ pub async fn retrieve(
+ &self,
+ ) -> Result<
+ models::AnalyticsRulesRetrieveSchema,
+ Error,
+ > {
+ self.client
+ .execute(|config: configuration::Configuration| async move {
+ analytics_api::retrieve_analytics_rules(&config).await
+ })
+ .await
+ }
+}
diff --git a/typesense/src/client/collection/document.rs b/typesense/src/client/collection/document.rs
new file mode 100644
index 0000000..afa7357
--- /dev/null
+++ b/typesense/src/client/collection/document.rs
@@ -0,0 +1,154 @@
+//! Provides access to API endpoints for a single document within a Typesense collection.
+//!
+//! An instance of `Document` is scoped to a specific document and is created
+//! via a parent `Collection` struct, for example:
+//! `client.collection::("books").document("123")`
+
+use crate::{Client, Error};
+use serde::{Serialize, de::DeserializeOwned};
+use typesense_codegen::{
+ apis::{configuration, documents_api},
+ models,
+};
+
+/// Provides methods for interacting with a single document within a specific Typesense collection.
+///
+/// This struct is created by calling a method like `client.collection::("collection_name").document("document_id")`.
+/// The generic `T` represents the shape of the document and must implement `Serialize` and `DeserializeOwned`.
+/// If `T` is not specified, it defaults to `serde_json::Value` for schemaless interactions.
+pub struct Document<'a, T = serde_json::Value>
+where
+ T: DeserializeOwned + Serialize + Send + Sync,
+{
+ pub(super) client: &'a Client,
+ pub(super) collection_name: &'a str,
+ pub(super) document_id: &'a str,
+ pub(super) _phantom: std::marker::PhantomData,
+}
+
+impl<'a, T> Document<'a, T>
+where
+ T: DeserializeOwned + Serialize + Send + Sync,
+{
+ /// Creates a new `Document` instance for a specific document ID.
+ /// This is intended for internal use by the parent `Collection` struct.
+ pub(super) fn new(client: &'a Client, collection_name: &'a str, document_id: &'a str) -> Self {
+ Self {
+ client,
+ collection_name,
+ document_id,
+ _phantom: std::marker::PhantomData,
+ }
+ }
+
+ /// Fetches this individual document from the collection and deserializes it into `T`.
+ ///
+ /// # Returns
+ /// A `Result` containing the strongly-typed document `T` if successful.
+ pub async fn retrieve(&self) -> Result> {
+ let params = documents_api::GetDocumentParams {
+ collection_name: self.collection_name.to_string(),
+ document_id: self.document_id.to_string(),
+ };
+
+ let result_value = self
+ .client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { documents_api::get_document(&config, params_for_move).await }
+ })
+ .await?;
+
+ // Deserialize the raw JSON value into the user's type T.
+ serde_json::from_value(result_value).map_err(Error::from)
+ }
+
+ /// Updates this individual document. The update can be partial.
+ /// The updated full document is returned.
+ ///
+ /// # Arguments
+ /// * `partial_document` - A serializable struct or a `serde_json::Value` containing the fields to update. For example: `serde_json::json!({ "in_stock": false })`.
+ /// * `params` - An optional `DocumentIndexParameters` struct to specify additional parameters, such as `dirty_values` which determines what Typesense should do when the type of a particular field being indexed does not match the previously inferred type for that field, or the one defined in the collection's schema.
+ ///
+ /// # Returns
+ /// A `Result` containing the full, updated document deserialized into `T`.
+ ///
+ /// # Example
+ /// ```no_run
+ /// # use serde::{Serialize, Deserialize};
+ /// # use typesense::{Client, models};
+ /// # use reqwest::Url;
+ /// # #[derive(Serialize, Deserialize)]
+ /// # struct Book { id: String, title: String, pages: i32 }
+ /// #
+ /// # async fn run() -> Result<(), Box> {
+ /// # let client = Client::builder()
+ /// # .nodes(vec![Url::parse("http://localhost:8108").unwrap()])
+ /// # .api_key("xyz")
+ /// # .build()
+ /// # .unwrap();
+ /// let book_update = serde_json::json!({ "pages": 654 });
+ ///
+ /// // Simple update
+ /// let updated_book = client.collection_of::("books").document("123")
+ /// .update(&book_update, None)
+ /// .await?;
+ ///
+ /// // Update with additional parameters
+ /// let params = models::DocumentIndexParameters {
+ /// dirty_values: Some(models::DirtyValues::CoerceOrReject),
+ /// };
+ /// let updated_book_with_params = client.collection_of::("books").document("124")
+ /// .update(&book_update, Some(params))
+ /// .await?;
+ /// #
+ /// # Ok(())
+ /// # }
+ /// ```
+ pub async fn update(
+ &self,
+ partial_document: &U,
+ params: Option,
+ ) -> Result> {
+ let params = documents_api::UpdateDocumentParams {
+ collection_name: self.collection_name.to_string(),
+ document_id: self.document_id.to_string(),
+ body: serde_json::to_value(partial_document)?,
+ dirty_values: params.unwrap_or_default().dirty_values,
+ };
+
+ let result_value = self
+ .client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { documents_api::update_document(&config, params_for_move).await }
+ })
+ .await?;
+
+ // Deserialize the raw JSON value of the updated document into T.
+ serde_json::from_value(result_value).map_err(Error::from)
+ }
+
+ /// Deletes this individual document from the collection.
+ /// The deleted document is returned.
+ ///
+ /// # Returns
+ /// A `Result` containing the deleted document deserialized into `T`.
+ pub async fn delete(&self) -> Result> {
+ let params = documents_api::DeleteDocumentParams {
+ collection_name: self.collection_name.to_string(),
+ document_id: self.document_id.to_string(),
+ };
+
+ let result_value = self
+ .client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { documents_api::delete_document(&config, params_for_move).await }
+ })
+ .await?;
+
+ // Deserialize the raw JSON value of the deleted document into T.
+ serde_json::from_value(result_value).map_err(Error::from)
+ }
+}
diff --git a/typesense/src/client/collection/documents.rs b/typesense/src/client/collection/documents.rs
new file mode 100644
index 0000000..8be2c4f
--- /dev/null
+++ b/typesense/src/client/collection/documents.rs
@@ -0,0 +1,307 @@
+//! Provides access to the document, search, and override-related API endpoints.
+//!
+//! An instance of `Documents` is scoped to a specific collection and is created
+//! via the main `client.collection("collection_name").documents()` method or
+//! `client.collection_of::("...").documents()`.
+
+use crate::models::SearchResult;
+use crate::{Client, Error};
+use serde::{Serialize, de::DeserializeOwned};
+use typesense_codegen::{
+ apis::{configuration, documents_api},
+ models::{
+ self as raw_models, DeleteDocumentsParameters, DocumentIndexParameters,
+ ExportDocumentsParameters, ImportDocumentsParameters, UpdateDocumentsParameters,
+ },
+};
+/// Provides methods for interacting with documents within a specific Typesense collection.
+///
+/// This struct is generic over the document type `T`. If created via `client.collection(...)`,
+/// `T` defaults to `serde_json::Value`. If created via `client.collection_of::(...)`,
+/// `T` will be `MyType`.
+pub struct Documents<'a, T = serde_json::Value>
+where
+ T: DeserializeOwned + Serialize + Send + Sync,
+{
+ pub(super) client: &'a Client,
+ pub(super) collection_name: &'a str,
+ pub(super) _phantom: std::marker::PhantomData,
+}
+
+impl<'a, T> Documents<'a, T>
+where
+ T: DeserializeOwned + Serialize + Send + Sync,
+{
+ /// Creates a new `Documents` instance.
+ ///
+ /// This is typically called by `Client::documents()`.
+ pub(super) fn new(client: &'a Client, collection_name: &'a str) -> Self {
+ Self {
+ client,
+ collection_name,
+ _phantom: std::marker::PhantomData,
+ }
+ }
+
+ /// Indexes a document in the collection.
+ /// # Arguments
+ /// * `document` - A `serde_json::Value` representing the document.
+ /// * `action` - The indexing action to perform (e.g., "create", "upsert").
+ async fn index(
+ &self,
+ document: serde_json::Value,
+ action: &str,
+ params: Option,
+ ) -> Result> {
+ let params = documents_api::IndexDocumentParams {
+ collection_name: self.collection_name.to_string(),
+ body: document,
+ action: Some(action.to_string()),
+ dirty_values: params.unwrap_or_default().dirty_values, // Or expose this as an argument if needed
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { documents_api::index_document(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Creates a new document in the collection.
+ ///
+ /// Fails if a document with the same ID already exists. If the document has an `id` field
+ /// of type `string`, it will be used as the document's ID. Otherwise, Typesense will
+ /// auto-generate an ID. The newly indexed document is returned.
+ ///
+ /// # Arguments
+ /// * `document` - A reference to the document to create.
+ /// * `params` - Optional parameters like `dirty_values`.
+ pub async fn create(
+ &self,
+ document: &T,
+ params: Option,
+ ) -> Result> {
+ let doc_value = serde_json::to_value(document)?;
+ let result_value = self.index(doc_value, "create", params).await?;
+ serde_json::from_value(result_value).map_err(Error::from)
+ }
+
+ /// Creates a new document or updates an existing one if an ID match is found.
+ ///
+ /// This method requires the full document to be sent. For partial updates, use
+ /// `collection.document("...").update()`. The indexed document is returned.
+ ///
+ /// # Arguments
+ /// * `document` - A reference to the document to upsert.
+ /// * `params` - Optional parameters like `dirty_values`.
+ pub async fn upsert(
+ &self,
+ document: &T,
+ params: Option,
+ ) -> Result> {
+ let doc_value = serde_json::to_value(document)?;
+ let result_value = self.index(doc_value, "upsert", params).await?;
+ serde_json::from_value(result_value).map_err(Error::from)
+ }
+
+ // --- Bulk Operation Methods ---
+
+ /// Imports a batch of documents in JSONL format.
+ ///
+ /// The documents to be imported must be formatted as a newline-delimited JSON string.
+ ///
+ /// # Arguments
+ /// * `documents_jsonl` - A string containing the documents in JSONL format.
+ /// * `params` - An `ImportDocumentsParameters` struct containing options like `action` and `batch_size`.
+ pub async fn import(
+ &self,
+ documents_jsonl: String,
+ params: ImportDocumentsParameters,
+ ) -> Result> {
+ let params = documents_api::ImportDocumentsParams {
+ body: documents_jsonl,
+ collection_name: self.collection_name.to_string(),
+
+ action: params.action,
+ batch_size: params.batch_size,
+ dirty_values: params.dirty_values,
+ remote_embedding_batch_size: params.remote_embedding_batch_size,
+ return_doc: params.return_doc,
+ return_id: params.return_id,
+ };
+
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { documents_api::import_documents(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Exports all documents in a collection in JSONL format.
+ ///
+ /// # Arguments
+ /// * `params` - An `ExportDocumentsParameters` struct containing options like `filter_by` and `include_fields`.
+ pub async fn export(
+ &self,
+ params: ExportDocumentsParameters,
+ ) -> Result> {
+ let params = documents_api::ExportDocumentsParams {
+ collection_name: self.collection_name.to_string(),
+ exclude_fields: params.exclude_fields,
+ filter_by: params.filter_by,
+ include_fields: params.include_fields,
+ };
+
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { documents_api::export_documents(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Deletes a batch of documents matching a specific filter condition.
+ ///
+ /// # Arguments
+ /// * `params` - A `DeleteDocumentsParameters` describing the conditions for deleting documents.
+ pub async fn delete(
+ &self,
+ params: DeleteDocumentsParameters,
+ ) -> Result>
+ {
+ let params = documents_api::DeleteDocumentsParams {
+ collection_name: self.collection_name.to_string(),
+ filter_by: Some(params.filter_by),
+ batch_size: params.batch_size,
+ ignore_not_found: params.ignore_not_found,
+ truncate: params.truncate,
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { documents_api::delete_documents(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Updates a batch of documents matching a specific filter condition.
+ ///
+ /// # Arguments
+ /// * `document` - A `serde_json::Value` containing the fields to update.
+ /// * `params` - A `UpdateDocumentsParameters` describing the conditions for updating documents.
+ pub async fn update(
+ &self,
+ document: serde_json::Value,
+ params: UpdateDocumentsParameters,
+ ) -> Result>
+ {
+ let params = documents_api::UpdateDocumentsParams {
+ collection_name: self.collection_name.to_string(),
+ filter_by: params.filter_by,
+ body: document,
+ };
+ self.client
+ .execute(|config: configuration::Configuration| {
+ let params_for_move = params.clone();
+ async move { documents_api::update_documents(&config, params_for_move).await }
+ })
+ .await
+ }
+
+ /// Searches for documents in the collection that match the given criteria.
+ /// The search results will have their `document` field deserialized into type `T`.
+ ///
+ /// # Arguments
+ /// * `params` - A `SearchParameters` struct containing all search parameters.
+ pub async fn search(
+ &self,
+ params: raw_models::SearchParameters,
+ ) -> Result