-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
(This issue is opened on behalf of @aockel and is quoted directly)
Hi, I've tried to run the simple async bulk request example and got the following error message:
File "sample_async.py", line 28, in
loop.run_until_complete(main())
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "sample_async.py", line 25, in main
await async_bulk(es, gendata())
File "/usr/local/lib/python3.7/site-packages/elasticsearch/_async/helpers.py", line 241, in async_bulk
async for ok, item in async_streaming_bulk(client, actions, *args, **kwargs):
File "/usr/local/lib/python3.7/site-packages/elasticsearch/_async/helpers.py", line 171, in async_streaming_bulk
**kwargs
File "/usr/local/lib/python3.7/site-packages/elasticsearch/_async/helpers.py", line 92, in azip
yield tuple([await x.anext() for x in aiters])
File "/usr/local/lib/python3.7/site-packages/elasticsearch/_async/helpers.py", line 92, in
yield tuple([await x.anext() for x in aiters])
File "/usr/local/lib/python3.7/site-packages/elasticsearch/_async/helpers.py", line 55, in _process_bulk_chunk
resp = await client.bulk("\n".join(bulk_actions) + "\n", *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/elasticsearch/_async/client/init.py", line 435, in bulk
body=body,
File "/usr/local/lib/python3.7/site-packages/elasticsearch/_async/transport.py", line 286, in perform_request
timeout=timeout,
TypeError: object tuple can't be used in 'await' expression
using the following code snipped:
import asyncio
from aws_requests_auth.boto_utils import BotoAWSRequestsAuth
from elasticsearch import AsyncElasticsearch, RequestsHttpConnection
from elasticsearch.helpers import async_bulk
es_host = 'exampleurldoesnotexist.eu-west-1.es.amazonaws.com'
auth = BotoAWSRequestsAuth(aws_host=es_host,
aws_region='eu-west-1',
aws_service='es')
es = AsyncElasticsearch(host=es_host,
port=80,
connection_class=RequestsHttpConnection,
http_auth=auth,
timeout=60)
async def gendata():
mywords = ['foo', 'bar', 'baz']
for word in mywords:
yield {
"_index": "mywords",
"doc": {"word": word},
}
async def main():
await async_bulk(es, gendata())
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
dsmiller95
Metadata
Metadata
Assignees
Labels
No labels