Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elastic Internal TCs with relay connection #91

Open
amarflybot opened this issue Feb 10, 2020 · 1 comment
Open

Elastic Internal TCs with relay connection #91

amarflybot opened this issue Feb 10, 2020 · 1 comment

Comments

@amarflybot
Copy link
Contributor

Hi @nodkz , Do you have a way to support relay/connection for internal or nested data?

So lets say you have a root defined by:

const FlightEsTC = composeWithElastic({
  graphqlTypeName: 'fl',
  elasticIndex: 'kibana_sample_data_flights',
  elasticType: '_doc',
  elasticMapping: ecommerceMapping,
  elasticClient: elasticClient,
  schemaComposer: schemaComposer
});

And You wanna add relays to internal sub query:

let EcommerceecommerceGeoipTC = schemaComposer.getOTC('ecommerceecommerceGeoip');

schemaComposer.getOTC('ecommerceecommerce').addFields({
  geoipConnection: composeWithRelay(EcommerceecommerceGeoipTC)

How can we do this?

@nodkz
Copy link
Member

nodkz commented Feb 11, 2020

You need to use composeWithRelay(EcommerceecommerceGeoipTC).getReolver('...').wrapResolve().
And inside wrapper get entity id from source and pass them as some arg to the elastic resolver.

Please search issues about wrapResolve in graphql-compose repo. Also it may be usefult to use addRelation method which does this and also may remove args from resolver.

When you'll be done, please post here a working solution for further googlers.

Tnx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants