How to sort and then apply a limit filter

Hi,

I want to sort the results according to a specific field AND THEN apply the
limit filter.

A simple example would be to sort a user model by full_name and then apply
the limit say top 100. In this case, however there is no query - get all
the values, hence no score.

However, this is not happening in Elastic search. It first applies the
limit AND THEN sorts which is giving me undesired results. Can anyone point
me what I am doing wrong ?

{
"sort": [
"full_name"
],
"filter": {
"limit": {
"value": 100
}
}
}

Thanks,
Bragboy

--

Hi,
Unless I'm confused, I think you're simply looking for the size parameter:

Combined with a match all query and your existing sort:

The limit filter is somewhat special case behavior that grabs a sampling of
docs and then applies the search.

Best Regards,
Paul

On Thursday, October 4, 2012 2:10:49 PM UTC-6, bragboy wrote:

Hi,

I want to sort the results according to a specific field AND THEN apply
the limit filter.

A simple example would be to sort a user model by full_name and then apply
the limit say top 100. In this case, however there is no query - get all
the values, hence no score.

However, this is not happening in Elastic search. It first applies the
limit AND THEN sorts which is giving me undesired results. Can anyone point
me what I am doing wrong ?

{
"sort": [
"full_name"
],
"filter": {
"limit": {
"value": 100
}
}
}

Thanks,
Bragboy

--