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

Make failing document available when using the bulk helper #1908

Open
bralbral opened this issue Feb 6, 2022 · 1 comment
Open

Make failing document available when using the bulk helper #1908

bralbral opened this issue Feb 6, 2022 · 1 comment

Comments

@bralbral
Copy link

bralbral commented Feb 6, 2022

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?

@bralbral bralbral changed the title Is there way get errors actions from elasticsearch.helpers.*bulk ? Is there way get error actions from elasticsearch.helpers.*bulk ? Feb 6, 2022
@sethmlarson
Copy link
Contributor

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.

@sethmlarson sethmlarson changed the title Is there way get error actions from elasticsearch.helpers.*bulk ? Make failing document available when using the bulk helper Feb 17, 2022
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