Size parameter isn't working

The size parameter isn't working on either a query based or uri
search. "hits" will give me the correct number or results (say,
something like 27), but I still only get the first 10 results.

I'm using the following:

curl -XGET 'http://localhost:9200/indexname/indextype/_search' -d '{
"from" : 0, "size" : 100,
"query" : {
"terms" : {
"term1" : "value1",
"term2" : "value2"
}
}
}

OR

curl -XGET 'http://localhost:9200/indexname/indextype/_search?
q=term:value,size=100'

Any ideas or help would be very much appreciated.

The first curl looks good, do you get total_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.

On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:

The size parameter isn't working on either a query based or uri
search. "hits" will give me the correct number or results (say,
something like 27), but I still only get the first 10 results.

I'm using the following:

curl -XGET 'http://localhost:9200/indexname/indextype/_search' -d '{
"from" : 0, "size" : 100,
"query" : {
"terms" : {
"term1" : "value1",
"term2" : "value2"
}
}
}

OR

curl -XGET 'http://localhost:9200/indexname/indextype/_search?
q=term:value,size=100'

Any ideas or help would be very much appreciated.

Actually, the first curl causes elasticsearch to throw an "unable to
parse" error. Am I improperly constructing a multi-term query? Is my
syntax wrong? Yes, total_hits comes back as a number higher than 10 (I
believe it was 14 in my example), but the number of matching records
being returned is still only 10. I'm unable to post a repro from my
current location, but I will be able to tomorrow morning. I believe
that was primarily occurring on my second curl (and you've explained
why that is happening) though as the first one was giving me a parsing
error. Is there any way to to a multi-term query with the URI format
with something like: q=term:value, term2=value2&size=100 or is that
not possible? I'm new to this, so getting a good grasp on the syntax
is still an issue.

On Jun 25, 5:47 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

The first curl looks good, do you get total_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.

On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:

The size parameter isn't working on either a query based or uri
search. "hits" will give me the correct number or results (say,
something like 27), but I still only get the first 10 results.

I'm using the following:

curl -XGET 'http://localhost:9200/indexname/indextype/_search'-d '{
"from" : 0, "size" : 100,
"query" : {
"terms" : {
"term1" : "value1",
"term2" : "value2"
}
}
}

OR

curl -XGET 'http://localhost:9200/indexname/indextype/_search?
q=term:value,size=100'

Any ideas or help would be very much appreciated.

Yes, your first curl is not correct when it comes to the query structure. What do you mean by doing a query like term:value? You mean field:value? You want to query several fields?

On Sunday, June 26, 2011 at 4:46 AM, Josh JRG wrote:

Actually, the first curl causes elasticsearch to throw an "unable to
parse" error. Am I improperly constructing a multi-term query? Is my
syntax wrong? Yes, total_hits comes back as a number higher than 10 (I
believe it was 14 in my example), but the number of matching records
being returned is still only 10. I'm unable to post a repro from my
current location, but I will be able to tomorrow morning. I believe
that was primarily occurring on my second curl (and you've explained
why that is happening) though as the first one was giving me a parsing
error. Is there any way to to a multi-term query with the URI format
with something like: q=term:value, term2=value2&size=100 or is that
not possible? I'm new to this, so getting a good grasp on the syntax
is still an issue.

On Jun 25, 5:47 pm, Shay Banon <shay.ba...@elasticsearch.com (http://elasticsearch.com)> wrote:

The first curl looks good, do you get total_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.

On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:

The size parameter isn't working on either a query based or uri
search. "hits" will give me the correct number or results (say,
something like 27), but I still only get the first 10 results.

I'm using the following:

curl -XGET 'http://localhost:9200/indexname/indextype/_search'-d '{
"from" : 0, "size" : 100,
"query" : {
"terms" : {
"term1" : "value1",
"term2" : "value2"
}
}
}

OR

curl -XGET 'http://localhost:9200/indexname/indextype/_search?
q=term:value,size=100'

Any ideas or help would be very much appreciated.

Hi Josh

I'm using the following:

curl -XGET 'http://localhost:9200/indexname/indextype/_search' -d '{
"from" : 0, "size" : 100,
"query" : {
"terms" : {
"term1" : "value1",
"term2" : "value2"
}
}
}

The problem is not with the size parameter, but with your query:

