elasticsearch_loader icon indicating copy to clipboard operation
elasticsearch_loader copied to clipboard

ypeError: __init__() got an unexpected keyword argument 'use_ssl

Open dropthemasquerade opened this issue 3 years ago • 8 comments

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)

dropthemasquerade avatar Aug 30 '22 08:08 dropthemasquerade

I ran into this issue as well. A temporary workaround that worked for me was to use the Python 2 version of elasticsearch_loader

ossie-git avatar Sep 14 '22 20:09 ossie-git

How does one use the "Python 2" version?

Dragon-1973 avatar Jan 06 '23 13:01 Dragon-1973

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

godber avatar Jan 06 '23 13:01 godber

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 

ossie-git avatar Jan 06 '23 17:01 ossie-git

I get the same issue. Does anyone understand why it is happening in the first place?

caitpj avatar Apr 01 '23 21:04 caitpj

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.

Abdallah-Youssef avatar May 25 '23 13:05 Abdallah-Youssef

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

abdulr86j avatar Jun 18 '23 19:06 abdulr86j

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

s0rin avatar Aug 22 '23 12:08 s0rin