-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get total index records for datatables #283
Comments
There's not much going on, but it's certainly not yet necrotic... anyhow, you can count using the regular query builder count API: $totalDocuments = $this->Comments->find()->count(); If you need to refresh in before hand: $this->Comments->getConnection()->getIndex($this->Comments->getName())->refresh(); |
Thanks for responding. I only said that because I was searching closed issues for the answer to this and noticed most were marked stale by the bot. Meant no disrespect at all. I tried |
That's the default limit that Elasticsearch imposes, AFAIK it applies to the As of ES 7 the $type = $this->Comments
->getConnection()
->getIndex($this->Comments->getName())
->getType($this->Comments->getType());
$query = $this->Comments
->find()
->limit(0)
->compileQuery()
->setParam('track_total_hits', true);
$totalDocuments = $type->search($query)->getTotalHits(); |
I recommend inheriting Then you can override method
|
This issue is stale because it has been open for 120 days with no activity. Remove the |
I know this repo is all but dead, but i was curious if anyone figured out how to get the total count of records in index. Using the elastic libraries without cake, i just left query empty, specified the index and pulled count. That doesn't seem to work with this library wrapper for elastic.
The text was updated successfully, but these errors were encountered: