# Streaming API for ElasticSearch

**URL:** <https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485>\
**Category:** Elasticsearch\
**Created:** [March 4, 2016, 8:27am UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485 "2016-03-04T08:27:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aravindh\_S](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@Aravindh\_S](https://discuss.elastic.co/u/Aravindh_S)\
**Post date:** [March 4, 2016, 8:27am UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/1 "2016-03-04T08:27:14Z")

</div>

Is there a streaming api for ES where I can redirect my stream of events to be indexed?

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [March 4, 2016, 8:38am UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/2 "2016-03-04T08:38:44Z")

</div>

What does your stream of events look like?

---

<div class="post-metadata">

**Author:** ![Aravindh\_S](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@Aravindh\_S](https://discuss.elastic.co/u/Aravindh_S)\
**Post date:** [March 4, 2016, 8:51am UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/3 "2016-03-04T08:51:54Z")

</div>

An event is a json with say 4 or 5 fields. Example:  
{"name":"aravindh","action":"login","time":12455643,"price":1000}

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [March 4, 2016, 10:54am UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/4 "2016-03-04T10:54:46Z")

</div>

ES has bulk indexing, so you can push nearly any amount of JSON key/value objects to it. Seems you are free to implement the push API. If not, there are myriads of solutions on the web to pick, last not least the Elastic stack.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 4, 2016, 1:39pm UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/5 "2016-03-04T13:39:37Z")

</div>

We've talked about having a stream-style insert using http 1.1's chunked encoding but not implemented it. The nice thing about bulk is that when the bulk returns you know the translog on each active shard has been fsynced. The nice thing about chunked encoding would be that Elasticsearch could "pull" from the sender when ready.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [March 4, 2016, 2:10pm UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/6 "2016-03-04T14:10:30Z")

</div>

Chunked transfer encoding is ancient style of HTTP (with the first idea dating back to 1994) and is gone. See [https://github.com/http2/http2-spec/issues/586](https://github.com/http2/http2-spec/issues/586)

The actual method with HTTP are data frames, with bidirectional communication, similar to what WebSocket (HTML5) data frames look like. So Netty, or Java 9 HTTP/2 client, is worth a look for implementing bidirectional streaming for bulk indexing in ES. The idea would be to submit a number of JSON objects in a single data frame, and server answers asynchronously if the bulk items reached the translog (or not) on the same persistent socket connection.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [March 4, 2016, 2:35pm UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/7 "2016-03-04T14:35:06Z")

</div>

Sorry, I'm pretty rusty on this stuff. I was thinking of "Transfer-Encoding: chunked" which is pretty widely in use (like on this page) but you can be sure if we ever do actually get back to the steam style we'll reevaluate based on what modern stuff can do. Its not like Elasticsearch would have to support IE6 if it built streams. Curl certainly, but not IE6.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [March 4, 2016, 2:41pm UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/8 "2016-03-04T14:41:37Z")

</div>

Sure, HTTP chunked transfer is widely in use. No doubt, since 99,99% of all HTTP traffic is still 1.0/1.1, that is the reason 🙂

Curl has full HTTP/2 support, just use `--http2` option: [https://curl.haxx.se/docs/http2.html](https://curl.haxx.se/docs/http2.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:11pm UTC](https://discuss.elastic.co/t/streaming-api-for-elasticsearch/43485/9 "2017-07-05T23:11:14Z")

</div>


