oliver006 / elasticsearch-test-data

Generate and upload test data to Elasticsearch for performance and load testing
MIT License
257 stars 122 forks source link

Error with default options against local cluster #5

Closed mradamlacey closed 8 years ago

mradamlacey commented 8 years ago

I have a local Elasticsearch 2.3.2 instance and using Python 3.5...

I ran the following:

python es_test_data.py --es_url=http://localhost:9200

Here's the output with exception:

[I 160515 23:59:36 es_test_data:47] Trying to create index http://localhost:9200/test_data
[I 160515 23:59:37 es_test_data:50] Creating index "test_data" done   b'{"acknowledged":true}'
[I 160515 23:59:37 es_test_data:217] Generating 10000 docs, upload batch size is 1000
Traceback (most recent call last):
  File "es_test_data.py", line 274, in <module>
    tornado.ioloop.IOLoop.instance().run_sync(generate_test_data)
  File "C:\Python35\lib\site-packages\tornado\ioloop.py", line 453, in run_sync
    return future_cell[0].result()
  File "C:\Python35\lib\site-packages\tornado\concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "C:\Python35\lib\site-packages\tornado\gen.py", line 1014, in run
    yielded = self.gen.throw(*exc_info)
  File "es_test_data.py", line 235, in generate_test_data
    yield upload_batch(upload_data_txt)
  File "C:\Python35\lib\site-packages\tornado\gen.py", line 1008, in run
    value = future.result()
  File "C:\Python35\lib\site-packages\tornado\concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "C:\Python35\lib\site-packages\tornado\gen.py", line 1017, in run
    yielded = self.gen.send(value)
  File "es_test_data.py", line 68, in upload_batch
    result = json.loads(response.body)
  File "C:\Python35\lib\json\__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
oliver006 commented 8 years ago

Thanks for reporting this issue! I pushed up a fix to master that should address this, let me know if the fixed version works for you.

oliver006 commented 8 years ago

Closing this, plz re-open or file a new issue if you still have problems.