I need to know the count of items in the ES index. Using the Search API, I can take the count from hit.total
part of the response:
"total": {
"value": 467,
"relation": "eq"
}
It's limited on default to 10'000 hits, so when
"total": {
"value": 10000,
"relation": "gte"
}
I know two solutions to get the exact number of this count:
Set
track_total_hits=true
for a request to the Search API. According to the documentation, it comes with the cost.Make another call to Count API.
Do you know which solution is better? In the first option, I'll make only a single HTTP call do the Elastic Search. In the second one, I need two HTTP calls. Do you know if the Count API is significantly better than track_total_hits=true
flag?