Try this instead:

curl -XGET 'http://127.0.0.1:9200/indexname/indextype/_search?pretty=1' -d '
{
"from" : 0,
"query" : {
"bool" : {
"must" : [
{
"text" : {
"term1" : "value1"
}
},
{
"text" : {
"term2" : "value2"
}
}
]
}
},
"size" : 100
}
'

Note: I have used a 'text' query instead of a 'term' query, because a
term query is probably not what you are after. Term queries only match
if exactly the same term is stored in your database, eg "Foo" won't
match "foo".

If you haven't actually specified {index: "not_analyzed"} on your term1
and term2 fields, then they are probably set to be analyzed (ie treated
as full text, not discrete terms).

Either way, the 'text' query will do the right thing: if the field is
analyzed, then it will treat it as a full text search, and if it is
not_analyzed, then it will do a term query instead.

clint

Yes, I'm trying to query several fields. I've got several vignettes,
each with a defined set of metadata indexed in ES and I'm trying to
query one or more of those common fields, so yes I was to do
field:value. I think Clint may have provided me with an answer. I'll
try out what you guys have suggested and come back with results.
Thanks.

On Jun 26, 5:36 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Yes, your first curl is not correct when it comes to the query structure. What do you mean by doing a query like term:value? You mean field:value? You want to query several fields?

On Sunday, June 26, 2011 at 4:46 AM, Josh JRG wrote:

Actually, the first curl causes elasticsearch to throw an "unable to
parse" error. Am I improperly constructing a multi-term query? Is my
syntax wrong? Yes, total_hits comes back as a number higher than 10 (I
believe it was 14 in my example), but the number of matching records
being returned is still only 10. I'm unable to post a repro from my
current location, but I will be able to tomorrow morning. I believe
that was primarily occurring on my second curl (and you've explained
why that is happening) though as the first one was giving me a parsing
error. Is there any way to to a multi-term query with the URI format
with something like: q=term:value, term2=value2&size=100 or is that
not possible? I'm new to this, so getting a good grasp on the syntax
is still an issue.

On Jun 25, 5:47 pm, Shay Banon <shay.ba...@elasticsearch.com (http://elasticsearch.com)> wrote:

The first curl looks good, do you get total_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.

On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:

The size parameter isn't working on either a query based or uri
search. "hits" will give me the correct number or results (say,
something like 27), but I still only get the first 10 results.

I'm using the following:

curl -XGET 'http://localhost:9200/indexname/indextype/_search'-d'{
"from" : 0, "size" : 100,
"query" : {
"terms" : {
"term1" : "value1",
"term2" : "value2"
}
}
}

OR

curl -XGET 'http://localhost:9200/indexname/indextype/_search?
q=term:value,size=100'

Any ideas or help would be very much appreciated.

The text query actually didn't work. I'm looking to exactly match two
or more field : value pairs I know to be present in at least one of my
indexed items and a text search gives me back 0 hits.

Here's what I used:

curl -XGET 'http://127.0.0.1:9200/mindseye/vignette/_search' -d '{
"from" : 0, "size" : 100,
"query" : {
"bool : {
"must" : [
{ "text" : { "bucket" : "minds-eye-vignette-repository" } },
{ "text" : { "setting" : "urban9" } }
]
}
}
}'

As I said, I know that that combination should give me back at least 2
hits, but I'm currently getting nothing.

On Jun 26, 6:20 am, Clinton Gormley clin...@iannounce.co.uk wrote:

Hi Josh

I'm using the following:

curl -XGET 'http://localhost:9200/indexname/indextype/_search'-d '{
"from" : 0, "size" : 100,
"query" : {
"terms" : {
"term1" : "value1",
"term2" : "value2"
}
}
}

The problem is not with the size parameter, but with your query:

Try this instead:

curl -XGET 'http://127.0.0.1:9200/indexname/indextype/_search?pretty=1' -d '
{
"from" : 0,
"query" : {
"bool" : {
"must" : [
{
"text" : {
"term1" : "value1"
}
},
{
"text" : {
"term2" : "value2"
}
}
]
}
},
"size" : 100}

'

Note: I have used a 'text' query instead of a 'term' query, because a
term query is probably not what you are after. Term queries only match
if exactly the same term is stored in your database, eg "Foo" won't
match "foo".

