Table of documentation contents

Schema Import Guide

Index

Basics

The weaviate-cli tool can be used to import a schema into Weaviate from a JSON file or URL location.

Schema Import

You can start a schema import by running

$ weaviate-cli schema-import

Additional commands:

usage: weaviate-cli schema-import [-h] [--location LOCATION] [--force]

positional arguments:
  schema-import

optional arguments:
  -h, --help           show this help message and exit
  --location LOCATION  The schema file should be in the same format as
                       the/weaviate/v1/schema RESTful output
  --force              Overwrite classes and properties if found in Weaviate?
                       Important: ONLY use on a new Weaviate instance. Will
                       fail if things or actions are already in your Weaviate

Getting a schema

Getting the schema from a running Weaviate

You can request a schema from a running Weaviate like this:

$ curl http://localhost:8080/v1/schema

You can save this schema as a JSON file.

Creating a schema file

You can follow the schema formatting as described here.

Simple schema example

An example of a schema template looks as follows:

{
	"actions": {
		"classes": [],
		"type": "action"
	},
	"things": {
		"classes": [{
			"class": "Company",
			"description": "A description of the company class",
			"properties": [{
				"cardinality": "atMostOne",
				"dataType": [
					"string"
				],
				"description": "A name of the company",
				"keywords": [{
					"keyword": "identifier",
					"weight": 1.0
				}],
				"name": "name"
			}]
		}]
	}
}

Frequently Asked Questions

If you can’t find the answer to your question here, please use the:

  1. Knowledge base of old issues. Or,
  2. For questions: Stackoverflow. Or,
  3. For issues: Github.
Tags
  • weaviate-cli
  • schema
  • import