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

[7.16] Using reserved keywords within the scan helper results in errors #1828

Closed
sethmlarson opened this issue Dec 8, 2021 · 8 comments · Fixed by #1897
Closed

[7.16] Using reserved keywords within the scan helper results in errors #1828

sethmlarson opened this issue Dec 8, 2021 · 8 comments · Fixed by #1897

Comments

@sethmlarson
Copy link
Contributor

We should be handling the from parameter and renaming the value to from_

@rumbarum
Copy link

Hello!

I tried

query = {
  "query": ...,
  "from": ...,
  "size": ...,
  "_source": ...
}
es.search(index="index", **query)

and got an Error

TypeError: search() got an unexpected keyword argument 'from'

Is there any reason changing kwargs "from" to "from_", breaking consistency?

@sethmlarson
Copy link
Contributor Author

from is a reserved keyword in Python which is why we alias it to from_. However the library should handle this so users can use either one.

@fabiopedrosa
Copy link

fabiopedrosa commented Feb 3, 2022

Yeah, seeing the same issue. It was updated here, but not on elasticsearch-dsl which we use to build the queries.

@jgb
Copy link

jgb commented Feb 3, 2022

Yeah, seeing the same issue. It was updated here, but not on elasticsearch-dsl which we use to build the queries.

I think the bug still exists in elasticsearch as well.

@jgb
Copy link

jgb commented Feb 16, 2022

@sethmlarson hi will there be a release of the v7.17 branch which includes this bugfix? I'm pinned on v7.14.2 because of this bug, and not ready yet to go to v8. Thanks!

@sethmlarson
Copy link
Contributor Author

@jgb I am planning on backporting the fix into the 7.17 branch will will receive a release in a few weeks. Can focus more on bug fixes now that the 8.0 release is out :)

@sethmlarson
Copy link
Contributor Author

The fix has landed in 7.17, you could try installing from the branch and testing locally:

$ python -m pip install https://github.com/elastic/elasticsearch-py/archive/7.17.zip

@jgb
Copy link

jgb commented Feb 16, 2022

@sethmlarson thanks, I can confirm this does solve my problem! Looking forward to the new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants