Hotchocolate: Need help to translate GraphQL query to ElasticSearch

Created on 17 Apr 2020  ยท  11Comments  ยท  Source: ChilliCream/hotchocolate

Could you please provide some more documentation / examples how to write translator of GraphQL queries into ElasticSearch queries and inject it into existing engine?

โ“ question ๐ŸŒถ hot chocolate ๐Ÿ“š documentation

Most helpful comment

@RomanVashchegin @afederici75 The documentations for custom filtering is currently in the works. we will change a few things with filter conventions and make it extensible. I will let you know when the docs are ready ๐Ÿ‘
Can point you in the right direction for the ES native translator.

All 11 comments

The only package for ElasticSearch that provides an IQueriable adapter is ElasticLINQ. Unfortunately it is not maintaned anymore.

hi @RomanVashchegin
There are many different approaches you can take to do this.
We are currently investing a lot in documentation and extension APIs and eventually will cover topics like these too.

What would you like to translate to elastic search? Filtering Sorting Selection? Do you have CLRTypes or do you want to create the types too?

Integrations like these are a ton of work :) what is the intended behaviour?

Hi @PascalSenn , I use ES quite a lot, too, so in regards to your "What would you like to translate to elastic search" -> good support for nested types would be crucial I think.

@afederici75 integration must be made in ElasticSearch to provide a IQueriable provider, on which HotChocolate can hook on. As already mentioned only ElasticLINQ provides it, but it is currently not maintaned and paired with latest ElasticSearch versions.

@nkovacic Not necessarily, we open up the API for Selection, Filtering and Sorting.
IQueryable has its pitfalls. With Linq you can express a lot of things that are more complex than things you can express with our filters API. As we only use a subset we can maybe write more efficient native queries. The only good IQueryable provider I've seen so far was the one of EF.

This is why I ask what you would like to do :) creating elastic search queries? @nkovacic @afederici75

@PascalSenn
Yes, I'd like to implement Filtering and Sorting for ES data source. https://github.com/ElasticLINQ/ElasticLINQ is good example, but parsing linq expressions need more accuracy in implementation. I prefer to have the deal with expression tree :) Because I've already implemented Advanced Search in our application based on https://querybuilder.js.org/ and ES.

@PascalSenn , sorry for the late response. [What I would like to do] -> I ultimately want my client apps to always communicate with the back end via GraphQL . The back end has disparate storage systems (Oracle, ElasticSearch, others) and I would like some automatic thing that translates the incoming graphql into ES's DSL and executes that search. I think it's possible to auto generate a GQL schema from an ES setup and auto map stuff.

@RomanVashchegin @afederici75 The documentations for custom filtering is currently in the works. we will change a few things with filter conventions and make it extensible. I will let you know when the docs are ready ๐Ÿ‘
Can point you in the right direction for the ES native translator.

@PascalSenn that is great news, thanks! I am relatively new to Github and contribution to open source projects, but I have been working for a few years with ES and .NET's libs at a fairly low level. My background is primarily server side, and client work was usually with XAML (whatever flavor), but this would be a great way to contribute to HC and my project as well... Not promising anything as I don't want to over commit and I need the board to approve this, but I am seriously looking into basing all out current modernization efforts on GraphQL and HotChocolate. Let me know if you guys are interested in me collaborating or can point me in the right direction when the right time comes. Thanks again for the wonderful project!

We have faced the same problem when used HotChocolate for our project just like you guys discussed. We have a GraphQL for public-facing with SPA and Mobile, and behind we have some service call directly to PostgreSQL DB and some call to other GraphQL endpoints that stiched data together. Now we would like to translate the filter/sorting/selection from GraphQL to ES DSL (Nest), but we are still struggling with it right now. If the HotChocolate team can give us clear guidance to do the visitor throw filter/sorting/selection and translate it to ES DSL, then that'd be great.

Can you guys head over to slack so we can walk you through this and get you started.
Join the #elasticsearch channel on slack. We will organize discussions in there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

louisjrdev picture louisjrdev  ยท  3Comments

benmccallum picture benmccallum  ยท  5Comments

sascha-andres picture sascha-andres  ยท  4Comments

sfmskywalker picture sfmskywalker  ยท  3Comments

IKolosynskyi picture IKolosynskyi  ยท  3Comments