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

Search field not accessible in Response object for MultiSearch #1223

Closed
benrudolph opened this issue Jul 30, 2019 · 1 comment · Fixed by #1787
Closed

Search field not accessible in Response object for MultiSearch #1223

benrudolph opened this issue Jul 30, 2019 · 1 comment · Fixed by #1787

Comments

@benrudolph
Copy link

The docs say that you should be able to access the search object in the response, but after inspecting the code and trying in code, I get an attribute error. I believe it's only available at ._search. Would be nice if this was a public method so we can correlate the response with the query.

responses = ms.execute()

for response in responses:
    print("Results for query %r." % response.search.query)
    for hit in response:
        print(hit.title)
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Apr 26, 2024
@miguelgrinberg
Copy link
Collaborator

I'm correcting the example in the documentation to use response._search for now. I'm seeing the search object as an extra attribute in the response and not a primary one, so it seems to me using _search here is appropriate to indicate this.

miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Apr 30, 2024
github-actions bot pushed a commit that referenced this issue Apr 30, 2024
miguelgrinberg added a commit that referenced this issue Apr 30, 2024
miguelgrinberg added a commit that referenced this issue Apr 30, 2024
Fixes #1223

(cherry picked from commit a5880ef)

Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
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.

2 participants