Support multiple versions including versions 1.x
See original GitHub issueHello, Is there a way to support all versions including versions 1.x? Until now i have support for 2.x.y, 5.x.y and 6.x.y ( I followed the information in the link elasticsearch -compatibility
My install_requires in setup.py:
install_requires=[
"elasticsearch2",
"elasticsearch5",
"elasticsearch>=6.0.0,<7.0.0",
"certifi==2017.4.17"
],
The problem is that i need to support also versions 1.x.y. I tried to collect data for elasticsearch version 1.x.y and I got an error:
File "/Users/Offir/ve/elasticsearch/lib/python2.7/site-packages/es/es.py", line 37, in wrapped
print str(e)
File "/Users/Offir/ve/elasticsearch/lib/python2.7/site-packages/elasticsearch/exceptions.py", line 58, in __str__
cause = ', %r' % self.info['error']['root_cause'][0]['reason']
TypeError: string indices must be integers
I added “elasticsearch>=1.0.0,<2.0.0” to the install_requires and I was able to get my data without errors (for elasticsearch version 1.x.y) but then I didn’t had support for elasticsearch version 6.x.y and i got different error:
File "/Users/Offir/ve/elasticsearch/lib/python2.7/site-packages/es/es.py", line 44, in wrapped
raise Exception(msg)
Exception: Content-Type header is missing
I tried to do add something like elasticsearch>=1.0.0,<7.0.0
and elasticsearch1
but it didn’t work and I got the same error for elasticsearch version 6.x.y.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Support multiple versions of ASP.NET Core Web API
In this post, let's find how to support multiple version ASP.NET Core Web API. ... Open Project.json and include following nuget package.
Read more >Make the client better support multiple different versions #127
The scenario that I'm worried about with the multiple branch situation is how the client can handle upgrading elasticsearch server versions.
Read more >DPI Version 1.x base code considerations - IBM
For example, the z/OS SNMP agent provides support for multiple versions of DPI, including Version 1.0, Version 1.1, and Version 2.0. Parent topic:...
Read more >How versioning works in lists and libraries - Microsoft Support
Learn how to view the version history of documents and items in your library, ... version better, you can replace the current version...
Read more >Semantic Versioning 2.0.0 | Semantic Versioning
In systems with many dependencies, releasing new package versions can quickly become a ... Dependency hell is where you are when version lock...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
this is to be expected because an elasticsearch cluster running es6 has a strict requirement on the Content-Type header. You can see here that the support for explicitly adding a Content-Type was added https://github.com/elastic/elasticsearch-py/commit/d862c8a799e485649da3beaef7037860d01ac3e5
Prior to this commit, content-type was not sent along in the request to Elasticsearch, which means if you’re trying to use a connection class from before this commit (ie in elasticsearch1) it will not have the header information built into the connection class.
There are other issues as well with trying to use a connection class from a prior version fo Elasticsearch-py on a current version of Elasticsearch. Which is why you need to import them all. Then you need to have knowledge of what version a particular cluster is running before you create the connection object.
@fxdgear Thank you for your help 😃 I installed
elasticsearch2
,elasticsearch5
andelasticsearch>=6.0.0,<7.0.0
then usingimport elasticsearch
(according to https://elasticsearch-py.readthedocs.io/en/master/#compatibility) I was able to support all versions of elasticsearch (expect ofelasticsearch1
). That’s why I taught that installing elasticsearch1 will work as well so I could avoid doing:When I added
elasticsearch1
to theinstall_requires
I was able to fetch data from elasticsearch 1 cluster version but I got an errorContent-Type header is missing
when trying to fetch data from elasticsearch 6 cluster version.