Skip to content
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

Set max from/size for ES #44

Open
gibrown opened this issue Sep 27, 2016 · 2 comments
Open

Set max from/size for ES #44

gibrown opened this issue Sep 27, 2016 · 2 comments
Labels
enhancement New feature or request

Comments

@gibrown
Copy link

gibrown commented Sep 27, 2016

In ES 2.x there is now a maximum value for from+size in order to prevent deep paging which can cause performance problems.

We've also added this same limit when querying WP.com 1.x indices (after seeing some performance problems). It seems that es-wp-query should handle this case cleanly. For example, what happens when a bot tries to walk all archive pages.

@gibrown gibrown added the enhancement New feature or request label Sep 27, 2016
@mboynes
Copy link
Contributor

mboynes commented Sep 27, 2016

For example, what happens when a bot tries to walk all archive pages.

That's a problem in MySQL too. I wonder which handles it better.

@gibrown
Copy link
Author

gibrown commented Sep 28, 2016

BTW, there are ways to get around this sometimes with filters. May be worth implementing. For inf scroll of calypso posts, sorted by date across all of a user's blogs we use encoded page handles. Something like:

$args = wp_parse_args( “blog=1234&post=12&value=2015-01-12T12:00:21” )
{ “bool” : { “should” : [
  { “range” : { “date” : { “lt” : $args[‘date’] },
  { “and” : [
    { “term” : { “date” : $args[‘date’] },
    { “range” : { “blog_id” : { “gte” : $args[‘blog’] },
    { “range” : { “post_id” : { “gt” : $args[‘post’] },
  ] }
],
“sort” : [
  { “date” : { “order” : “desc” } },
  { “blog_id” : { “order” : “asc” } },
  { “post_id” : { “order” : “asc” } },
]
} }

Though the assumption here is that you need to pass around info about the last item that was shown rather than just a page number. It also has the nice property of not showing duplicate content when new content is posted. I suspect though that this would require a change to Core first. But mentioning in case there is another way.

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

No branches or pull requests

2 participants