Missing results from es when using simple curl


(Dinesh Sriram) #1

I am trying out elastic search for the first time. I just have 1 node and 1
index.

curl -XPUT http://localhost:9200/testing/dummy/1 -d '{
"snapshotTime" : "2012-10-31T13:31:21",
"ratio" : "50",
"description" : "sample description"

}'

I have indexed 500 such dummies to index 'testing'.
http://localhost:9200/testing/dummy/1
.
.
.
.
http://localhost:9200/testing/dummy/500

Now, when I tried a matchAll query with this data set,

curl -XGET 'http://localhost:9202/_all/_search?pretty=true' -d '
{
"query" : {
"matchAll" : {}
}
}'
I get back only 10 results and they are random every time. However, the
total hits remain 500. The hits array only contain 10 entries. Am I missing
something?

Thanks.

--


(Radu Gheorghe) #2

Hello,

You can specify how many results you get back via "size":
http://www.elasticsearch.org/guide/reference/api/search/from-size.html

Best regards,
Radu
On Nov 6, 2012 9:07 PM, "Dinesh Sriram" dineshsriram1989@gmail.com wrote:

I am trying out elastic search for the first time. I just have 1 node and
1 index.

curl -XPUT http://localhost:9200/testing/dummy/1 -d '{
"snapshotTime" : "2012-10-31T13:31:21",
"ratio" : "50",
"description" : "sample description"

}'

I have indexed 500 such dummies to index 'testing'.
http://localhost:9200/testing/dummy/1
.
.
.
.
http://localhost:9200/testing/dummy/500

Now, when I tried a matchAll query with this data set,

curl -XGET 'http://localhost:9202/_all/_search?pretty=true' -d '
{
"query" : {
"matchAll" : {}
}
}'
I get back only 10 results and they are random every time. However, the
total hits remain 500. The hits array only contain 10 entries. Am I missing
something?

Thanks.

--

--


(Dinesh Sriram) #3

Thanks. Is there any maximum limit on the size?

On Tuesday, November 6, 2012 2:26:36 PM UTC-5, Radu Gheorghe wrote:

Hello,

You can specify how many results you get back via "size":
http://www.elasticsearch.org/guide/reference/api/search/from-size.html

Best regards,
Radu
On Nov 6, 2012 9:07 PM, "Dinesh Sriram" <dineshsr...@gmail.com<javascript:>>
wrote:

I am trying out elastic search for the first time. I just have 1 node and
1 index.

curl -XPUT http://localhost:9200/testing/dummy/1 -d '{
"snapshotTime" : "2012-10-31T13:31:21",
"ratio" : "50",
"description" : "sample description"

}'

I have indexed 500 such dummies to index 'testing'.
http://localhost:9200/testing/dummy/1
.
.
.
.
http://localhost:9200/testing/dummy/500

Now, when I tried a matchAll query with this data set,

curl -XGET 'http://localhost:9202/_all/_search?pretty=true' -d '
{
"query" : {
"matchAll" : {}
}
}'
I get back only 10 results and they are random every time. However, the
total hits remain 500. The hits array only contain 10 entries. Am I missing
something?

Thanks.

--

--


(David Pilato) #4

If you need to export your results (for big sizes), you should look at the scan&scroll features.
http://www.elasticsearch.org/guide/reference/api/search/search-type.html
http://www.elasticsearch.org/guide/reference/api/search/scroll.html

HTH

David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 nov. 2012 à 20:30, Dinesh Sriram dineshsriram1989@gmail.com a écrit :

Thanks. Is there any maximum limit on the size?

On Tuesday, November 6, 2012 2:26:36 PM UTC-5, Radu Gheorghe wrote:

Hello,

You can specify how many results you get back via "size":
http://www.elasticsearch.org/guide/reference/api/search/from-size.html

Best regards,
Radu

On Nov 6, 2012 9:07 PM, "Dinesh Sriram" dineshsr...@gmail.com wrote:

I am trying out elastic search for the first time. I just have 1 node and 1 index.

curl -XPUT http://localhost:9200/testing/dummy/1 -d '{
"snapshotTime" : "2012-10-31T13:31:21",
"ratio" : "50",
"description" : "sample description"

}'

I have indexed 500 such dummies to index 'testing'.
http://localhost:9200/testing/dummy/1
.
.
.
.
http://localhost:9200/testing/dummy/500

Now, when I tried a matchAll query with this data set,

curl -XGET 'http://localhost:9202/_all/_search?pretty=true' -d '
{
"query" : {
"matchAll" : {}
}
}'
I get back only 10 results and they are random every time. However, the total hits remain 500. The hits array only contain 10 entries. Am I missing something?

Thanks.

--

--


(Radu Gheorghe) #5

Hello Dinesh,

I'm not sure, but I think it's MAX_INT-1 or something like that. But
if you want to go through a lot of results, you almost certainly would
be better off if you set your type of search to scan[0] and then
scroll[1] through the results.

That said, the scan type doesn't support sorting[2].

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

[0] http://www.elasticsearch.org/guide/reference/api/search/search-type.html
[1] http://www.elasticsearch.org/guide/reference/api/search/scroll.html
[2] http://www.elasticsearch.org/guide/reference/api/search/sort.html

On Tue, Nov 6, 2012 at 9:30 PM, Dinesh Sriram
dineshsriram1989@gmail.com wrote:

Thanks. Is there any maximum limit on the size?

On Tuesday, November 6, 2012 2:26:36 PM UTC-5, Radu Gheorghe wrote:

Hello,

You can specify how many results you get back via "size":
http://www.elasticsearch.org/guide/reference/api/search/from-size.html

Best regards,
Radu

On Nov 6, 2012 9:07 PM, "Dinesh Sriram" dineshsr...@gmail.com wrote:

I am trying out elastic search for the first time. I just have 1 node and
1 index.

curl -XPUT http://localhost:9200/testing/dummy/1 -d '{
"snapshotTime" : "2012-10-31T13:31:21",
"ratio" : "50",
"description" : "sample description"

}'

I have indexed 500 such dummies to index 'testing'.
http://localhost:9200/testing/dummy/1
.
.
.
.
http://localhost:9200/testing/dummy/500

Now, when I tried a matchAll query with this data set,

curl -XGET 'http://localhost:9202/_all/_search?pretty=true' -d '
{
"query" : {
"matchAll" : {}
}
}'
I get back only 10 results and they are random every time. However, the
total hits remain 500. The hits array only contain 10 entries. Am I missing
something?

Thanks.

--

--

--


(Dinesh Sriram) #6

Thank you David and Radu. I will look into that.

On Wednesday, November 7, 2012 2:44:57 AM UTC-5, Radu Gheorghe wrote:

Hello Dinesh,

I'm not sure, but I think it's MAX_INT-1 or something like that. But
if you want to go through a lot of results, you almost certainly would
be better off if you set your type of search to scan[0] and then
scroll[1] through the results.

That said, the scan type doesn't support sorting[2].

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

[0]
http://www.elasticsearch.org/guide/reference/api/search/search-type.html
[1] http://www.elasticsearch.org/guide/reference/api/search/scroll.html
[2] http://www.elasticsearch.org/guide/reference/api/search/sort.html

On Tue, Nov 6, 2012 at 9:30 PM, Dinesh Sriram
<dineshsr...@gmail.com <javascript:>> wrote:

Thanks. Is there any maximum limit on the size?

On Tuesday, November 6, 2012 2:26:36 PM UTC-5, Radu Gheorghe wrote:

Hello,

You can specify how many results you get back via "size":
http://www.elasticsearch.org/guide/reference/api/search/from-size.html

Best regards,
Radu

On Nov 6, 2012 9:07 PM, "Dinesh Sriram" dineshsr...@gmail.com wrote:

I am trying out elastic search for the first time. I just have 1 node
and

1 index.

curl -XPUT http://localhost:9200/testing/dummy/1 -d '{
"snapshotTime" : "2012-10-31T13:31:21",
"ratio" : "50",
"description" : "sample description"

}'

I have indexed 500 such dummies to index 'testing'.
http://localhost:9200/testing/dummy/1
.
.
.
.
http://localhost:9200/testing/dummy/500

Now, when I tried a matchAll query with this data set,

curl -XGET 'http://localhost:9202/_all/_search?pretty=true' -d '
{
"query" : {
"matchAll" : {}
}
}'
I get back only 10 results and they are random every time. However,
the

total hits remain 500. The hits array only contain 10 entries. Am I
missing

something?

Thanks.

--

--

--


(system) #7