- Why Dgraph
When Dgraph is searching for strings, dates, or other values based on a filter, it needs an index to make the search efficient. We’ve already seen examples of how to specify the indexes in a schema mutation.
date have default indexes, but
string has options of what index types to choose. Multiple indexes can be built for the same
string valued predicate.
string the following indexes are available
term(default) for use with
exactfor use with inequality - matching whole string
exactbut hashes string - useful with long strings
fulltextfor full text search with
trigramfor use with regular expressions
Multiple indexes are specified as arguments to
Apply the schema mutation to add the indexes to the movie data. It will take a few minutes for Dgraph to compute those indexes for all the movie data. Let the mutation run and move on once it’s finished.
You might find Docker stops your Dgraph process during the mutation. That might be a memory issue - increase the amount of memory Docker allows and then restart Dgraph, load the intial schema and data, then apply this mutation.