public function retrieveKeyValue($key, $value, $params = array())
    {
        // /v1/keyvalue is deprecated, use /v1/search with structured
        $this->key = (string)$key;
        $this->value = (string)$value;
        $query = '<query xmlns="http://marklogic.com/appservices/search">
                    <container-query>
                      <json-property name="' . $this->key . '" ns="" />
                      <term-query>
                        <text>' . $this->value . '</text>
                      </term-query>
                    </container-query>
                  </query>';

        try {
            $params = array_merge(
                array('structuredQuery' => $query),
                $this->getParams(), $params
            );
            $request = new RESTRequest('GET', 'search', $params);
            $response = $this->client->send($request);
            $results = new SearchResults($response->getBody());
            return $results;
        } catch(Exception $e) {
            echo $e->getMessage() . ' in ' . $e->getFile() .
            ' on line ' . $e->getLine() . PHP_EOL;
        }
    }