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

Upgrade ES library #705

Closed
wants to merge 3 commits into from
Closed

Upgrade ES library #705

wants to merge 3 commits into from

Conversation

marcospri
Copy link
Member

@marcospri marcospri commented Jan 8, 2024

Found this while doing the python upgrade, much better to do it independently of that.

See commits for a little bit details on the changes.

Not sure why we never got this PR from dependabot though.

From: https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/release-notes.html#rn-8-0-0

- Removed the default URL of http://localhost:9200 due to Elasticsearch 8.0 default configuration
  being https://localhost:9200.
  The client’s connection to Elasticsearch now must be specified with scheme, host, and port or with the cloud_id parameter
From: https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/release-notes.html#rn-8-0-0

- Added the meta property to ApiError to access the HTTP response metadata of an error.
- Changed exception hierarchy, the major change is a new exception ApiError which differentiates
  between an error that’s raised from the transport layer
  (previously elasticsearch.exceptions.TransportError, now elastic_transport.TransportError)
  and one raised from the API layer
@marcospri marcospri requested a review from seanh January 8, 2024 15:17
elasticsearch==6.3.1
elastic-transport==8.11.0
# via elasticsearch
elasticsearch==8.11.1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this to be in a version from 2018?

Any issues about our actual ES server version? I don't think this was pinned to one particular version so it doesn't seem intentional.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#225 (comment)

It looks like Rob was not happy with the fact the Bouncer's tests apparently mock Elasticsearch, and saw little value in updating the library anyway.

Bouncer's a pretty simple app so it shouldn't be too difficult to test it manually.

Could perhaps rewrite the tests to not mock Elasticsearch as well although that may be difficult since Bouncer talks directly to h's Elasticsearch. For example it's code in h, not Bouncer, that adds the documents to Elasticsearch that Bouncer reads.

Copy link
Member

@robertknight robertknight Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could perhaps rewrite the tests to not mock Elasticsearch as well although that may be difficult since Bouncer talks directly to h's Elasticsearch.

Another option is that h handles talking to ES and exposes API for bouncer to use (with suitable authentication). That's assuming that h can't just get the data needed from Postgres instead. It's less efficient, but it means all the knowledge about ES structure would be in one codebase.

Copy link
Contributor

@seanh seanh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to manually test this as per Rob's old comment that I linked to

@marcospri
Copy link
Member Author

marcospri commented Jan 9, 2024

This is broken, at least by this error:

TypeError: get() got an unexpected keyword argument 'doc_type'

See elastic/elasticsearch-py#846

We'll have to check if we can upgrade to 8.0.0 without updating the server version.

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.

3 participants