-
-
Save rboyd/f67d5efc03221bb936926fdc0d33201f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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