Hi there,
I'm using your package, to add a log into kibana, and I get this error:
TypeError cannot read property 'request' of undefined
at exec ...node_modules/elasticsearch/src/lib/client_action.js : 364:19
at action ... node_modules/elasticsearch/src/lib/client_action.js : 61:16
and the rest of the stack is mine.
I use the index function within the client object.
elasticsearch:13.2
node: 8.1.2
hope to solve it. thanks!
i have the exact same issue
Same here
the only request property in the client_action is this.request, which means the function that you're accessing has probably lost this context. Are you calling the method like client.index() or have you assigned index to a separate value and called it directly, like
var index = client.index;
index()
If it's the later then you need to bind the this context to the index function with something like the .bind() method:
var index = client.index.bind(client);
index()
We understand that this might be important for you, but this issue has been automatically marked as stale because it has not had recent activity either from our end or yours.
It will be closed if no further activity occurs, please write a comment if you would like to keep this going.
Note: in the past months we have built a new client, that has just landed in master. If you want to open an issue or a pr for the legacy client, you should do that in https://github.com/elastic/elasticsearch-js-legacy
Most helpful comment
the only
requestproperty in the client_action isthis.request, which means the function that you're accessing has probably lostthiscontext. Are you calling the method likeclient.index()or have you assignedindexto a separate value and called it directly, likeIf it's the later then you need to bind the
thiscontext to theindexfunction with something like the.bind()method: