Search result hit total


(gitfy) #1

When i do a search, i get the results as

{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 26,
"max_score" : 1.0,

.....

}

Even though the hits.total says 26, i get back only 10 records. is
there a max cap on how many records that is returned, if so, how to
iterate for more results.

can this be specified in the query with some limit parameter on how
records to return ?


(Clinton Gormley) #2

Even though the hits.total says 26, i get back only 10 records. is
there a max cap on how many records that is returned, if so, how to
iterate for more results.

can this be specified in the query with some limit parameter on how
records to return ?

all explained in the docs:
http://www.elasticsearch.org/guide/reference/api/search/

clint


(danoyoung) #3

By default only 10 rows are returned.....you can pass in the size:

http://www.elasticsearch.org/guide/reference/api/search/from-size.html

On Mon, Apr 11, 2011 at 11:58 AM, gitfy lenin.kumar.s@gmail.com wrote:

When i do a search, i get the results as

{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 26,
"max_score" : 1.0,

.....

}

Even though the hits.total says 26, i get back only 10 records. is
there a max cap on how many records that is returned, if so, how to
iterate for more results.

can this be specified in the query with some limit parameter on how
records to return ?


(gitfy) #4

Thanks...that helps.

On Apr 11, 11:04 am, Dan Young danoyo...@gmail.com wrote:

By default only 10 rows are returned.....you can pass in the size:

http://www.elasticsearch.org/guide/reference/api/search/from-size.html

On Mon, Apr 11, 2011 at 11:58 AM, gitfy lenin.kuma...@gmail.com wrote:

When i do a search, i get the results as

{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 26,
"max_score" : 1.0,

.....

}

Even though the hits.total says 26, i get back only 10 records. is
there a max cap on how many records that is returned, if so, how to
iterate for more results.

can this be specified in the query with some limit parameter on how
records to return ?


(gitfy) #5

One more question on this regard.....

$ curl -XGET 'http://localhost:9200/twitter/tweet,user/_count?
q=user:kimchy'

when i use the count feature, it provide the total matches across the
types, but it would nice if it could tell how many in the individual
types (instead of firing separate queries for each types).

Also, when i use the from and size, to search among different types,
is there a possibility to size number of records for each types ?

Otherwise, the global search doesn't really make much sense, if one
has to exhaust all the records of a particular type before looking
into another type....

On Apr 11, 11:21 am, gitfy lenin.kuma...@gmail.com wrote:

Thanks...that helps.

On Apr 11, 11:04 am, Dan Young danoyo...@gmail.com wrote:

By default only 10 rows are returned.....you can pass in the size:

http://www.elasticsearch.org/guide/reference/api/search/from-size.html

On Mon, Apr 11, 2011 at 11:58 AM, gitfy lenin.kuma...@gmail.com wrote:

When i do a search, i get the results as

{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 26,
"max_score" : 1.0,

.....

}

Even though the hits.total says 26, i get back only 10 records. is
there a max cap on how many records that is returned, if so, how to
iterate for more results.

can this be specified in the query with some limit parameter on how
records to return ?


(Lukáš Vlček) #6

Hi,

On Mon, Apr 11, 2011 at 11:27 PM, gitfy lenin.kumar.s@gmail.com wrote:

One more question on this regard.....

$ curl -XGET 'http://localhost:9200/twitter/tweet,user/_count?
q=user:kimchy'

when i use the count feature, it provide the total matches across the
types, but it would nice if it could tell how many in the individual
types (instead of firing separate queries for each types).

You can use facets for this on top of _index or _type fields:
http://www.elasticsearch.org/guide/reference/mapping/index-field.html
http://www.elasticsearch.org/guide/reference/mapping/type-field.html

Also, when i use the from and size, to search among different types,
is there a possibility to size number of records for each types ?

You want to tell ES that you want it to include 2 documents from index A and
8 documents from index B into the first 10 most relevant results? This is
not possible.

Otherwise, the global search doesn't really make much sense, if one
has to exhaust all the records of a particular type before looking
into another type....

On Apr 11, 11:21 am, gitfy lenin.kuma...@gmail.com wrote:

Thanks...that helps.

On Apr 11, 11:04 am, Dan Young danoyo...@gmail.com wrote:

By default only 10 rows are returned.....you can pass in the size:

http://www.elasticsearch.org/guide/reference/api/search/from-size.html

On Mon, Apr 11, 2011 at 11:58 AM, gitfy lenin.kuma...@gmail.com
wrote:

When i do a search, i get the results as

{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 26,
"max_score" : 1.0,

.....

}

Even though the hits.total says 26, i get back only 10 records. is
there a max cap on how many records that is returned, if so, how to
iterate for more results.

can this be specified in the query with some limit parameter on how
records to return ?

Regards,
Lukas


(system) #7