private function constructSettings($settings) {
        $ret = [];

        if(array_key_exists('fields', $settings)) {
            $ret['_source'] = ['include' => $settings['fields']];
        }

        if(array_key_exists('sort', $settings)) {
            $ret['sort'] = array_map(function($x) { return [$x[0] => ['order' => $x[1] ? 'asc':'desc']]; }, $settings['sort']);
        }

        $valid_keys = ['size'];
        foreach($valid_keys as $key) {
            if(array_key_exists($key, $settings)) {
                $ret[$key] = $settings[$key];
            }
        }

        return $ret;
    }