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

mget() does not accept ids as parameter #1856

Closed
schettino72 opened this issue Jan 3, 2022 · 1 comment
Closed

mget() does not accept ids as parameter #1856

schettino72 opened this issue Jan 3, 2022 · 1 comment

Comments

@schettino72
Copy link

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

elasticsearch-py version (elasticsearch.__versionstr__): 7.16.2

Description of the problem including expected versus actual behavior:

Expected to be able to pass body field as top-level parameter.
But not available to mget().

Steps to reproduce:

import elasticsearch
es = elasticsearch.Elasticsearch()
es.mget(index='my_index', body={'ids':[8, 69]}) # works fine
es.mget(index='my_index', ids=[8, 69]) # raises exception

Exception:

TypeError                                 Traceback (most recent call last)
<ipython-input-21-df136b3e844f> in <module>
----> 1 es.mget(index='vendor_1', ids=[8, 69])

~/.virtualenvs/xxx/lib/python3.8/site-packages/elasticsearch/client/utils.py in _wrapped(*args, **kwargs)
    345                 if p in kwargs:
    346                     params[p] = kwargs.pop(p)
--> 347             return func(*args, params=params, headers=headers, **kwargs)
    348 
    349         return _wrapped

TypeError: mget() got an unexpected keyword argument 'ids'
@sethmlarson
Copy link
Contributor

sethmlarson commented Jan 3, 2022

In 7.x only a subset of APIs support passing body fields as parameters. Those APIs are listed in the issue under the "which APIs are affected" section:

  • search
  • index
  • create
  • update
  • scroll
  • clear_scroll
  • search_mvt
  • indices.create

Other APIs like mget you'll have to use body={...} until you upgrade to v8.0.0 of the client library. There are currently alpha releases out if you're interested in trying them out.

Does this resolve your issue?

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