Which string index type for values with periods?

Hello, a quick question. Let’s say i have a predicate whose values are always of form:


What would be the most efficient index type to use if I want to be able to search for foo, bar, baz or even foo.bar and bar.baz? From my testing the term index only separates by whitespace and @ but not ., but fulltext also does not seem to index it as expected. Should this be then indexed as trigram?


UPDATE: Just found that term also uses - as separator. Now curious what other separators are valid.

Hi @pirxthepilot, trigram in combination with regexp queries would be worth a look-see if it meets your requirement. Regular expression queries require the “trigram” index. The tour of dgraph has an example : Regular Expressions | Search | Dgraph Tour

Regex queries in this case would look somewhat like this (looking for “bar.baz”):

      node(func: has(foof)) @filter(regexp(foof, /(bar\.baz)/i)) {        


"data": {
    "node": [
        "foof": "foo.bar.baz"

, but does not match.

"foof": "foo.bardbaz.bab"

You can also check custom tokenizers feature in Dgraph that can help you build custom indexing plugin and use “anyof” or “allof” based queries, much like a term query. https://dgraph.io/docs/query-language/#indexing-with-custom-tokenizers