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

Fix AttributeError for Elasticsearch>2.0.0,<3.0.0 #197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

artemknd
Copy link

AIOHttpConnection takes use_ssl argument and passes one to the parent's init.

Then self.use_ssl gets used instead of use_ssl here
https://github.com/aio-libs/aioelasticsearch/blob/master/aioelasticsearch/connection.py#L52

It works for the latest elasticsearch-py versions, however, it doesn't work with >2.0.0, b/c there's no self.use_ssl = use_ssl there.

What do these changes do?

Are there changes in behavior for the user?

Related issue number

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> (e.g. 588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the PR
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: Fix issue with non-ascii contents in doctest text files.

AIOHttpConnection takes use_ssl argument and passes one to the parent's __init__.

Then self.use_ssl gets used instead of use_ssl here
https://github.com/aio-libs/aioelasticsearch/blob/master/aioelasticsearch/connection.py#L52

It works for the latest elasticsearch-py versions, however, it doesn't work with >2.0.0, b/c there's no self.use_ssl = use_ssl there.
@codecov
Copy link

codecov bot commented Nov 11, 2019

Codecov Report

Merging #197 (baa68ef) into master (26fcd7c) will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #197   +/-   ##
======================================
  Coverage    0.23%   0.23%           
======================================
  Files           6       6           
  Lines         433     433           
  Branches       77      77           
======================================
  Hits            1       1           
  Misses        432     432           
Impacted Files Coverage Δ
aioelasticsearch/connection.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 26fcd7c...baa68ef. Read the comment docs.

@asvetlov
Copy link
Member

Is elasticsearch 2.x supported still?

@artemknd
Copy link
Author

artemknd commented Nov 12, 2019

@asvetlov I tested out search and scan aioelasticsearch examples.
They both work for ES 2.x with my tiny fix.

As for elasticsearch-py, 2.X is supported as well
https://github.com/elastic/elasticsearch-py#compatibility

@asvetlov
Copy link
Member

Manual testing is not enough; the library should be tested by travis-ci against all supported ES versions.
ES_TAG env var already exists in .travis.yml config file, I'm ok with adding the travis matrix for testing several versions.
Sorry, I have no time/motivation for making the fix myself but happy to review a PR from a champion.
Please note: extending the matrix requires a separate PR.

@artemknd
Copy link
Author

artemknd commented Nov 14, 2019

@asvetlov did you have a chance to take a look at the code itself?

The update is very straightforward. I just substituted referred parent class's Connection property self.use_ssl with constructor's argument use_ssl directly.

I'd even say it's quite reasonable and makes more sense, b/c there's no dependency on the underlying parent's implementation.

Current tests are all good. So, I believe it's safe to merge one.
Could you take a look at the code diff and merge it, please?

@asvetlov
Copy link
Member

Please don't get me wrong.
You are asking for changing the code that works fine already according to the current test suite.
There is no reason to do it, even if the change is barely minimal.
My motivation for hesitation is a chance to break something by accident. Don't fix if not broken, test the fix of broken things.

You said that the PR fixes ES 2.x, that's awesome!
What I'm asking is adding a test to check this (and to make sure that the lastest aioelasticsearch works with ES 2.x at all). It can be done easily by extending travis config matrix.
Could you update it?

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

Successfully merging this pull request may close these issues.

2 participants