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

Header type problem #25

Open
hbarnard opened this issue Feb 10, 2018 · 6 comments
Open

Header type problem #25

hbarnard opened this issue Feb 10, 2018 · 6 comments

Comments

@hbarnard
Copy link

Trying:

python csv2es.py --index-name test --doc-type test --import-file test.csv

gives:

Using host: http://127.0.0.1:9200/
Traceback (most recent call last):
  File "csv2es.py", line 215, in <module>
    cli()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "csv2es.py", line 197, in cli
    es.create_index(index_name)
  File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py", line 92, in decorate
    return func(*args, query_params=query_params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py", line 1005, in create_index
    query_params=query_params)
  File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py", line 257, in send_request
    self._raise_exception(status, error_message)
  File "/usr/local/lib/python2.7/dist-packages/pyelasticsearch/client.py", line 271, in _raise_exception
    raise error_class(status, error_message)
pyelasticsearch.exceptions.ElasticHttpError: (406, u'Content-Type header [] is not supported')

I'm not an elasticsearch expert so, forgive me if this is something idiot.

@jeremejazz
Copy link

Happens to me also. i have just followed the sample code provided

@daanknoope
Copy link

I think this is caused by the introduction of strict content-type checking by ES from version 6.0 on (see: https://www.elastic.co/blog/strict-content-type-checking-for-elasticsearch-rest-requests). This script seems not to pass on a content type in the header - thereby creating this issue.

@MasonQAQ
Copy link

MasonQAQ commented Sep 6, 2018

The same questions! hope to fix it as soon as possible!

@MasonQAQ
Copy link

MasonQAQ commented Sep 6, 2018

I find the way to solve the Q, just modify the requirements.txt, set the elasticsearch to your version. For example, if your version is 6.x.x you can set: elasticsearch>=6.0.0,<7.0.0

@monktastic
Copy link

I find the way to solve the Q, just modify the requirements.txt, set the elasticsearch to your version. For example, if your version is 6.x.x you can set: elasticsearch>=6.0.0,<7.0.0

Alternatively, if you are using the pip installed version, you can just upgrade elasticsearch (pip install --upgrade elasticsearch).

@danyaljj
Copy link

danyaljj commented Jun 9, 2020

Have this issue with elasticsearch-7.7.1.

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

6 participants