limit removes items from the top

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

limit removes items from the top

paul
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: limit removes items from the top

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


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