The Weaviate CLI can be installed with:
$ pip install weaviate-cli
To check if the cli is installed correctly, run:
$ weaviate version
which should return 2.1.2.
You need to configure the CLI tool before you can interact with you Weaviate instance. This can be done manually or by adding flags to commands.
$ weaviate config set
$ weaviate init
After which you will be asked to enter the Weaviate URL and authentication mode.
Flags: if you didn't configure the CLI manually, you can add a configuration flag pointing to a configuration json file (
--config-file myconfig.json) with every command you execute.
$ weaviate --config-file myconfig.json
myconfig.jsonshould look like:
"user": <user name>,
"pass": <user password>
You can view the configuration with the command:
$ weaviate config view
You can ping the Weaviate URL you're connected to with:
$ weaviate ping
Weaviate is reachable! if the connection with the Weaviate server is set up correctly.
Adding a schema can be done via:
$ weaviate schema import my_schema.json
my_schema.json contains the schema as described here.
To overwrite your schema you can use the
--force flag, this will clear the index and replace your schema:
$ weaviate schema import --force my_schema.json # using --force will delete your data
You can export a schema to a json file that is present in the Weaviate instance by:
$ weaviate schema export my_schema.json
my_schema.json can be replaces by a json file and local location. Naturally this function only outputs the schema to the given location when a schema is present in Weaviate.
delete you can remove the entire schema and all the data that is associated with it. You will be asked for confirmation unless the
--force flag is added.
$ weaviate schema delete
import function enables data import from a json file. When the flag
--fail-on-error is added, this command execution will fail if an error was thrown by Weaviate when loading the data object in.
$ weaviate data import my_data_objects.json
The json file and location is passed in the command. The file needs to be formatted according to the Weaviate data schema, for example:
"name": "New York Times"
"name": "Jodi Kantor",
delete you can remove all data objects in Weaviate. You will be asked for confirmation unless the
--force flag is added.
$ weaviate data delete
Check the change logs on GitHub for updates on the latest
If you can't find the answer to your question here, please look at the: