Skip to content
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

Index Api Feature? #73

Open
britztopher opened this issue Apr 1, 2021 · 2 comments
Open

Index Api Feature? #73

britztopher opened this issue Apr 1, 2021 · 2 comments

Comments

@britztopher
Copy link

britztopher commented Apr 1, 2021

I have a situation where bulk api isnt appilcable to my function. I have a lambda and execution time is around 1200ms, so bulk api cant get full enough to flush logs to elastic. Ive tried almost every combination of flush-bytes and flush-interval will no avail. I forked lib and now use index api which works nicely for short running applications. Would like to know if this is something that would be beneficial to library.

The way I see it is that you can choose between bulk or index depending on situation. It would still use the same splitter stream but instead of splitting the docs up it would be just used for the on('data') event from a node stream's perspective.

heres just a snippet from on data event:

  splitter.on('data', doc => {
    console.log('DATA IN SPLITTER: ', doc);
    client
      .index({
        index: getIndexName(doc.time || doc['@timestamp']),
        body: doc,
        type: type,
      })
      .then(
        stats => {
          splitter.emit('insert', stats);
        },
        err => {
          splitter.emit('error', err);
        },
      );
  });

Lmk

@mcollina
Copy link
Member

mcollina commented Apr 1, 2021

Having an option that enables you to select between bulk and index would be nice.

I don't understand your snippet, it does not seem directly applicable to this lib

@britztopher
Copy link
Author

britztopher commented Apr 1, 2021

@mcollina is how i reuse splitter as a stream but instead use index api, as to demonstrate how i implemented it in this lib.

Ill see what i can do to open an MR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants