Try to use this below code :
Method 1 :
$product_id = '1';
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$rating = $objectManager->create('\Magento\Review\Model\Rating');
$review = $objectManager->create('\Magento\Review\Model\Review');
$storeManager = $objectManager->create("\Magento\Store\Model\StoreManagerInterface");
$_ratingSummary = $rating->getEntitySummary($product_id);
$ratingCollection = $review->getResourceCollection()
->addStoreFilter($storeManager->getStore()->getId())
->addStatusFilter(\Magento\Review\Model\Review::STATUS_APPROVED)
->addEntityFilter('product', $product_id);
$review_count = count($ratingCollection); // How many review in that specific product
$product_rating = '';
if ($_ratingSummary->getSum() > 0 && $_ratingSummary->getCount() > 0) {
$product_rating = $_ratingSummary->getSum() / $_ratingSummary->getCount(); // Product rating in percentage
}
Method 2 :
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$rating = $objectManager->create('\Magento\Review\Model\Rating');
$storeManager = $objectManager->create("\Magento\Store\Model\StoreManagerInterface");
$ratingCollection = $rating->getResourceCollection()->addEntityFilter(
'product',$product_id
)->setPositionOrder()->setStoreFilter(
$storeManager->getStore()->getId()
)->addRatingPerStoreName(
$storeManager->getStore()->getId()
)->load();
echo "<pre>";print_r($ratingCollection->getData());
Output Like :
Array
(
[0] => Array
(
[rating_id] => 3
[entity_id] => 1
[rating_code] => Rating
[position] => 0
[is_active] => 1
[entity_code] => product
)
)
Note : Avoid to use Object Manager Method. Use Factory Method Structure.
Reference