Typesensory.Api.Documents (Typesensory v0.1.0)
API calls for all endpoints tagged Documents
.
Link to this section Summary
Functions
Delete a document Delete an individual document from a collection by using its ID.
Delete a bunch of documents
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.
Delete an override associated with a collection
Delete a synonym associated with a collection
Export all documents in a collection Export all documents in a collection in JSON lines format.
Retreive a document Fetch an individual document from a collection by using its ID.
Retrieve a single search override Retrieve the details of a search override, given its id.
List all collection overrides
Retrieve a single search synonym Retrieve the details of a search synonym, given its id.
List all collection synonyms
Import documents into a collection 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.
Index a document A document to be indexed in a given collection must conform to the schema of the collection.
send multiple search requests in a single HTTP request 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.
Search for documents in a collection Search for documents in a collection that match the search criteria.
Update a document Update an individual document from a collection by using its ID. The update can be partial.
Update documents with conditional query
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.
Create or update an override to promote certain documents over others Create or update an override to promote certain documents over others. Using overrides, you can include or exclude specific documents for a given query.
Create or update a synonym Create or update a synonym to define search terms that should be considered equivalent.
Link to this section Functions
delete_document(connection, collection_name, document_id, opts \\ [])
@spec delete_document(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, Map.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Delete a document Delete an individual document from a collection by using its ID.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to search for the document underdocument_id
(String.t): The Document IDopts
(keyword): Optional parameters
returns
Returns
{:ok, map()}
on success{:error, Tesla.Env.t}
on failure
delete_documents(connection, collection_name, opts \\ [])
@spec delete_documents(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.DeleteDocuments200Response.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Delete a bunch of documents
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.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to delete documents fromopts
(keyword): Optional parameters:deleteDocumentsParameters
(DeleteDocumentsDeleteDocumentsParametersParameter):
returns
Returns
{:ok, Typesensory.Model.DeleteDocuments200Response.t}
on success{:error, Tesla.Env.t}
on failure
delete_search_override(connection, collection_name, override_id, opts \\ [])
@spec delete_search_override(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, Typesensory.Model.ApiResponse.t()} | {:ok, Typesensory.Model.SearchOverride.t()} | {:error, Tesla.Env.t()}
Delete an override associated with a collection
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionoverride_id
(String.t): The ID of the search override to deleteopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchOverride.t}
on success{:error, Tesla.Env.t}
on failure
delete_search_synonym(connection, collection_name, synonym_id, opts \\ [])
@spec delete_search_synonym(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, Typesensory.Model.SearchSynonym.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Delete a synonym associated with a collection
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionsynonym_id
(String.t): The ID of the search synonym to deleteopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchSynonym.t}
on success{:error, Tesla.Env.t}
on failure
export_documents(connection, collection_name, opts \\ [])
@spec export_documents(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.ApiResponse.t()} | {:ok, String.t()} | {:error, Tesla.Env.t()}
Export all documents in a collection Export all documents in a collection in JSON lines format.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionopts
(keyword): Optional parameters:exportDocumentsParameters
(ExportDocumentsExportDocumentsParametersParameter):
returns
Returns
{:ok, String.t}
on success{:error, Tesla.Env.t}
on failure
get_document(connection, collection_name, document_id, opts \\ [])
@spec get_document(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, Map.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Retreive a document Fetch an individual document from a collection by using its ID.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to search for the document underdocument_id
(String.t): The Document IDopts
(keyword): Optional parameters
returns
Returns
{:ok, map()}
on success{:error, Tesla.Env.t}
on failure
get_search_override(connection, collection_name, override_id, opts \\ [])
@spec get_search_override(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, Typesensory.Model.SearchOverride.t()} | {:error, Tesla.Env.t()}
Retrieve a single search override Retrieve the details of a search override, given its id.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionoverride_id
(String.t): The id of the search overrideopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchOverride.t}
on success{:error, Tesla.Env.t}
on failure
get_search_overrides(connection, collection_name, opts \\ [])
@spec get_search_overrides(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.SearchOverridesResponse.t()} | {:error, Tesla.Env.t()}
List all collection overrides
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchOverridesResponse.t}
on success{:error, Tesla.Env.t}
on failure
get_search_synonym(connection, collection_name, synonym_id, opts \\ [])
@spec get_search_synonym(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, Typesensory.Model.SearchSynonym.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Retrieve a single search synonym Retrieve the details of a search synonym, given its id.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionsynonym_id
(String.t): The id of the search synonymopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchSynonym.t}
on success{:error, Tesla.Env.t}
on failure
get_search_synonyms(connection, collection_name, opts \\ [])
@spec get_search_synonyms(Tesla.Env.client(), String.t(), keyword()) :: {:ok, Typesensory.Model.SearchSynonymsResponse.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
List all collection synonyms
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchSynonymsResponse.t}
on success{:error, Tesla.Env.t}
on failure
import_documents(connection, collection_name, body, opts \\ [])
@spec import_documents(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, Typesensory.Model.ApiResponse.t()} | {:ok, String.t()} | {:error, Tesla.Env.t()}
Import documents into a collection 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.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionbody
(String.t): The json array of documents or the JSONL file to importopts
(keyword): Optional parameters:importDocumentsParameters
(ImportDocumentsImportDocumentsParametersParameter):
returns
Returns
{:ok, String.t}
on success{:error, Tesla.Env.t}
on failure
index_document(connection, collection_name, body, opts \\ [])
@spec index_document( Tesla.Env.client(), String.t(), %{optional(String.t()) => any()}, keyword() ) :: {:ok, Map.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Index a document A document to be indexed in a given collection must conform to the schema of the collection.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to add the document tobody
(map()): The document object to be indexedopts
(keyword): Optional parameters:action
(String.t): Additional action to perform
returns
Returns
{:ok, map()}
on success{:error, Tesla.Env.t}
on failure
multi_search(connection, multi_search_parameters, opts \\ [])
@spec multi_search(Tesla.Env.client(), %{optional(String.t()) => any()}, keyword()) :: {:ok, Typesensory.Model.ApiResponse.t()} | {:ok, Typesensory.Model.MultiSearchResult.t()} | {:error, Tesla.Env.t()}
send multiple search requests in a single HTTP request 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
Parameters
connection
(Typesensory.Connection): Connection to servermulti_search_parameters
(MultiSearchParameters):opts
(keyword): Optional parameters:body
(MultiSearchSearchesParameter):
returns
Returns
{:ok, Typesensory.Model.MultiSearchResult.t}
on success{:error, Tesla.Env.t}
on failure
search_collection(connection, collection_name, search_parameters, opts \\ [])
@spec search_collection( Tesla.Env.client(), String.t(), %{optional(String.t()) => any()}, keyword() ) :: {:ok, Typesensory.Model.ApiResponse.t()} | {:ok, Typesensory.Model.SearchResult.t()} | {:error, Tesla.Env.t()}
Search for documents in a collection Search for documents in a collection that match the search criteria.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to search for the document undersearch_parameters
(SearchParameters):opts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchResult.t}
on success{:error, Tesla.Env.t}
on failure
update_document(connection, collection_name, document_id, body, opts \\ [])
@spec update_document( Tesla.Env.client(), String.t(), String.t(), %{optional(String.t()) => any()}, keyword() ) :: {:ok, Map.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Update a document Update an individual document from a collection by using its ID. The update can be partial.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to search for the document underdocument_id
(String.t): The Document IDbody
(map()): The document object with fields to be updatedopts
(keyword): Optional parameters
returns
Returns
{:ok, map()}
on success{:error, Tesla.Env.t}
on failure
update_documents(connection, collection_name, body, opts \\ [])
@spec update_documents( Tesla.Env.client(), String.t(), %{optional(String.t()) => any()}, keyword() ) :: {:ok, Typesensory.Model.ApiResponse.t()} | {:ok, Typesensory.Model.UpdateDocuments200Response.t()} | {:error, Tesla.Env.t()}
Update documents with conditional query
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.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collection to update documents inbody
(map()): The document fields to be updatedopts
(keyword): Optional parameters:updateDocumentsParameters
(UpdateDocumentsUpdateDocumentsParametersParameter):
returns
Returns
{:ok, Typesensory.Model.UpdateDocuments200Response.t}
on success{:error, Tesla.Env.t}
on failure
upsert_search_override(connection, collection_name, override_id, search_override_schema, opts \\ [])
@spec upsert_search_override( Tesla.Env.client(), String.t(), String.t(), Typesensory.Model.SearchOverrideSchema.t(), keyword() ) :: {:ok, Typesensory.Model.ApiResponse.t()} | {:ok, Typesensory.Model.SearchOverride.t()} | {:error, Tesla.Env.t()}
Create or update an override to promote certain documents over others Create or update an override to promote certain documents over others. Using overrides, you can include or exclude specific documents for a given query.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionoverride_id
(String.t): The ID of the search override to create/updatesearch_override_schema
(SearchOverrideSchema): The search override object to be created/updatedopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchOverride.t}
on success{:error, Tesla.Env.t}
on failure
upsert_search_synonym(connection, collection_name, synonym_id, search_synonym_schema, opts \\ [])
@spec upsert_search_synonym( Tesla.Env.client(), String.t(), String.t(), Typesensory.Model.SearchSynonymSchema.t(), keyword() ) :: {:ok, Typesensory.Model.SearchSynonym.t()} | {:ok, Typesensory.Model.ApiResponse.t()} | {:error, Tesla.Env.t()}
Create or update a synonym Create or update a synonym to define search terms that should be considered equivalent.
parameters
Parameters
connection
(Typesensory.Connection): Connection to servercollection_name
(String.t): The name of the collectionsynonym_id
(String.t): The ID of the search synonym to create/updatesearch_synonym_schema
(SearchSynonymSchema): The search synonym object to be created/updatedopts
(keyword): Optional parameters
returns
Returns
{:ok, Typesensory.Model.SearchSynonym.t}
on success{:error, Tesla.Env.t}
on failure