You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use Search(index='test').filter('term', test='test').params(opaque_id='test',).execute(), I want to distinguish different search requests.
However, this triggers a DeprecationWarning: Passing transport options in the API method is deprecated. Use 'Elasticsearch.options()' instead.
Is it possible to fix this to avoid the warning?
It's is my package version:
elasticsearch: 8.15.1
elasticsearch-dsl: 8.15.4
The text was updated successfully, but these errors were encountered:
@winnie0101 If you pass an Elasticsearch client instance explicitly to your searches, then you can configure your options as recommended in the deprecation warning.
@miguelgrinberg Thanks for the reply!
Yeah, I know that can pass in an Elasticsearch client instance, but most of the time we’re just used to using the default connection (connections.create_connection(...)). So I was wondering — is there any plan to suppress that warning so we can stick with the default connection style?
Or do you generally recommend always passing in a client instance when running into stuff like this?
The change that adds the deprecation message that you are seeing was made about 4 years ago and even though I wasn't involved with this project at the time the intention was to drive people away from mixing transport and client related options, in part because there can be naming collisions between them. I guess everything we've done in the past can be revisited or even reverted if warranted, but at this time making changes in this area is not in our plans, and the warning would eventually turn into an error when this feature is finally removed (although I do not know when this will happen).
I should add that it is possible to set up a default connection that includes an opaque id if that is what you need. Something like this:
When I use
Search(index='test').filter('term', test='test').params(opaque_id='test',).execute()
, I want to distinguish different search requests.However, this triggers a
DeprecationWarning: Passing transport options in the API method is deprecated. Use 'Elasticsearch.options()' instead.
Is it possible to fix this to avoid the warning?
It's is my package version:
elasticsearch: 8.15.1
elasticsearch-dsl: 8.15.4
The text was updated successfully, but these errors were encountered: