OpenApiTypesense.Operations (OpenApiTypesense v0.6.5)
View SourceProvides 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
Either one of
Get current RAM, CPU, Disk & Network usage metrics.
Either one of
Either one of
Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory.
Either one of
Triggers a follower node to initiate the raft voting process, which triggers leader re-election.
Either one of
Either one of
Functions
@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.
@spec clear_cache(map() | OpenApiTypesense.Connection.t() | keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
clear_cache(opts)
clear_cache(%{api_key: xyz, host: ...})
clear_cache(Connection.new())
@spec clear_cache( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
clear_cache(%{api_key: xyz, host: ...}, opts)
clear_cache(Connection.new(), opts)
@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.
@spec compact(map() | OpenApiTypesense.Connection.t() | keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
compact(opts)
compact(%{api_key: xyz, host: ...})
compact(Connection.new())
@spec compact( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
compact(%{api_key: xyz, host: ...}, opts)
compact(Connection.new(), opts)
@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)
@spec config(map() | OpenApiTypesense.Connection.t(), map() | keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
config(payload, opts)
config(%{api_key: xyz, host: ...}, payload)
config(Connection.new(), payload)
@spec config(map() | OpenApiTypesense.Connection.t(), map(), keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
config(%{api_key: xyz, host: ...}, payload, opts)
config(Connection.new(), payload, opts)
@spec retrieve_api_stats() :: {:ok, OpenApiTypesense.APIStatsResponse.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Get stats about API endpoints.
Retrieve the stats about API endpoints.
@spec retrieve_api_stats(map() | OpenApiTypesense.Connection.t() | keyword()) :: {:ok, OpenApiTypesense.APIStatsResponse.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
retrieve_api_stats(opts)
retrieve_api_stats(%{api_key: xyz, host: ...})
retrieve_api_stats(Connection.new())
@spec retrieve_api_stats( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.APIStatsResponse.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
retrieve_api_stats(%{api_key: xyz, host: ...}, opts)
retrieve_api_stats(Connection.new(), opts)
@spec retrieve_metrics() :: {:ok, map()} | {:error, OpenApiTypesense.ApiResponse.t()}
Get current RAM, CPU, Disk & Network usage metrics.
Retrieve the metrics.
@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())
@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)
@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.
@spec take_snapshot( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
take_snapshot(%{api_key: xyz, host: ...}, opts)
take_snapshot(Connection.new(), opts)
@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.
@spec vote(map() | OpenApiTypesense.Connection.t() | keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
vote(opts)
vote(%{api_key: xyz, host: ...})
vote(Connection.new())
@spec vote( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Either one of:
vote(%{api_key: xyz, host: ...}, opts)
vote(Connection.new(), opts)