Skip to content

Instantly share code, notes, and snippets.

@rboyd
Created July 28, 2020 17:18
Show Gist options
  • Save rboyd/f67d5efc03221bb936926fdc0d33201f to your computer and use it in GitHub Desktop.
Save rboyd/f67d5efc03221bb936926fdc0d33201f to your computer and use it in GitHub Desktop.
sources:
- name: elastic
handler:
graphql:
endpoint: http://localhost:9494/
additionalTypeDefs: |
extend type Query {
restrictedSearch(index: String!, q: String!): JSON
}
additionalResolvers:
- ./src/mesh/additional-resolvers.js
const resolvers = {
Query: {
restrictedSearch: async (root, args, { elastic }) => {
const {
results
} = await elastic.api.elastic.search(
{
index: args.index,
q: args.q
}
);
return results;
}
module.exports = { resolvers };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment