Skip to content

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

Open
@aburkard

Description

@aburkard

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.

Activity

picandocodigo

picandocodigo commented on Feb 1, 2021

@picandocodigo
Member

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @picandocodigo@aburkard

        Issue actions

          Calling .aggregations before .response causes a search to be executed twice. · Issue #975 · elastic/elasticsearch-rails