Trigger on insert to index


I am using elasticsearch 6.8 and I couldn't find anything directly to this question, but was curious to know if it is possible to call an external python script after the insert of data into an index.

If it is possible, could someone point me to the resources so that I could learn more about the available tools to make that happen.

This isn't currently possible.

It's functionality that would likely be available once the Changes API is released but that's a long, long way off.

where do you see info on that api?

The issue was raised in 2011 and is still being discussed, so it's not coming any time soon!

Okay thank you for that info, but is it not possible to achieve something similar with a trigger or watcher?

So if data is inserted to some index, after that operation I can trigger some external command?

There's no way for elasticsearch to notify you of a document being indexed.

The only way you could do this currently is to only index documents from one single place, then deal with notifying other services once the index operation returns.

So a watcher doesnt do something similar ?

A watcher is a way to run periodic queries and send alerts if the results match some criteria. It won't tell you when a document is indexed.

Even if you perform some aggregate?

Easiest way to to this is to e.g. write to a message queue when you index data and the read from there. Watcher will not help here.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.