Limit removes items from the top


(paul) #1

when i query without limit i get 6 result as

tution: 16512
tution: 17632
tution: 17822
tution: 17870
tution: 19683
tution: 19838

when i add limit like in the query below the 1st element is lost , limit
should remove the last element

{
"query": {
"filtered": {
"query": {
"match": {
"programs": "computer science"
}
},
"filter": {
"and": [
{
"limit": {
"value": 5
}
},
{
"range": {
"tution": {
"from": 10000,
"to": 20000
}
}
}
]
}
}
},
"sort": [
{
"tution": {
"order": "asc"
}
}
]
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

Have you looked into using the size parameter of the query? Much simpler
solution.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-from-size.html

I never used the limit filter, but it looks more useful for doing
statistics on a limited subsection of the index.

Cheers,

Ivan

On Fri, Nov 22, 2013 at 2:41 AM, paul avinashpaul85@gmail.com wrote:

when i query without limit i get 6 result as

tution: 16512
tution: 17632
tution: 17822
tution: 17870
tution: 19683
tution: 19838

when i add limit like in the query below the 1st element is lost , limit
should remove the last element

{
"query": {
"filtered": {
"query": {
"match": {
"programs": "computer science"
}
},
"filter": {
"and": [
{
"limit": {
"value": 5
}
},
{
"range": {
"tution": {
"from": 10000,
"to": 20000
}
}
}
]
}
}
},
"sort": [
{
"tution": {
"order": "asc"
}
}
]
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3