Good morning,
it is my first time to try GraphQL and i came to this repo, which i can find it's great !
I have a project that i am working on, and i need to query an Entity based on multiple parameters which are their properties.
for example, i have an Entity called ( Booking ) , this Entity has multiple properties like
Booking
{
Id : int
ContactEmail : string
RoomsBookingDetails : (type RoomsBookingDetails )
{
number : int
.....
}
List
{
id : int
name : string
}
}
i want to be able to query this object ( Booking ) / maybe also some sub objects, with multiple parameters
for example :
my query will be something like this
{
query {
booking(id:5, email: "" )
}
}
Sometimes, i want to query with only one parameters
This means that i want to pass dynamic parameters ( based on the Entity Fields ) to my query type,
and i want to resolve this in a single generic Resolver
this could be possible to do ?
i mean with a single resolver, i want to pass multiple params (those params are the Fields of the Entity )
i'm using Code-First approach with .NET Core
i have tried graphql.net, but it seems like i should handle all the passed arguments with multiple resolvers
PS: i managed to get the solution using the help of Filtering after installing it from Nuget Package
But unfortunately, i couldn't manage to apply the IQueryable on NEST client of Elastic Search
what i did, is to retrieve the whole data from Elastic Search server within the implementation of my Repository, and then apply the IQueryable at the top layer in my QueryType
it looks like i am in need of a Middleware to convert the Queries from GraphQL to NEST client of Elastic Search.
So, this could be possible ? the approach i used puts a large overhead, because it retrieves the whole bunch of data from the ElasticSearch
I believe that you put a huge effort in this project, i really appreciate the hard work you did,
Thanks in advance
So, you want to query an elastic search server?
What you can do if elastic search does not support IQueryable is to implement a query rewriter. The Filter API can be extended by implementing a query visitor.
Here is an example how we did it for queryable.
https://github.com/ChilliCream/hotchocolate/blob/master/src/Core/Types.Filters/QueryableFilterVisitor.cs
If you need help to implement it for nest head over to our slack channel.
That's fantastic, i really appreciate your great help.
Thank you very very much
@michaelstaib ,Please let me know the Slack channel as the Invitation link on your homepage's footer, is no longer active
https://hotchocolategraphql.slack.com/join/shared_invite/enQtNTA4NjA0ODYwOTQ0LTBkZjNjZWIzMmNlZjQ5MDQyNDNjMmY3NzYzZjgyYTVmZDU2YjVmNDlhNjNlNTk2ZWRiYzIxMTkwYzA4ODA5Yzg
This invite link is no longer active.
@AALGate Can I close this issue?
Yes, thanks a lot @michaelstaib
I will use another approach to complete the project as soon as possible, due to time constrain :(
Hello everyone, I also looking for a way to convert Queries to ElasticSearch Nest client.
Most helpful comment
If you need help to implement it for nest head over to our slack channel.