Hey everyone. I have an issue with using indexes. I set the schema with a mutation but still get the error “Attribute not indexed” when I try to use a filter. Maybe anyone has an idea what is going on
My schema:
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.
thank you for the quick reply! I checked via Ratel and found out, that the schema was indeed not set. I investigated further and found, that I can set the schema via an alter operation. So the server is ok.
Cool! I like the idea of Elixir, but I have not had enough time to really learn. But then in your case I can not help. I also have no practice with gRPC.
Have you tried taking a look at the various clients of Dgraph?
Edit: Only difference is that Ratel get’s back data from the server:
{"data":{"code":"Success","message":"Done"}}
My client receives an empty string.
About exporting the schema. I deleted all data (deleting the folders from the server), restarted the server and did an export. The schema file was empty as expected. I then ran my command from the client to set the schema and did an export again. The schema file now contains this:
If Ratel does not show neither a predicate is because nothing has been written. Ratel will always be able to see predicates no matter what the situation.
If there are predicates and it returns “Your query did not return anything”. It means that it is indexed, but the value of the query was not found. Usually this returns to the other clients as an empty query itself.
Now if Ratel informs you that it has not been indexed (the way you are reporting on username) this would be some bug. But sure it is not, you would solve it creating a completely new instance of Dgraph. I can not see any situation happening this way. If it happens it is data corruption, it would be better to check the disks. As said above, I have been able to replicate what you wanna do, so it is not bug.
Well, I figured it out. I set up a fresh instance of Dgraph and went through it again.
Setting the schema in my client → shows up in ratel and in the export
Querying for data with a filter → works
Running my tests → doesn’t work
So the tests seem to do something that breaks everything. I then realized that I run a drop_all operation before the test suite. My reasoning was that this only deletes the data. But it seems to also delete the schema.
Is there any way to delete all data from Dgraph without trashing the schema? What I did was wrong as it appears now…
Thank you for your support so far! You were of great help!