graphql-compose / graphql-compose/graphql-compose-elasticsearch

pass custom query to composeWithElastic

Open
#100 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
584
Forks
76
PR merge metrics
No merged PRs in 30d

Description

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 ;)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.