elasticsearch_loader
elasticsearch_loader copied to clipboard
ypeError: __init__() got an unexpected keyword argument 'use_ssl
I am run it with the following command:
elasticsearch_loader --es-host http://localhost:9203 --http-auth elastic:changeme --index raw_bill --type incident csv input.csv
I got :
Traceback (most recent call last):
File "/Users/redayxu/devCloud/bill/.env/bin/elasticsearch_loader", line 11, in <module>
load_entry_point('elasticsearch-loader==0.6.0', 'console_scripts', 'elasticsearch_loader')()
File "/Users/redayxu/devCloud/bill/.env/lib/python3.8/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Users/redayxu/devCloud/bill/.env/lib/python3.8/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/redayxu/devCloud/bill/.env/lib/python3.8/site-packages/click/core.py", line 1134, in invoke
Command.invoke(self, ctx)
File "/Users/redayxu/devCloud/bill/.env/lib/python3.8/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/redayxu/devCloud/bill/.env/lib/python3.8/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/redayxu/devCloud/bill/.env/lib/python3.8/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/redayxu/devCloud/bill/.env/lib/python3.8/site-packages/elasticsearch_loader/__init__.py", line 95, in cli
ctx.obj['es_conn'] = Elasticsearch(opts['es_host'], **es_opts)
I ran into this issue as well. A temporary workaround that worked for me was to use the Python 2 version of elasticsearch_loader
How does one use the "Python 2" version?
How does one use the "Python 2" version?
I encountered this issue too, but decided to go a different route, which works well for me. Rather than loading files with this project, I have setup https://vector.dev/ to listen on a TCP socket, and write to Elasticsearch. So basically loading to ES is cat file.ldjson | nc localhost 9000.
The vector config was roughly:
api.enabled = true
[sources.in]
type = "socket"
address = "0.0.0.0:9000"
max_length = 102_400
mode = "tcp"
[transforms.proc]
inputs = ["in"]
type = "remap"
source = '''
structured = parse_json!(.message)
. = merge!(., structured)
del(.message)
'''
[sinks.elasticsearch]
inputs = [ "proc" ]
type = "elasticsearch"
auth.user = "admin"
auth.password = "password"
auth.strategy = "basic"
mode = "bulk"
endpoints = [
"https://localhost:9200"
]
compression = "none"
tls.verify_certificate = false
How does one use the "Python 2" version?
python2 -m virtualenv p2env
source p2env/bin/activate
pip install elasticsearch_loader
elasticsearch_loader --es-host http://192.168.1.200:9200 --index mactimes csv /tmp/pas2.dd.mactimes.csv
I get the same issue. Does anyone understand why it is happening in the first place?
use_ssl is getting passed as an argument to the ElasticSearch class constructor here, but the constructor in the latest version of elasticsearch doesn't take use_ssl.
while installing it on python 2 facing below error ERROR: Exception: Traceback (most recent call last): File "/p2env/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 223, in _main status = self.run(options, args) File "/p2env/lib/python2.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper return func(self, options, args) File "/p2env/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 321, in run reqs, check_supported_wheels=not options.target_dir File "/p2env/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 180, in resolve discovered_reqs.extend(self._resolve_one(requirement_set, req)) File "/p2env/lib/python2.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 419, in _resolve_one assert req_to_install.user_supplied AssertionError
One workaround to get rid of this error is to remove 'use_ssl' from init.py file.
https://github.com/moshe/elasticsearch_loader/blob/master/elasticsearch_loader/init.py#L96