Paging With Completion Suggester

Hi,

I want to page my completion suggester results.

at present I have a request like the following:

var skip = (pageNumber - 1) * this.pageSize;

this.client.suggest({
index: 'books',
type: 'book',
body: {
search_books : {
text : term,
completion : {
from : skip,
size : this.pageSize,
field : "suggested_book"
}
}
}
});

But i dont know how to generate a page as it doesnt return a valid Total.

i.e. i need something like:

var total = resp.search_books.total;
var pages = Math.max(1, Math.ceil(total/this.pageSize));

Any ideas how best to proceed???

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a43578fe-47e9-4231-bade-908cb07400c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

1 Like

For now i'm just going to go with <<< Previous Next >>> buttons.

if options.length >= pagesize then we have more.
if page > 1, then we have less.

On Tuesday, 21 October 2014 10:28:40 UTC+1, Michael Delaney wrote:

Hi,

I want to page my completion suggester results.

at present I have a request like the following:

var skip = (pageNumber - 1) * this.pageSize;

this.client.suggest({
index: 'books',
type: 'book',
body: {
search_books : {
text : term,
completion : {
from : skip,
size : this.pageSize,
field : "suggested_book"
}
}
}
});

But i dont know how to generate a page as it doesnt return a valid Total.

i.e. i need something like:

var total = resp.search_books.total;
var pages = Math.max(1, Math.ceil(total/this.pageSize));

Any ideas how best to proceed???

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9ac230fb-cf2e-489d-b25c-e80fd008e5a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

1 Like

so "suggest" does not support "from" ??

i guess this feature is not meant to be used with any reasonably sized data
set??

On Tuesday, 21 October 2014 13:19:37 UTC+1, Michael Delaney wrote:

For now i'm just going to go with <<< Previous Next >>> buttons.

if options.length >= pagesize then we have more.
if page > 1, then we have less.

On Tuesday, 21 October 2014 10:28:40 UTC+1, Michael Delaney wrote:

Hi,

I want to page my completion suggester results.

at present I have a request like the following:

var skip = (pageNumber - 1) * this.pageSize;

this.client.suggest({
index: 'books',
type: 'book',
body: {
search_books : {
text : term,
completion : {
from : skip,
size : this.pageSize,
field : "suggested_book"
}
}
}
});

But i dont know how to generate a page as it doesnt return a valid Total.

i.e. i need something like:

var total = resp.search_books.total;
var pages = Math.max(1, Math.ceil(total/this.pageSize));

Any ideas how best to proceed???

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1dc9d938-6ecd-4f7b-96f3-bdbe099d431a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

so "suggest" does not support "from" ??

i guess this feature is not meant to be used with any reasonably sized data
set??

On Tuesday, 21 October 2014 10:28:40 UTC+1, Michael Delaney wrote:

Hi,

I want to page my completion suggester results.

at present I have a request like the following:

var skip = (pageNumber - 1) * this.pageSize;

this.client.suggest({
index: 'books',
type: 'book',
body: {
search_books : {
text : term,
completion : {
from : skip,
size : this.pageSize,
field : "suggested_book"
}
}
}
});

But i dont know how to generate a page as it doesnt return a valid Total.

i.e. i need something like:

var total = resp.search_books.total;
var pages = Math.max(1, Math.ceil(total/this.pageSize));

Any ideas how best to proceed???

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b0663dcd-5f22-4d9d-ade0-952d66e18dab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.