Hi. I was trying to get a field set as dateTime with index(hour) (not through Ratel) but via the /admin/schema endpoint and…
These did not work: creationTime: DateTime @index(hour)
creationTime: DateTime @index(hour) .
creationTime: dateTime .
creationTime: datetime @index(hour) .
This worked
creationTime: DateTime
Which leads to these questions:
While I do know that dateTime is not a part of official GraphQL spec but a custom scalar,
How do I add an index to a field in /admin/schema endpoint itself? I saw an example of doing this in /alter endpoint here: Indexes | Search | Dgraph Tour
I tried searching but was not able to find relevant docs related to the ‘.’ character at the end of datetime @index(hour) . Can you point me to the docs where I can find more details regarding it? Also wondering how to something like that in GraphQL.
Can all operations/alterations related to the schema be done in /admin/schema endpoint? Why should there be a separate /alter endpoint?
Suggestion: In docs, while suggesting examples/code, it would be better to provide both RDF and GraphQL code for the sample maybe via a tabbed interface (I see that its mostly RDF now) which has to be translated into GraphQL queries/mutations/schema.
| argument | constructedFilters |
|---------------------------|-----------------------|
| year, month, day, or hour | lt, le, eq, ge and gt |
As well as @search with no arguments, DateTime also allows specifying how the search index should be built: by year, month, day or hour. @search defaults to year, but once you understand your data and query patterns, you might want to changes that like @search(by: [day]).
So, as this is a GraphQL related question, you should use GraphQL tag and made it under Users/Graphql. If you use Dgraph, we gonna think that you are asking about DQL.
If you are on the road to GraphQL you should stick to /admin/schema. The Alter endpoint is exclusive to DQL. And if you stick to GraphQL, Dgraph will handle the schema for you.
The Tour part was created to be DQL, it can be worked to be work with GraphQL, but there are several examples and tutorials in the GraphQL part. The Tour is meant to show you what Dgraph can do. I can work on an extra tour that teaches how to convert DQL to GraphQL. But that is a long story* to do.
My bad. I was under the impression that since DQL was inspired by GraphQL that we can use it interchangeably. My bad. Got it now.
One last question. Can’t I use GraphQL queries in Ratel to explore the graph (with the graph diagram you show in Ratel?) The same query which returns me the data in insomnia does not work in Ratel.