diff --git a/docs/overview/cli.ipynb b/docs/overview/cli.ipynb index 8219360a..e186ddd3 100644 --- a/docs/overview/cli.ipynb +++ b/docs/overview/cli.ipynb @@ -17,14 +17,14 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m15:02:39\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m RedisVL version 0.3.9\n" + "\u001b[32m18:12:25\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m RedisVL version 0.3.9\n" ] } ], @@ -33,6 +33,25 @@ "!rvl version" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Commands\n", + "Here's a table of all the rvl commands and options. We'll go into each one in detail below.\n", + "\n", + "| Command | Options | Description |\n", + "|---------------|--------------------------|-------------|\n", + "| `rvl version` | | display the redisvl library version|\n", + "| `rvl index` | `create --schema` or `-s `| create a redis index from the specified schema file|\n", + "| `rvl index` | `listall` | list all the existing search indices|\n", + "| `rvl index` | `info --index` or ` -i ` | display the index definition in tabular format|\n", + "| `rvl index` | `delete --index` or `-i ` | remove the specified index, leaving the data still in Redis|\n", + "| `rvl index` | `destroy --index` or `-i `| remove the specified index, as well as the associated data|\n", + "| `rvl stats` | `--index` or `-i ` | display the index statistics, including number of docs, average bytes per record, indexing time, etc|\n", + "| `rvl stats` | `--schema` or `-s ` | display the index statistics of a schema defined in . The index must have already been created within Redis|" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -46,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -80,14 +99,15 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 32, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m22:33:31\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Index created successfully\n" + "\u001b[32m18:12:32\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", + "\u001b[32m18:12:32\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Index created successfully\n" ] } ], @@ -98,15 +118,16 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 33, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m22:33:33\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n", - "\u001b[32m22:33:33\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. vectorizers\n" + "\u001b[32m18:12:35\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", + "\u001b[32m18:12:35\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n", + "\u001b[32m18:12:35\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. vectorizers\n" ] } ], @@ -117,13 +138,14 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 34, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "\u001b[32m18:12:37\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", "\n", "\n", "Index Information:\n", @@ -149,14 +171,15 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 35, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m22:33:36\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Index deleted successfully\n" + "\u001b[32m18:12:40\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", + "\u001b[32m18:12:40\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Index deleted successfully\n" ] } ], @@ -167,19 +190,20 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 36, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m22:33:37\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n" + "\u001b[32m18:12:43\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", + "\u001b[32m18:12:43\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n" ] } ], "source": [ - "# see the index\n", + "# see the indices that still exist\n", "!rvl index listall" ] }, @@ -194,33 +218,37 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 38, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m22:33:40\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Index created successfully\n" + "\u001b[32m18:13:21\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", + "\u001b[32m18:13:21\u001b[0m \u001b[34mredisvl.index.index\u001b[0m \u001b[1;30mINFO\u001b[0m Index already exists, not overwriting.\n", + "\u001b[32m18:13:21\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Index created successfully\n" ] } ], "source": [ "# create a new index with the same schema\n", + "# recreating the index will reindex the documents\n", "!rvl index create -s schema.yaml" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 39, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m22:33:42\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n", - "\u001b[32m22:33:42\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. vectorizers\n" + "\u001b[32m18:13:25\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", + "\u001b[32m18:13:25\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n", + "\u001b[32m18:13:25\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. vectorizers\n" ] } ], @@ -231,38 +259,39 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 40, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "\u001b[32m18:13:31\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", "\n", "Statistics:\n", - "╭─────────────────────────────┬────────────╮\n", - "│ Stat Key │ Value │\n", - "├─────────────────────────────┼────────────┤\n", - "│ num_docs │ 0 │\n", - "│ num_terms │ 0 │\n", - "│ max_doc_id │ 0 │\n", - "│ num_records │ 0 │\n", - "│ percent_indexed │ 1 │\n", - "│ hash_indexing_failures │ 0 │\n", - "│ number_of_uses │ 1 │\n", - "│ bytes_per_record_avg │ nan │\n", - "│ doc_table_size_mb │ 0 │\n", - "│ inverted_sz_mb │ 0 │\n", - "│ key_table_size_mb │ 0 │\n", - "│ offset_bits_per_record_avg │ nan │\n", - "│ offset_vectors_sz_mb │ 0 │\n", - "│ offsets_per_term_avg │ nan │\n", - "│ records_per_doc_avg │ nan │\n", - "│ sortable_values_size_mb │ 0 │\n", - "│ total_indexing_time │ 0 │\n", - "│ total_inverted_index_blocks │ 0 │\n", - "│ vector_index_sz_mb │ 0.00818634 │\n", - "╰─────────────────────────────┴────────────╯\n" + "╭─────────────────────────────┬─────────╮\n", + "│ Stat Key │ Value │\n", + "├─────────────────────────────┼─────────┤\n", + "│ num_docs │ 0 │\n", + "│ num_terms │ 0 │\n", + "│ max_doc_id │ 0 │\n", + "│ num_records │ 0 │\n", + "│ percent_indexed │ 1 │\n", + "│ hash_indexing_failures │ 3 │\n", + "│ number_of_uses │ 2 │\n", + "│ bytes_per_record_avg │ nan │\n", + "│ doc_table_size_mb │ 0 │\n", + "│ inverted_sz_mb │ 0 │\n", + "│ key_table_size_mb │ 0 │\n", + "│ offset_bits_per_record_avg │ nan │\n", + "│ offset_vectors_sz_mb │ 0 │\n", + "│ offsets_per_term_avg │ nan │\n", + "│ records_per_doc_avg │ nan │\n", + "│ sortable_values_size_mb │ 0 │\n", + "│ total_indexing_time │ 0.02 │\n", + "│ total_inverted_index_blocks │ 0 │\n", + "│ vector_index_sz_mb │ 0 │\n", + "╰─────────────────────────────┴─────────╯\n" ] } ], @@ -271,19 +300,75 @@ "!rvl stats -i vectorizers" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Optional arguments\n", + "You can modify these commands with the below optional arguments\n", + "\n", + "| Argument | Description | Default |\n", + "|----------------|-------------|---------|\n", + "| `-u --url` | The full Redis URL to connec to | `redis://localhost:6379` |\n", + "| `--host` | Redis host to connect to | `localhost` |\n", + "| `-p --port` | Redis port to connect to. Must be an integer | `6379` |\n", + "| `--user` | Redis username, if one is required | `default` |\n", + "| `--ssl` | Boolean flag indicating if ssl is required. If set the Redis base url changes to `rediss://` | None |\n", + "| `-a --password`| Redis password, if one is required| `\"\"` |" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Choosing your Redis instance\n", + "By default rvl first checks if you have `REDIS_URL` environment variable defined and tries to connect to that. If not, it then falls back to `localhost:6379`, unless you pass the `--host` or `--port` arguments" + ] + }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 41, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\u001b[32m22:33:45\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Index deleted successfully\n" + "\u001b[32m18:13:36\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Using Redis address from environment variable, REDIS_URL\n", + "\u001b[32m18:13:36\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m Indices:\n", + "\u001b[32m18:13:36\u001b[0m \u001b[34m[RedisVL]\u001b[0m \u001b[1;30mINFO\u001b[0m 1. vectorizers\n" ] } ], + "source": [ + "# specify your Redis instance to connect to\n", + "!rvl index listall --host localhost --port 6379" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Using SSL encription\n", + "If your Redis instance is configured to use SSL encription then set the `--ssl` flag.\n", + "You can similarly specify the username and password to construct the full Redis URL" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# connect to rediss://jane_doe:password123@localhost:6379\n", + "!rvl index listall --user jane_doe -a password123 --ssl" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "!rvl index destroy -i vectorizers" ] @@ -291,7 +376,7 @@ ], "metadata": { "kernelspec": { - "display_name": "rvldev", + "display_name": "redisvl-dev", "language": "python", "name": "python3" }, @@ -305,7 +390,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.10" + "version": "3.12.2" } }, "nbformat": 4,