-
Notifications
You must be signed in to change notification settings - Fork 728
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
Connection.request params expected RequestOptions without querystring #951
Comments
Hello, sorry for the delay! You are right, we should add elasticsearch-js/lib/Connection.d.ts Lines 26 to 28 in f7be49f
This is happening because the client is using the Node.js http.request API, which uses Would you mind open a pull request to fix this? |
Hi @villasv I stuck on the same issue, I have to send a Signed Request to Aws elasticSearch. var endpoint = new AWS.Endpoint(domain); request.method = 'PUT'; var credentials = new AWS.EnvironmentCredentials('AWS'); I don't think that Documentation are explaining it well. Can you please help me in this thing ? |
Hi @jawadmjn, here's the code I've been using:
|
@villasv thanks man I have this, and how are you doing this part, part of injecting this connection in the client, `
` |
TS2345: Argument of type '{ node: any; Connection: ClientRequest; }' is not assignable to parameter of type 'ClientOptions'. Types of property 'Connection' are incompatible. Type 'ClientRequest' is missing the following properties from type 'typeof Connection': prototype, statuses, roles |
That's not you're supposed to use connection classes. Here's an example:
Then you can just use |
@villasv You are a rock star, It worked man. Thanks a lot 👍 :) |
🐛 Bug Report
The typing for
Connection.request
(defined here) states thatparams
is of typeRequestOptions
.At runtime, I observe the following object for an
indices.exists
call:But
RequestOptions
has no attributesbody
andquerystring
. I expected to find those inTransportRequestParams
instead. ButTransportRequestParams
also hasheaders
missing, so it can't be it either (defined here).To Reproduce
I ran into this when trying to sign requests with AWS credentials.
Expected behavior
No type errors.
Your Environment
@elastic/elasticsearch
version: =7.3.0The text was updated successfully, but these errors were encountered: