ExTypesense.Cluster (ExTypesense v1.1.0)
View SourceCluster specific operations.
More here: https://typesense.org/docs/latest/api/cluster-operations.html
Summary
Functions
Get stats about API endpoints.
Same as api_stats/0
Same as api_stats/1 but passes another connection.
Clears the cache
Same as clear_cache/0 but passes another connection.
Same as clear_cache/1 but passes another connection.
Get current RAM, CPU, Disk & Network usage metrics.
Same as cluster_metrics/1 but passes another connection.
Compaction of the underlying RocksDB database.
Same as compact_db/0
Same as compact_db/1 but passes another connection.
Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory.
Same as create_snapshot/1 but passes another connection.
Get health information about a Typesense node.
Same as health/0
Same as health/1 but passes another connection.
Enable logging of requests that take over a defined threshold of time.
Same as toggle_slow_request_log/2 but passes another connection.
Triggers a follower node to initiate the raft voting process, which triggers leader re-election.
Same as vote/0 but passes another connection.
Same as vote/1 but passes another connection.
Functions
@spec api_stats() :: {:ok, OpenApiTypesense.APIStatsResponse.t()} | :error
Get stats about API endpoints.
This endpoint returns average requests per second and latencies for all requests in the last 10 seconds.
@spec api_stats(map() | OpenApiTypesense.Connection.t() | keyword()) :: {:ok, OpenApiTypesense.APIStatsResponse.t()} | :error
Same as api_stats/0
ExTypesense.api_stats([])
ExTypesense.api_stats(%{api_key: xyz, host: ...})
ExTypesense.api_stats(OpenApiTypesense.Connection.new())
@spec api_stats( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.APIStatsResponse.t()} | :error
Same as api_stats/1 but passes another connection.
ExTypesense.api_stats(%{api_key: xyz, host: ...}, [])
ExTypesense.api_stats(OpenApiTypesense.Connection.new(), [])
@spec clear_cache() :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
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
Same as clear_cache/0 but passes another connection.
ExTypesense.clear_cache([])
ExTypesense.clear_cache(%{api_key: xyz, host: ...})
ExTypesense.clear_cache(OpenApiTypesense.Connection.new())
@spec clear_cache( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as clear_cache/1 but passes another connection.
ExTypesense.clear_cache(%{api_key: xyz, host: ...}, [])
ExTypesense.clear_cache(OpenApiTypesense.Connection.new(), [])
@spec cluster_metrics() :: {:ok, map()} | :error
Get current RAM, CPU, Disk & Network usage metrics.
@spec cluster_metrics(map() | OpenApiTypesense.Connection.t() | keyword()) :: {:ok, map()} | :error
Same as cluster_metrics/0
ExTypesense.cluster_metrics([])
ExTypesense.cluster_metrics(%{api_key: xyz, host: ...})
ExTypesense.cluster_metrics(OpenApiTypesense.Connection.new())
@spec cluster_metrics( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, map()} | :error
Same as cluster_metrics/1 but passes another connection.
ExTypesense.cluster_metrics(%{api_key: xyz, host: ...}, [])
ExTypesense.cluster_metrics(OpenApiTypesense.Connection.new(), [])
@spec compact_db() :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
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_db(map() | OpenApiTypesense.Connection.t() | keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as compact_db/0
ExTypesense.compact_db([])
ExTypesense.compact_db(%{api_key: xyz, host: ...})
ExTypesense.compact_db(OpenApiTypesense.Connection.new())
@spec compact_db( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as compact_db/1 but passes another connection.
ExTypesense.compact_db(%{api_key: xyz, host: ...}, [])
ExTypesense.compact_db(OpenApiTypesense.Connection.new(), [])
@spec create_snapshot(keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
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 create_snapshot( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as create_snapshot/1 but passes another connection.
ExTypesense.create_snapshot(%{api_key: xyz, host: ...}, snapshot_path: "/tmp/typesense-data-snapshot")
ExTypesense.create_snapshot(OpenApiTypesense.Connection.new(), snapshot_path: "/tmp/typesense-data-snapshot")
@spec health() :: {:ok, OpenApiTypesense.HealthStatus.t()} | :error
Get health information about a Typesense node.
@spec health(map() | OpenApiTypesense.Connection.t() | keyword()) :: {:ok, OpenApiTypesense.HealthStatus.t()} | :error
Same as health/0
ExTypesense.health([])
ExTypesense.health(%{api_key: xyz, host: ...})
ExTypesense.health(OpenApiTypesense.Connection.new())
@spec health( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.HealthStatus.t()} | :error
Same as health/1 but passes another connection.
ExTypesense.health(%{api_key: xyz, host: ...}, [])
ExTypesense.health(OpenApiTypesense.Connection.new(), [])
@spec toggle_slow_request_log(map()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
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> config = %{"log_slow_requests_time_ms" => 2_000}
iex> ExTypesense.toggle_slow_request_log(config)
@spec toggle_slow_request_log( map() | OpenApiTypesense.Connection.t(), map() | keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as toggle_slow_request_log/1
ExTypesense.toggle_slow_request_log(config, [])
ExTypesense.toggle_slow_request_log(%{api_key: xyz, host: ...}, config)
ExTypesense.toggle_slow_request_log(OpenApiTypesense.Connection.new(), config)
@spec toggle_slow_request_log( map() | OpenApiTypesense.Connection.t(), map(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as toggle_slow_request_log/2 but passes another connection.
ExTypesense.toggle_slow_request_log(%{api_key: xyz, host: ...}, config, [])
ExTypesense.toggle_slow_request_log(OpenApiTypesense.Connection.new(), config, [])
@spec vote() :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
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
Same as vote/0 but passes another connection.
ExTypesense.vote([])
ExTypesense.vote(%{api_key: xyz, host: ...})
ExTypesense.vote(OpenApiTypesense.Connection.new())
@spec vote( map() | OpenApiTypesense.Connection.t(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as vote/1 but passes another connection.
ExTypesense.vote(%{api_key: xyz, host: ...}, [])
ExTypesense.vote(OpenApiTypesense.Connection.new(), [])