Header type problem
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.
Happens to me also. i have just followed the sample code provided
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.
The same questions! hope to fix it as soon as possible!
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
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).
Have this issue with elasticsearch-7.7.1.