I'm using RESTDataSource from apollo-datasource-rest library to query data from the opensearch index but running into http request errors.
After extending RESTDataSource class, I have a following method which I want to call to return data from index my_index where name field is exactly equal to the name parameter
async getDataByName(name) {
const responseData = await this.get(`_search?index=my_index', {
query: {
match_phrase: {
name: name
}
}
})
}
I am getting invalid request error (request [/_search] contains unrecognized parameter: [query]) but same query works in postman. What i am doing wrong?
Tried following this docs but not very helpful - https://www.apollographql.com/docs/apollo-server/data/data-sources/#http-methods