If you haven't actually specified {index: "not_analyzed"} on your term1
and term2 fields, then they are probably set to be analyzed (ie treated
as full text, not discrete terms).

Either way, the 'text' query will do the right thing: if the field is
analyzed, then it will treat it as a full text search, and if it is
not_analyzed, then it will do a term query instead.

clint

On Sun, 2011-06-26 at 08:29 -0700, Josh JRG wrote:

The text query actually didn't work. I'm looking to exactly match two
or more field : value pairs I know to be present in at least one of my
indexed items and a text search gives me back 0 hits.

Here's what I used:

curl -XGET 'http://127.0.0.1:9200/mindseye/vignette/_search' -d '{
"from" : 0, "size" : 100,
"query" : {
"bool : {
"must" : [
{ "text" : { "bucket" : "minds-eye-vignette-repository" } },
{ "text" : { "setting" : "urban9" } }
]
}
}
}'

As I said, I know that that combination should give me back at least 2
hits, but I'm currently getting nothing.

I assume that in your actual test you quote "bool" correctly?

I suggest that you gist (see Elasticsearch Platform — Find real-time answers at scale | Elastic ) a
complete recreation of what you're doing, otherwise it is difficult to
figure out where you are going wrong

clint

Nevermind, there was a copy and paste error (not the end quote on
bool) that I kept replicating. The multi-field text search seems to
work perfectly. Thanks Clint. I am very grateful for your help.

On Jun 26, 11:39 am, Clinton Gormley clin...@iannounce.co.uk wrote:

On Sun, 2011-06-26 at 08:29 -0700, Josh JRG wrote:

The text query actually didn't work. I'm looking to exactly match two
or more field : value pairs I know to be present in at least one of my
indexed items and a text search gives me back 0 hits.

Here's what I used:

curl -XGET 'http://127.0.0.1:9200/mindseye/vignette/_search'-d '{
"from" : 0, "size" : 100,
"query" : {
"bool : {
"must" : [
{ "text" : { "bucket" : "minds-eye-vignette-repository" } },
{ "text" : { "setting" : "urban9" } }
]
}
}
}'

As I said, I know that that combination should give me back at least 2
hits, but I'm currently getting nothing.

I assume that in your actual test you quote "bool" correctly?

I suggest that you gist (seehttp://www.elasticsearch.org/help) a
complete recreation of what you're doing, otherwise it is difficult to
figure out where you are going wrong

clint

Thanks to you too Shay.

On Jun 26, 5:36 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Yes, your first curl is not correct when it comes to the query structure. What do you mean by doing a query like term:value? You mean field:value? You want to query several fields?

On Sunday, June 26, 2011 at 4:46 AM, Josh JRG wrote:

Actually, the first curl causes elasticsearch to throw an "unable to
parse" error. Am I improperly constructing a multi-term query? Is my
syntax wrong? Yes, total_hits comes back as a number higher than 10 (I
believe it was 14 in my example), but the number of matching records
being returned is still only 10. I'm unable to post a repro from my
current location, but I will be able to tomorrow morning. I believe
that was primarily occurring on my second curl (and you've explained
why that is happening) though as the first one was giving me a parsing
error. Is there any way to to a multi-term query with the URI format
with something like: q=term:value, term2=value2&size=100 or is that
not possible? I'm new to this, so getting a good grasp on the syntax
is still an issue.

On Jun 25, 5:47 pm, Shay Banon <shay.ba...@elasticsearch.com (http://elasticsearch.com)> wrote:

The first curl looks good, do you get total_hits that is higher then 10, and you say you only get 10 back? Can you gist a repro in this case? The second curl is wrong since size is another parameter, and should be separated using & from the q parameter.

On Saturday, June 25, 2011 at 11:00 PM, Josh JRG wrote:

The size parameter isn't working on either a query based or uri
search. "hits" will give me the correct number or results (say,
something like 27), but I still only get the first 10 results.

I'm using the following:

curl -XGET 'http://localhost:9200/indexname/indextype/_search'-d'{
"from" : 0, "size" : 100,
"query" : {
"terms" : {
"term1" : "value1",
"term2" : "value2"
}
}
}

OR

curl -XGET 'http://localhost:9200/indexname/indextype/_search?
q=term:value,size=100'

Any ideas or help would be very much appreciated.