Skip to content

Instantly share code, notes, and snippets.

@rugyoga
Created July 19, 2022 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rugyoga/a94f6e3cf16b76031df82fd97b380e1d to your computer and use it in GitHub Desktop.
Save rugyoga/a94f6e3cf16b76031df82fd97b380e1d to your computer and use it in GitHub Desktop.
Update the ES query using the most recent result set
@spec update(ES.query_t(), ES.response_t()) :: ES.query_t()
def update(query, %Req.Response{body: %{"hits" => %{"hits" => hits}}, status: 200}) do
Map.put(query, :search_after, List.last(hits)["sort"])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment