-
Notifications
You must be signed in to change notification settings - Fork 726
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
Extending elasticsearch.Client on an ES6 code #516
Comments
@ThiagoMiranda don't you need to call |
@Mattchewone sorry I've changed some of the code variables name but it gives me the same error |
Sorry, but the To extend the API I suggest using a plugin, like so: const customApiPlugin = Client =>
class CustomClient extends Client {
testConnection() {
this.ping({
requestTimeout: 30000,
}, (error) => {
if(error) console.error('Elastic search is out');
if(!error) {
console.log('Conected');
}
});
}
}
const client = new elasticsearch.Client({
plugins: [customApiPlugin]
});
client.testConnection(); |
@spalger thanks I'll try that |
Hi..
Probably I'm doing something wrong ( or getting the wrong idea on the extends implementation ) but why can't I add methods extending the
elasticsearch.Client
class?Ps: The super method is called since I have a "Elastic info connected" message
The text was updated successfully, but these errors were encountered: