superagent-elasticserach
Elasticsearch javascript connection handler for Superagent
Why?
Superagent is widely used and it can easily be made to understand kerberos, in-house CAs and more. This is designed to allow you to pass in any superagent like-object as well as get a callback before the request is sent so you can take an action per request (e.g. set a Authenticate token).
Usage
Simple
const elasticsearch = ;const SuperagentConnector = ; client = host log: 'debug' connectionClass: SuperagentConnector;
Kerberos
const elasticsearch = ;const SuperagentConnector = ; const beforeEachRequest = async const token = await ; r; return;;client = host log: 'debug' connectionClass: SuperagentConnector superagentConfig: beforeEachRequest;
Recommended reading: https://www.npmjs.com/package/kerberos https://gist.github.com/dmansfield/c75817dcacc2393da0a7#file-http_client_spnego-js-L20
API
In the config of elasticsearch
, pass a superagentConfig
config object. Parameters documented in the constructor,
as well as tested in ./tests
.