Size in filtered query

Hi,

I am very new to ElasticSearch but just ran into something interesting
and wanted to check and see if the behavior is expected.

When I do a filtered query like the one below:

{
"query" :
{
"filtered" : {
"query" : {
"term" : { "tag" : "wow" }
},
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
},
"from" : 0, "size" : 100,
}

it ignores "from" and "size" but if I move them to the top:

{
"from" : 0, "size" : 100,
"query" :
{
"filtered" : {
"query" : {
"term" : { "tag" : "wow" }
},
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
}
}

it works great. The interesting thing is that if I just do a filter
then putting size and from after the filter works fine:

{
"query" :
{
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
"from" : 0, "size" : 100
}

100 results starting from 0 are returned as expected.

Anyway, it is easy enough to modify the php class to make sure from
and size always come first in the array, but I figured I would share
my findings.

Hard to tell based on what you posted since it looses the formatting, but just double checked with 0.14.x and master and this ones works well: gist:808101 · GitHub.
On Wednesday, February 2, 2011 at 6:50 PM, SkyStebnicki wrote:

Hi,

I am very new to Elasticsearch but just ran into something interesting
and wanted to check and see if the behavior is expected.

When I do a filtered query like the one below:

{
"query" :
{
"filtered" : {
"query" : {
"term" : { "tag" : "wow" }
},
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
},
"from" : 0, "size" : 100,
}

it ignores "from" and "size" but if I move them to the top:

{
"from" : 0, "size" : 100,
"query" :
{
"filtered" : {
"query" : {
"term" : { "tag" : "wow" }
},
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
}
}

it works great. The interesting thing is that if I just do a filter
then putting size and from after the filter works fine:

{
"query" :
{
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
"from" : 0, "size" : 100
}

100 results starting from 0 are returned as expected.

Anyway, it is easy enough to modify the php class to make sure from
and size always come first in the array, but I figured I would share
my findings.

Interesting... I wonder if it is something local in my environment: freebsd 8.

Anyway, it was easy enough to reorder to array to put size and from at the top so it's not a problem for us.

I am the founder of a software company (Aereus) specializing in SaaS solutions in the area of CRM, GroupWare, Project Manager and more for small businesses. For the last 6 months we have been testing indexing solutions because the SQL database is getting way too big to query. ElasticSearch is by far the most impressive product I have worked with so far. Great job!

Sky

Interesting... I wonder if it is something local in my environment:
freebsd 8 and ES 0.14.

Anyway, it was easy enough to reorder to array to put size and from at
the top so it's not a problem for us.

I am the founder of a software company (Aereus) specializing in SaaS
solutions in the area of CRM, GroupWare, Project Manager and more for
small businesses. For the last 6 months we have been testing indexing
solutions because the SQL database is getting way too big to query.
Elasticsearch is by far the most impressive product I have worked with
so far. Great job!

Sky

On Feb 2, 10:16 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Hard to tell based on what you posted since it looses the formatting, but just double checked with 0.14.x and master and this ones works well:gist:808101 · GitHub.

On Wednesday, February 2, 2011 at 6:50 PM, SkyStebnicki wrote:

Hi,

I am very new to Elasticsearch but just ran into something interesting
and wanted to check and see if the behavior is expected.

When I do a filtered query like the one below:

{
"query" :
{
"filtered" : {
"query" : {
"term" : { "tag" : "wow" }
},
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
},
"from" : 0, "size" : 100,
}

it ignores "from" and "size" but if I move them to the top:

{
"from" : 0, "size" : 100,
"query" :
{
"filtered" : {
"query" : {
"term" : { "tag" : "wow" }
},
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
}
}

it works great. The interesting thing is that if I just do a filter
then putting size and from after the filter works fine:

{
"query" :
{
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
}
}
"from" : 0, "size" : 100
}

100 results starting from 0 are returned as expected.

Anyway, it is easy enough to modify the php class to make sure from
and size always come first in the array, but I figured I would share
my findings.