I have just installed Elasticsearch 7.8.0 on my laptop as a dev environment. I am using 6.8.10 in production. I have a dataset of around 600,000 documents however when I did a match_all in devtools, its only showing 10,000 hits. Is there a setting I'm missing?
GET igemsbigdata-misc/_search
{
"size": 0,
"query": {
"match_all": {}
}
}
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : null,
"hits" : [ ]
}
}
Discover tells me: 672,750 hits
Sep 29, 2020 @ 02:39:06.615 - Oct 1, 2020 @ 17:56:02.215
To change the time, click the calendar icon in the navigation bar
jsu
October 1, 2020, 11:57am
2
There is indeed a solution to this.
I will link to someone who already wrote about it very well somewhere else:
elasticsearch
But to summarize, you can either use the "track_total_hits": true
variable, like this:
GET <index_name>/_search
{
"size":1,
"track_total_hits": true
}
or use the scroll API, like this:
POST /<index_name>/_search?scroll=1m
{
"size": 100,
"query": {
"match" : {
"title" : "elasticsearch"
}
}
}
I'm not looking to retrieve the query, I need to know the number of documents. When I query the production cluster, it goes like this.
GET igemsbigdata-*/_search
{
"size": 0,
"query": {
"match_all": {}
}
}
And I get.
{
"took": 170,
"timed_out": false,
"_shards": {
"total": 987,
"successful": 987,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 33350663314,
"max_score": 0,
"hits": []
}
}
So I know I have 33,350,663,314. I just need to know the total hits.
system
(system)
Closed
October 30, 2020, 7:25pm
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.