Dgraph GraphQL Tour
When Dgraph searches 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 update.
DateTime have default indexes, but
String has a few
options for which search index types to use. You can build multiple indexes
for the same
String, the following indexes are available:
term: Used when filtering by “all terms” or by “any terms”; generates filter inputs
exact: for use with inequality, matches a whole string and generates the following filter inputs:
hash: Used similarly to
exact, but hashes the string to accommodate longer strings; generates the following filter inputs:
fulltext: Used for full-text search-engine style search; generates the following filter inputs
regexp: Used with regular expression searches; generates the
You specify multiple indexes as a list passed to the
by argument of the
Apply the schema mutation to apply the new indexes and types on your database. It may take a minute for Dgraph to compute these new indexes if working with a larger data graph. Let the schema push operation run, and then move on after it’s finished.