Skip to content

Calling .aggregations before .response causes a search to be executed twice. #975

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

Open
aburkard opened this issue Jan 30, 2021 · 1 comment
Labels

Comments

@aburkard
Copy link

aburkard commented Jan 30, 2021

For example:

resp = MyModel.__elasticsearch__.search(query)
resp.aggregations
# Search is conducted
resp.response
# The same search is run again

I see others have had a similar issue before. It appears the issue is that .aggregations calls .raw_response which executes the query, and then .response re-executes the query. Is there any reason not to implement this patch? I see there was a concern about thread-safety.

@picandocodigo
Copy link
Member

picandocodigo commented Feb 1, 2021

Hi @aburkard,
Thanks for reporting this, I'll be working on this library soon after the release of the Elastic stack 7.11 and I'll take a look at this issue.
Cheers!

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

No branches or pull requests

2 participants