# superagent-elasticsearch

> A superagent connection implementation for elasticsearch

Latest version **0.1.1** (published 2018-07-03) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install superagent-elasticsearch
pnpm add superagent-elasticsearch
yarn add superagent-elasticsearch
bun add superagent-elasticsearch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2018-07-03 |
| First published | 2018-04-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 18.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Marc Udoff |
| Maintainers | mlucool |
| Keywords | elastic, elasticsearch, superagent, connection |

## Links

- npm: https://www.npmjs.com/package/superagent-elasticsearch
- Repository: https://github.com/mlucool/superagent-elasticsearch
- Homepage: https://github.com/mlucool/superagent-elasticsearch#readme
- Issues: https://github.com/mlucool/superagent-elasticsearch/issues
- npm.io page: https://npm.io/package/superagent-elasticsearch

## Dependencies (1)

- [superagent](https://npm.io/package/superagent.md) ^3.8.2

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2018-07-03
- 0.1.0 — 2018-04-23

## README

# superagent-elasticserach
[![NPM version][npm-image]][npm-url] [![NPM DM][npm-dm-image]][npm-url] [![Build Status][travis-image]][travis-url]  [![Coverage Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url]

> [Elasticsearch](https://github.com/elastic/elasticsearch-js) javascript connection handler for [Superagent](https://github.com/visionmedia/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
```javascript
const elasticsearch = require('elasticsearch');
const SuperagentConnector = require('superagent-elasticsearch');

client = new elasticsearch.Client({
    host,
    log: 'debug',
    connectionClass: SuperagentConnector,
});
```

### Kerberos
```javascript
const elasticsearch = require('elasticsearch');
const SuperagentConnector = require('superagent-elasticsearch');

const beforeEachRequest = (r) => async {
    const token = await getToken(r.url);
    r.set('Authorization', `Negotiate ${token}`);
    return;
};
client = new elasticsearch.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`.

License
-------------
[Apache-2.0 License](http://www.apache.org/licenses/LICENSE-2.0)

[npm-url]: https://npmjs.org/package/superagent-elasticsearch
[npm-image]: https://badge.fury.io/js/superagent-elasticsearch.png
[npm-dm-image]: https://img.shields.io/npm/dm/superagent-elasticsearch.svg

[travis-url]: http://travis-ci.org/mlucool/superagent-elasticsearch
[travis-image]: https://secure.travis-ci.org/mlucool/superagent-elasticsearch.png?branch=master

[coveralls-url]: https://coveralls.io/github/mlucool/superagent-elasticsearch?branch=master
[coveralls-image]: https://coveralls.io/repos/mlucool/superagent-elasticsearch/badge.svg?branch=master&service=github

[depstat-url]: https://david-dm.org/mlucool/superagent-elasticsearch
[depstat-image]: https://david-dm.org/mlucool/superagent-elasticsearch.png

---
_Source: https://npm.io/package/superagent-elasticsearch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
