public function searchMetrics($search, $by, $limit = 1, $num = 1000, $page = 1)
    {
        $metrics = $this->indexMetrics($num, $page)['data'];

        $filtered = array_filter(
            $metrics,
            function ($metric) use ($search, $by) {

                if (array_key_exists($by, $metric)) {
                    if (strpos($metric[$by], $search) !== false) {
                        return $metric;
                    }
                    if ($metric[$by] === $search) {
                        return $metric;
                    }
                }

                return false;
            }
        );

        if ($limit == 1) {
            return array_shift($filtered);
        }

        return array_slice($filtered, 0, $limit);
    }