elastic / elasticsearch-py

Official Python client for Elasticsearch
https://ela.st/es-python
Apache License 2.0
4.23k stars 1.18k forks source link

Support for Composite Aggregation #849

Open andrearota opened 6 years ago

andrearota commented 6 years ago

Current elasticsearch-py release does not have support to Elasticsearch composite aggregation API.

Since I am using it, I handled the composite aggregation pagination manually, by multiple searches with the proper after element set in each request body. I propose two ways to integrate the composite aggregation in the client:

  1. an helper method elasticsearch.helpers.composite_agg(), similar to elasticsearch.helpers.scan(), that provides a simple abstraction on top of the composite aggregation API, i.e. a simple iterator that yields all hits as returned by underlining composite aggregation requests.
  2. by adding the parameter after in search(**kwargs), that similarly to the parameter scroll allows the user to specify the after element in the next request and continue the paging.

What do you think? If they are sound, I can start preparing my PR.

andrearota commented 6 years ago

Hello, any interest on the proposed idea?

If any, I can work on it, please let me know.

cp2587 commented 5 years ago

Would be very interested to have an helper function on the model of what scan does ! Did you end up opening a PR on this ?

andrearota commented 5 years ago

No, I did not, because I have not received any confirmation of interest on this topic by the maintainers.

fxdgear commented 5 years ago

Feel free to open a PR :)

I'll gladly review it. Sorry for the delay in response :frowning_face:

andrearota commented 5 years ago

No problem ;) I am going to work on it and open the PR.

iukea commented 5 years ago

Hey have you guys finished this? I am using composite right now not using the elasticsearch-py, and Jesus is it complicated

amedhat3 commented 5 years ago

Hey @andrearota Did you do any progress on this feature?

Troffifi commented 3 years ago

Hi. This will be really useful! Can you share with us the progress on this feature request?