{"action":"created","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSElasticaBundle/issues/1322","repository_url":"https://api.github.com/repos/FriendsOfSymfony/FOSElasticaBundle","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSElasticaBundle/issues/1322/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSElasticaBundle/issues/1322/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSElasticaBundle/issues/1322/events","html_url":"https://github.com/FriendsOfSymfony/FOSElasticaBundle/issues/1322","id":280451254,"number":1322,"title":"No search type for [count]","user":{"login":"MaximeMaillet","id":14997660,"avatar_url":"https://avatars2.githubusercontent.com/u/14997660?v=4","gravatar_id":"","url":"https://api.github.com/users/MaximeMaillet","html_url":"https://github.com/MaximeMaillet","followers_url":"https://api.github.com/users/MaximeMaillet/followers","following_url":"https://api.github.com/users/MaximeMaillet/following{/other_user}","gists_url":"https://api.github.com/users/MaximeMaillet/gists{/gist_id}","starred_url":"https://api.github.com/users/MaximeMaillet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaximeMaillet/subscriptions","organizations_url":"https://api.github.com/users/MaximeMaillet/orgs","repos_url":"https://api.github.com/users/MaximeMaillet/repos","events_url":"https://api.github.com/users/MaximeMaillet/events{/privacy}","received_events_url":"https://api.github.com/users/MaximeMaillet/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-12-08T10:58:35Z","updated_at":"2017-12-17T03:37:11Z","closed_at":"2017-12-17T03:37:11Z","author_association":"NONE","body":"Hi, I have problem on **ES 5.0** with that.\r\n\r\n```php\r\nTransformedFinder $finder = [...];\r\n$return = $finder->createPaginatorAdapter(\r\n    $this->getQuery() // My query whatever\r\n);\r\n\r\nreturn $return->getTotalHits();\r\n```\r\n\r\nBecause `getTotalHits()` send GET request like this `/{index}/{node}/_search?search_type=count`\r\n\r\n`search_type=count`deprecated in ES 2.0 and removed in 5.0\r\nhttps://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-request-search-type.html\r\n\r\nInstead of `/{index}/{node}/_count` for get total hits.\r\n\r\nThis is a trick, waiting ruflin update.\r\n\r\n_FOS\\ElasticaBundle\\Paginator\\RawPaginatorAdapter_\r\n```php\r\npublic function getTotalHits($genuineTotal = false)\r\n{\r\n        if (! isset($this->totalHits)) {\r\n            $this->getResults(0,1);\r\n            //$this->totalHits = $this->searchable->count($this->query);\r\n        }\r\n\r\n        return $this->query->hasParam('size') && !$genuineTotal\r\n            ? min($this->totalHits, (integer) $this->query->getParam('size'))\r\n            : $this->totalHits;\r\n}\r\n```\r\n\r\nOr, in personal code\r\n\r\n```php\r\nTransformedFinder $finder = [...];\r\n$return = $finder->createPaginatorAdapter(\r\n    $this->getQuery() // My query whatever\r\n);\r\n$return->getResult(0,1);\r\nreturn $return->getTotalHits();\r\n```\r\n\r\nThis is not a good solution, just a trick who can damage performence.\r\n\r\nEdit: fix with [ruflin](https://github.com/ruflin/Elastica) 5.0.0"},"comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSElasticaBundle/issues/comments/352229454","html_url":"https://github.com/FriendsOfSymfony/FOSElasticaBundle/issues/1322#issuecomment-352229454","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSElasticaBundle/issues/1322","id":352229454,"user":{"login":"Tobion","id":610090,"avatar_url":"https://avatars3.githubusercontent.com/u/610090?v=4","gravatar_id":"","url":"https://api.github.com/users/Tobion","html_url":"https://github.com/Tobion","followers_url":"https://api.github.com/users/Tobion/followers","following_url":"https://api.github.com/users/Tobion/following{/other_user}","gists_url":"https://api.github.com/users/Tobion/gists{/gist_id}","starred_url":"https://api.github.com/users/Tobion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tobion/subscriptions","organizations_url":"https://api.github.com/users/Tobion/orgs","repos_url":"https://api.github.com/users/Tobion/repos","events_url":"https://api.github.com/users/Tobion/events{/privacy}","received_events_url":"https://api.github.com/users/Tobion/received_events","type":"User","site_admin":false},"created_at":"2017-12-17T03:37:11Z","updated_at":"2017-12-17T03:37:11Z","author_association":"MEMBER","body":"As you found out, you need to use the upcoming 5.0 version with elasticsearch 5. See #1356 for documenting these dependencies."}}
{"actor":{"display_login":"Tobion"}}