OpenApiTypesense.Operations (OpenApiTypesense v0.6.5)

View Source

Provides API endpoints related to operations

Summary

Functions

Clears the cache

Either one of

Either one of

Compaction of the underlying RocksDB database

Either one of

Either one of

Enable logging of requests that take over a defined threshold of time.

Either one of

Either one of

Get stats about API endpoints.

Either one of

Get current RAM, CPU, Disk & Network usage metrics.

Either one of

Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory.

Triggers a follower node to initiate the raft voting process, which triggers leader re-election.

Either one of

Either one of

Functions

clear_cache()

@spec clear_cache() ::
  {:ok, OpenApiTypesense.SuccessStatus.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Clears the cache

Responses of search requests that are sent with use_cache parameter are cached in a LRU cache. Clears cache completely.

clear_cache(opts)

Either one of:

  • clear_cache(opts)
  • clear_cache(%{api_key: xyz, host: ...})
  • clear_cache(Connection.new())

clear_cache(conn, opts)

Either one of:

  • clear_cache(%{api_key: xyz, host: ...}, opts)
  • clear_cache(Connection.new(), opts)

compact()

@spec compact() ::
  {:ok, OpenApiTypesense.SuccessStatus.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Compaction of the underlying RocksDB database

Typesense uses RocksDB to store your documents on the disk. If you do frequent writes or updates, you could benefit from running a compaction of the underlying RocksDB database. This could reduce the size of the database and decrease read latency. While the database will not block during this operation, we recommend running it during off-peak hours.

compact(opts)

Either one of:

  • compact(opts)
  • compact(%{api_key: xyz, host: ...})
  • compact(Connection.new())

compact(conn, opts)

Either one of:

  • compact(%{api_key: xyz, host: ...}, opts)
  • compact(Connection.new(), opts)

config(body)

@spec config(map()) ::
  {:ok, OpenApiTypesense.SuccessStatus.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Enable logging of requests that take over a defined threshold of time.

Slow requests are logged to the primary log file, with the prefix SLOW REQUEST. Default is -1 which disables slow request logging.

Example

iex> body = %{"log_slow_requests_time_ms" => 2_000}
iex> OpenApiTypesense.Operations.config(body)

config(body, opts)

Either one of:

  • config(payload, opts)
  • config(%{api_key: xyz, host: ...}, payload)
  • config(Connection.new(), payload)

config(conn, body, opts)

Either one of:

  • config(%{api_key: xyz, host: ...}, payload, opts)
  • config(Connection.new(), payload, opts)

retrieve_api_stats()

@spec retrieve_api_stats() ::
  {:ok, OpenApiTypesense.APIStatsResponse.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Get stats about API endpoints.

Retrieve the stats about API endpoints.

retrieve_api_stats(opts)

Either one of:

  • retrieve_api_stats(opts)
  • retrieve_api_stats(%{api_key: xyz, host: ...})
  • retrieve_api_stats(Connection.new())

retrieve_api_stats(conn, opts)

Either one of:

  • retrieve_api_stats(%{api_key: xyz, host: ...}, opts)
  • retrieve_api_stats(Connection.new(), opts)

retrieve_metrics()

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

Get current RAM, CPU, Disk & Network usage metrics.

Retrieve the metrics.

retrieve_metrics(opts)

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

Either one of:

  • retrieve_metrics(opts)
  • retrieve_metrics(%{api_key: xyz, host: ...})
  • retrieve_metrics(Connection.new())

retrieve_metrics(conn, opts)

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

Either one of:

  • retrieve_metrics(%{api_key: xyz, host: ...}, opts)
  • retrieve_metrics(Connection.new(), opts)

take_snapshot(opts)

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

Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory.

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.

Options

  • snapshot_path: The directory on the server where the snapshot should be saved.

take_snapshot(conn, opts)

Either one of:

  • take_snapshot(%{api_key: xyz, host: ...}, opts)
  • take_snapshot(Connection.new(), opts)

vote()

@spec vote() ::
  {:ok, OpenApiTypesense.SuccessStatus.t()}
  | {:error, OpenApiTypesense.ApiResponse.t()}

Triggers a follower node to initiate the raft voting process, which triggers leader re-election.

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.

vote(opts)

Either one of:

  • vote(opts)
  • vote(%{api_key: xyz, host: ...})
  • vote(Connection.new())

vote(conn, opts)

Either one of:

  • vote(%{api_key: xyz, host: ...}, opts)
  • vote(Connection.new(), opts)