Elastic search aggregation pagination issue

2019-09-08 12:04发布

问题:

How do i perform a query similar to this one in elasticsearch?

SELECT field FROM table GROUP BY field OFFSET 10 LIMIT 10;

Thank for the answer

回答1:

The short answer is that you can't (yet).

There's an open issue titled "Paging aggregation support" that should take care of this feature soon. As you can see that issue is two years old, still open and got many +1 from many people. It's still not slated for any releases yet, though.

In the meantime, you can retrieve your aggregation with size: 20 and then on the client side only consider the last 10 terms.