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

pass custom query to composeWithElastic #100

Open
karladler opened this issue Mar 19, 2020 · 1 comment
Open

pass custom query to composeWithElastic #100

karladler opened this issue Mar 19, 2020 · 1 comment

Comments

@karladler
Copy link

is it somehow possible to add custom queries to the elastic query already when defining the GraphQL objects? I wan't to add a filter to my query to retrieve only Users from elastic which have the flag isCustomer set. I couldn't find any doc for this. There seems to be an "opts" fields, but not sure how to use it.

const CustomerES = composeWithElastic({
  graphqlTypeName: 'UserES',
  elasticIndex: 'users',
  elasticType: '_doc',
  elasticMapping: properties,
  elasticClient,
  pluralFields: ['orders'],
  opts: {
    query: {
      isCustomer: true,
    },
  },
});

sorry if this question is stupid, I'm just starting GraphQL and elastic ;)

@Pythonista7
Copy link

I have the same doubt! Would be super useful if someone could answer this :)

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