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

Mismatch between code and stubs on Elasticsearch.index #1811

Closed
elip-OE opened this issue Nov 23, 2021 · 1 comment
Closed

Mismatch between code and stubs on Elasticsearch.index #1811

elip-OE opened this issue Nov 23, 2021 · 1 comment

Comments

@elip-OE
Copy link

elip-OE commented Nov 23, 2021

Elasticsearch version (bin/elasticsearch --version): 7.12.1

elasticsearch-py version (elasticsearch.__versionstr__): 7.15.2

Please make sure the major version matches the Elasticsearch server you are running.

Description of the problem including expected versus actual behavior:

There is mismatch between the code signature and the stubs:

https://github.com/elastic/elasticsearch-py/blob/v7.15.2/elasticsearch/client/__init__.py#L360

    def index(self, index, body, doc_type=None, id=None, params=None, headers=None):

https://github.com/elastic/elasticsearch-py/blob/v7.15.2/elasticsearch/client/__init__.pyi#L183-L187

    def index(
        self,
        *,
        index: str,
        document: Any,
        ...
    )

since the stubs matches the 8.x API, I'm guessing this is related to some auto-generated code.

Steps to reproduce:

N/A

@sethmlarson
Copy link
Contributor

The stubs are correct, they aren't the same as the function signature because the body parameter is deprecated in 8.0 and onwards. You can either use type: ignore or switch to using document= with the index API. See this issue for more info on these deprecations: #1698

Closing this for now, let me know if you have additional questions.

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

No branches or pull requests

2 participants