View Source OpenApiTypesense.Documents (OpenApiTypesense v0.2.1)

Provides API endpoints related to documents

Summary

Functions

Delete a bunch of documents

Delete an override associated with a collection

Export all documents in a collection

List all collection overrides

Import documents into a collection

send multiple search requests in a single HTTP request

Search for documents in a collection

Update documents with conditional query

Create or update an override to promote certain documents over others

Types

delete_documents_200_json_resp()

@type delete_documents_200_json_resp() :: %{num_deleted: integer()}

update_documents_200_json_resp()

@type update_documents_200_json_resp() :: %{num_updated: integer()}

Functions

delete_document(collectionName, documentId, opts \\ [])

@spec delete_document(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

Delete a document

Delete an individual document from a collection by using its ID.

delete_document(conn, collectionName, documentId, opts)

@spec delete_document(
  OpenApiTypesense.Connection.t(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

delete_documents(collectionName, opts \\ [])

@spec delete_documents(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.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.

Options

  • deleteDocumentsParameters

delete_documents(conn, collectionName, opts)

@spec delete_documents(OpenApiTypesense.Connection.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

delete_search_override(collectionName, overrideId, opts \\ [])

@spec delete_search_override(String.t(), String.t(), keyword()) ::
  {:ok, OpenApiTypesense.SearchOverrideDeleteResponse.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Delete an override associated with a collection

delete_search_override(conn, collectionName, overrideId, opts)

export_documents(collectionName, opts \\ [])

@spec export_documents(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, OpenApiTypesense.ApiResponse.t()}

Export all documents in a collection

Export all documents in a collection in JSON lines format.

Options

  • exportDocumentsParameters

export_documents(conn, collectionName, opts)

@spec export_documents(OpenApiTypesense.Connection.t(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, OpenApiTypesense.ApiResponse.t()}

get_document(collectionName, documentId, opts \\ [])

@spec get_document(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

Retrieve a document

Fetch an individual document from a collection by using its ID.

get_document(conn, collectionName, documentId, opts)

@spec get_document(OpenApiTypesense.Connection.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

get_search_override(collectionName, overrideId, opts \\ [])

@spec get_search_override(String.t(), String.t(), keyword()) ::
  {:ok, OpenApiTypesense.SearchOverride.t()} | :error

Retrieve a single search override

Retrieve the details of a search override, given its id.

get_search_override(conn, collectionName, overrideId, opts)

@spec get_search_override(
  OpenApiTypesense.Connection.t(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, OpenApiTypesense.SearchOverride.t()} | :error

get_search_overrides(collectionName, opts \\ [])

@spec get_search_overrides(
  String.t(),
  keyword()
) :: {:ok, OpenApiTypesense.SearchOverridesResponse.t()} | :error

List all collection overrides

get_search_overrides(conn, collectionName, opts)

@spec get_search_overrides(OpenApiTypesense.Connection.t(), String.t(), keyword()) ::
  {:ok, OpenApiTypesense.SearchOverridesResponse.t()} | :error

import_documents(collectionName, body, opts \\ [])

@spec import_documents(String.t(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, OpenApiTypesense.ApiResponse.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.

Options

  • importDocumentsParameters

import_documents(conn, collectionName, body, opts)

@spec import_documents(
  OpenApiTypesense.Connection.t(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, String.t()} | {:error, OpenApiTypesense.ApiResponse.t()}

index_document(collectionName, body, opts \\ [])

@spec index_document(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

Index a document

A document to be indexed in a given collection must conform to the schema of the collection.

Options

  • action: Additional action to perform
  • dirty_values: Dealing with Dirty Data

index_document(conn, collectionName, body, opts)

@spec index_document(OpenApiTypesense.Connection.t(), String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

multi_search(body, opts \\ [])

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.

Options

  • multiSearchParameters

multi_search(conn, body, opts)

search_collection(collectionName, opts \\ [])

@spec search_collection(
  String.t(),
  keyword()
) ::
  {:ok, OpenApiTypesense.SearchResult.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Search for documents in a collection

Search for documents in a collection that match the search criteria.

Options

  • searchParameters

search_collection(conn, collectionName, opts)

update_document(collectionName, documentId, body, opts \\ [])

@spec update_document(String.t(), String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

Update a document

Update an individual document from a collection by using its ID. The update can be partial.

Options

  • dirty_values: Dealing with Dirty Data

update_document(conn, collectionName, documentId, body, opts)

@spec update_document(
  OpenApiTypesense.Connection.t(),
  String.t(),
  String.t(),
  map(),
  keyword()
) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

update_documents(collectionName, body, opts \\ [])

@spec update_documents(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.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.

Options

  • updateDocumentsParameters

update_documents(conn, collectionName, body, opts)

@spec update_documents(OpenApiTypesense.Connection.t(), String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}

upsert_search_override(collectionName, overrideId, body, opts \\ [])

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.

upsert_search_override(conn, collectionName, overrideId, body, opts)