elasticsearch-py
elasticsearch-py copied to clipboard
Make failing document available when using the bulk helper
According to documentation :
import asyncio
from elasticsearch import AsyncElasticsearch
from elasticsearch.helpers import async_bulk
es = AsyncElasticsearch()
async def gendata():
mywords = ['foo', 'bar', 'baz']
for word in mywords:
yield {
"_index": "mywords",
"word": word,
}
async def main():
async for ok, result in async_streaming_bulk(es, gendata()):
action, result = result.popitem()
if not ok:
print("failed to %s document %s" % ())
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
but neither actions nor result contains information about the original event.
How can i get error events?
Currently there's no way to get this information from the returned error, this would be good to have though. I'm going to convert this into a feature suggestion issue.