ExTypesense.Cluster (ExTypesense v2.0.1)
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
Clears the cache
Same as clear_cache/0
Get current RAM, CPU, Disk & Network usage metrics.
Compaction of the underlying RocksDB database.
Same as compact_db/0
Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory.
Get the status of in-progress schema change operations
Same as get_schema_changes/0 but passes another connection.
Get health information about a Typesense node.
Same as health/0
Enable logging of requests that take over a defined threshold of time.
Triggers a follower node to initiate the raft voting process, which triggers leader re-election.
Same as vote/0 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.
Examples
iex> ExTypesense.api_stats()
@spec api_stats(keyword()) :: {:ok, OpenApiTypesense.APIStatsResponse.t()} | :error
Same as api_stats/0
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.api_stats(conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.api_stats(conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.api_stats(opts)
@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.
Examples
iex> ExTypesense.clear_cache()
@spec clear_cache(keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as clear_cache/0
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.clear_cache(conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.clear_cache(conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.clear_cache(opts)
@spec cluster_metrics() :: {:ok, map()} | :error
Get current RAM, CPU, Disk & Network usage metrics.
Examples
iex> ExTypesense.cluster_metrics()
Same as cluster_metrics/0
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.cluster_metrics(conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.cluster_metrics(conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.cluster_metrics(opts)
@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.
Examples
iex> ExTypesense.compact_db()
@spec compact_db(keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as compact_db/0
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.compact_db(conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.compact_db(conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.compact_db(opts)
@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
conn
: The custom connection map or struct you passedsnapshot_path
: The directory on the server where the snapshot should be saved.
Examples
iex> path = "/path/to/snapshot_dir"
iex> ExTypesense.create_snapshot(snapshot_path: path)
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.create_snapshot(snapshot_path: path, conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.create_snapshot(snapshot_path: path, conn: conn)
iex> opts = [snapshot_path: path, conn: conn]
iex> ExTypesense.create_snapshot(opts)
@spec get_schema_changes() :: {:ok, [OpenApiTypesense.SchemaChangeStatus.t()]} | :error
Get the status of in-progress schema change operations
Returns the status of any ongoing schema change operations. If no schema changes are in progress, returns an empty response.
Examples
iex> ExTypesense.get_schema_changes()
@spec get_schema_changes(keyword()) :: {:ok, [OpenApiTypesense.SchemaChangeStatus.t()]} | :error
Same as get_schema_changes/0 but passes another connection.
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.get_schema_changes(conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.get_schema_changes(conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.get_schema_changes(opts)
@spec health() :: {:ok, OpenApiTypesense.HealthStatus.t()} | :error
Get health information about a Typesense node.
Examples
iex> ExTypesense.health()
@spec health(keyword()) :: {:ok, OpenApiTypesense.HealthStatus.t()} | :error
Same as health/0
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.health(conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.health(conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.health(opts)
@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(), keyword() ) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as toggle_slow_request_log/1
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.toggle_slow_request_log(config, conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.toggle_slow_request_log(config, conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.toggle_slow_request_log(config, opts)
@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.
Examples
iex> ExTypesense.vote()
@spec vote(keyword()) :: {:ok, OpenApiTypesense.SuccessStatus.t()} | :error
Same as vote/0 but passes another connection.
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.vote(conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.vote(conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.vote(opts)