# elasticsearch-search-stream

> elasticsearch search results returned as readable stream

Latest version **1.0.2** (published 2015-10-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install elasticsearch-search-stream
pnpm add elasticsearch-search-stream
yarn add elasticsearch-search-stream
bun add elasticsearch-search-stream
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-10-14 |
| First published | 2015-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | engineering@lanetix.com |
| Maintainers | lanetix |
| Keywords | elasticsearch, search, readable-stream |

## Links

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

## Dependencies (1)

- [readable-stream](https://npm.io/package/readable-stream.md) ^2.0.2

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2015-10-14
- 1.0.1 — 2015-10-12
- 1.0.0 — 2015-10-12

## README

Stream search results from elastic search

### Requirements

Any elasticsearch client supporting `search` and `scroll`.

Verified against `elasticsearch@3.1.0`+

### Options

#### client

An [elasticsearch client](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/quick-start.html#_creating_a_client)

#### search

An [elasticsearch search](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search)

### Usage

```js
var SearchStream = require('elasticsearch-search-stream')
var elasticsearch = require('elasticsearch')
var stringify = require('csv-stringify')
var fs = require('fs')

var client = new elasticsearch.Client({
  host: 'localhost:9202',
  log: 'trace'
})

// a scroll of '30s' will be applied by default
var search = {
  index: '2731107',
  body: {
    filter: {
      prefix: {
        firstName: 'a'
      }
    }
  }
}

var searchStream = new SearchStream({ client: client, search: search })

searchStream
.pipe(stringify())
.pipe(fs.createWriteStream("my_file.txt"))
```

* Inspired by [node-pg-query-stream](https://github.com/brianc/node-pg-query-stream)

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