I keep getting "Attribute username not indexed" even though I set the schema

I simulated here locally and everything is working. Here’s how I reproduced.

id: string @index(hash) .
username: string @index( hash).
name: string @index(term) .
email: string @index(hash) .

It is recommended to use indexing in an economical way. You can even do it the way you are doing. But I would recommend using Hash whenever you search for accuracy. This can save time and space.

Example. Username is usually a single word (even if it is a large word) can be hash. Email has no need to index for exact if you’re indexing by Hash. You choose one or the other. They are very similar indexations. You are only duplicating the indexing.

And name there is no need either. When you do Query with “allofterms” it will use this indexing normally. So if you’re already using term, there is no need to use hash or exact. Hash and exact are for accuracy queries only.

{
  set{
    _:Julian <id> "9a3f141e-f1dd-48f8-b57e-73d670f7d670" .
    _:Julian <name> "Julian Goldheaven" .
    _:Julian <username> "9a3f141e-f1dd-48f8-b57e-73d670f7d670" .
    _:Julian <email> "Julian@Goldheaven.com" .
  }
}
{
user(func: has(username))
      @filter(eq(username, "9a3f141e-f1dd-48f8-b57e-73d670f7d670"))
        {
          id
          name
          username
          email
        }
}

{
  "data": {
    "user": [
      {
        "id": "9a3f141e-f1dd-48f8-b57e-73d670f7d670",
        "name": "Julian Goldheaven",
        "username": "9a3f141e-f1dd-48f8-b57e-73d670f7d670",
        "email": "Julian@Goldheaven.com"
      }
    ]
  },
  "extensions": {
    "server_latency": {
      "encoding_ns": 976900
    },
    "txn": {
      "start_ts": 10036,
      "lin_read": {
        "ids": {
          "1": 20
        }
      }
    }
  }
}

If it still happening it would be necessary to see closely better what is happening.

I am available.

Cheers.