🎉 Hypermode Agents Beta: natural language agent creation, 2,000+ integrations, export to code Try Agents now! →
Administration
Update Types We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know. You modify Dgraph types (node types and predicates types) by/alter
endpoint using the HTTP Clientalter
operation of any DQL client library.runInBackground
to true
.
curl localhost:8080/alter?runInBackground=true -XPOST -d $'
name: string @index(fulltext, term) .
age: int @index(int) @upsert .
friend: [uid] @count @reverse .
' | python -m json.tool | less
op := &api.Operation{}
op.Schema = `
name: string @index(fulltext, term) .
age: int @index(int) @upsert .
friend: [uid] @count @reverse .
`
op.RunInBackground = true
err = dg.Alter(context.Background(), op)
NotesIf executed before the indexing finishes, queries that require the new indices fail with an error notifying that a given predicate isn’t indexed or doesn’t have reverse edges. In a multi-node cluster, it’s possible that the alphas finish computing indexes at different times. Alphas may return different schema in such a case until all the indexes are done computing on all the Alphas. You can check the background indexing status using the Health query on the /admin
endpoint. An alter operation fails if one is already in progress with an error schema is already being modified. Please retry
. Dgraph reports the indexes in the schema only when the indexes are done computing. Deleting a node typeType definitions can be deleted using the Alter endpoint. Below is an example deleting the type Person
using the Go client:
err := c.Alter(context.Background(), &api.Operation{
DropOp: api.Operation_TYPE,
DropValue: "Person"})
Responses are generated using AI and may contain mistakes.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4