Ratel won't allow 'exact' or 'hash' indexes with 'term' index

Report a Ratel Bug

What Version of Ratel are you using?

Latest and dev (on play.dgraph.io)

What version of Dgraph are you using?

Not sure. The one running on play.dgraph.io.

Which Version of the UI are you using

  • Stable
  • Bleeding Edge

Have you tried reproducing the issue with the latest release?

Latest and dev at play.dgraph.io.

Steps to reproduce the issue (command/config used to run Dgraph).

  • Go to play.dgraph.io or log into Ratel locally
  • Add any data that includes string values
  • Go to schema
  • Try to add an ‘exact’ or ‘hash’ index and a ‘term’ index
  • The following text appears under the index checkboxes, and the schema cannot be updated:

Expected behaviour and actual result.

‘exact’ and ‘hash’ indexes should be able to be created alongside ‘term’ indexes. Checking the schema at play.dgraph.io confirms this.

That’s normal. If you wanna force it you can go to Schema Panel and then click on “Bulk Edit”. There you can force any index you want.

PS. Using Bulk Edit you can delete everything there and work only with the parts of the schema you need. Don’t worry.

@MichelDiz Is it intended to be set up that way?

Thanks for letting me know about the workaround. :slight_smile:

In a certain way yes. It is not good to stack indexes. It is always better to have a well-planned graph modeling.

1 Like

@MichelDiz Gotcha, thanks!

1 Like

I understand that it’s good practice to have well-planned graph modeling, but since you can do all the other valid combinations of indexes, why is it not possible to do exact/hash + term, though? e.g. You can do all of ‘term’, ‘fulltext’ and ‘trigam’ using the Ratel interface, but can’t do an ‘exact’ or ‘hash’ one when ‘term’ is selected. For that, you need to go into bulk edit.

Given that it’s possible, though, and 4 indexes are used for some predicates in the play.dgraph.io Freebase example, it does seem odd to me that you can’t do it using the expected interface route.

This seems like either an odd decision, or a minor bug/oversight to me.

That’s not a bug. It is a recommendation hard typed on the UI.

I don’t know exactly what was the reason but it was introduced here

In my view adding several indexes is weird, it also increases space on the disk. e.g: exact and hash has the same effect, why you need to be redundant? If you need term, it should work just fine as exact. You can also have these terms spread over other predicates.

Thanks for the link.

I agree with you about exact and hash, since they are redundant, but that’s not the issue here. It’s exact+term, which according to the documentation are not redundant. This is stated in tutorial-3:

Also, there’s the full list of string indices for their respective functions here.

You can verify this on the Freebase data on play.dgraph.io with predicate ‘name’, which has four indexes:

  • fulltext
  • hash
  • term
  • trigram

Executing

{
  me(func: gt(name@en, "A")) {
    name@en
  }
}

gives the following error:

Am I missing something?