"from" without "size" does nothing


(Kenneth Loafman) #1

Hi,

If I execute the following ES returns the correct set of posts, 2000-2024.

#!/bin/bash

curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
-mjson.tool
{
"query" : {
"more_like_this" : {
"fields" : ["content", "title"],
"like_text" : "jetblue blew tire",
"min_term_freq" : 1
},
"from" : 2000,
"size" : 25
}
}
EOF
However, leaving out the "size" (defaulting), always returns posts 0-24,
and ignores the "from" parameter.
#!/bin/bash

curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
-mjson.tool
{
"query" : {
"more_like_this" : {
"fields" : ["content", "title"],
"like_text" : "jetblue blew tire",
"min_term_freq" : 1
},
"from" : 2000
}
}
EOF
Is this expected behavior? I can't find documentation either way.

...Thanks,
...Ken


(Shay Banon) #2

Strange that it works for you, the "from" and "size" should be set on the
same "query" level:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/from_size/.

On Fri, Aug 27, 2010 at 6:43 PM, Kenneth Loafman
kenneth.loafman@gmail.comwrote:

Hi,

If I execute the following ES returns the correct set of posts, 2000-2024.

#!/bin/bash

curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
-mjson.tool
{
"query" : {
"more_like_this" : {
"fields" : ["content", "title"],
"like_text" : "jetblue blew tire",
"min_term_freq" : 1
},
"from" : 2000,
"size" : 25
}
}
EOF
However, leaving out the "size" (defaulting), always returns posts 0-24,
and ignores the "from" parameter.
#!/bin/bash

curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
-mjson.tool
{
"query" : {
"more_like_this" : {
"fields" : ["content", "title"],
"like_text" : "jetblue blew tire",
"min_term_freq" : 1
},
"from" : 2000
}
}
EOF
Is this expected behavior? I can't find documentation either way.

...Thanks,
...Ken


(Kenneth Loafman) #3

They are on the same query level, just not on the same line. The docs
don't say that 'size' is required when 'from' is supplied.

Shay Banon wrote:

Strange that it works for you, the "from" and "size" should be set on
the same "query"
level: http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/from_size/.

On Fri, Aug 27, 2010 at 6:43 PM, Kenneth Loafman
<kenneth.loafman@gmail.com mailto:kenneth.loafman@gmail.com> wrote:

Hi,

If I execute the following ES returns the correct set of posts,
2000-2024.
> #!/bin/bash
>
> curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
> -mjson.tool
> {
>     "query" : {
>         "more_like_this" : {
>             "fields" : ["content", "title"],
>             "like_text" : "jetblue blew tire",
>             "min_term_freq" : 1
>         },
>         "from" : 2000,
>         "size" : 25
>     }
> }
> EOF
However, leaving out the "size" (defaulting), always returns posts 0-24,
and ignores the "from" parameter.
> #!/bin/bash
>
> curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
> -mjson.tool
> {
>     "query" : {
>         "more_like_this" : {
>             "fields" : ["content", "title"],
>             "like_text" : "jetblue blew tire",
>             "min_term_freq" : 1
>         },
>         "from" : 2000
>     }
> }
> EOF
Is this expected behavior?  I can't find documentation either way.

...Thanks,
...Ken

(Shay Banon) #4

Here is how it should look like: http://gist.github.com/553660.

On Fri, Aug 27, 2010 at 7:12 PM, Kenneth Loafman
kenneth.loafman@gmail.comwrote:

They are on the same query level, just not on the same line. The docs
don't say that 'size' is required when 'from' is supplied.

Shay Banon wrote:

Strange that it works for you, the "from" and "size" should be set on
the same "query"
level:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/from_size/
.

On Fri, Aug 27, 2010 at 6:43 PM, Kenneth Loafman
<kenneth.loafman@gmail.com mailto:kenneth.loafman@gmail.com> wrote:

Hi,

If I execute the following ES returns the correct set of posts,
2000-2024.
> #!/bin/bash
>
> curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
> -mjson.tool
> {
>     "query" : {
>         "more_like_this" : {
>             "fields" : ["content", "title"],
>             "like_text" : "jetblue blew tire",
>             "min_term_freq" : 1
>         },
>         "from" : 2000,
>         "size" : 25
>     }
> }
> EOF
However, leaving out the "size" (defaulting), always returns posts

0-24,

and ignores the "from" parameter.
> #!/bin/bash
>
> curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF | python
> -mjson.tool
> {
>     "query" : {
>         "more_like_this" : {
>             "fields" : ["content", "title"],
>             "like_text" : "jetblue blew tire",
>             "min_term_freq" : 1
>         },
>         "from" : 2000
>     }
> }
> EOF
Is this expected behavior?  I can't find documentation either way.

...Thanks,
...Ken

(Kenneth Loafman) #5

OK, that did it. Thanks!

Shay Banon wrote:

Here is how it should look like: http://gist.github.com/553660.

On Fri, Aug 27, 2010 at 7:12 PM, Kenneth Loafman
<kenneth.loafman@gmail.com mailto:kenneth.loafman@gmail.com> wrote:

They are on the same query level, just not on the same line.  The docs
don't say that 'size' is required when 'from' is supplied.

Shay Banon wrote:
> Strange that it works for you, the "from" and "size" should be set on
> the same "query"
> level:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/from_size/.
>
> On Fri, Aug 27, 2010 at 6:43 PM, Kenneth Loafman
> <kenneth.loafman@gmail.com <mailto:kenneth.loafman@gmail.com>
<mailto:kenneth.loafman@gmail.com
<mailto:kenneth.loafman@gmail.com>>> wrote:
>
>     Hi,
>
>     If I execute the following ES returns the correct set of posts,
>     2000-2024.
>     > #!/bin/bash
>     >
>     > curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF |
python
>     > -mjson.tool
>     > {
>     >     "query" : {
>     >         "more_like_this" : {
>     >             "fields" : ["content", "title"],
>     >             "like_text" : "jetblue blew tire",
>     >             "min_term_freq" : 1
>     >         },
>     >         "from" : 2000,
>     >         "size" : 25
>     >     }
>     > }
>     > EOF
>     However, leaving out the "size" (defaulting), always returns
posts 0-24,
>     and ignores the "from" parameter.
>     > #!/bin/bash
>     >
>     > curl -XGET 'http://192.168.1.5:9200/_search' -d @- <<EOF |
python
>     > -mjson.tool
>     > {
>     >     "query" : {
>     >         "more_like_this" : {
>     >             "fields" : ["content", "title"],
>     >             "like_text" : "jetblue blew tire",
>     >             "min_term_freq" : 1
>     >         },
>     >         "from" : 2000
>     >     }
>     > }
>     > EOF
>     Is this expected behavior?  I can't find documentation either way.
>
>     ...Thanks,
>     ...Ken
>
>

(system) #6