/** * Run a term vectors query against the index and return the result. * * @param RequestInterface $request The spellcheck request. * * @return array */ private function getTermVectors(RequestInterface $request) { $termVectorsQuery = ['index' => $request->getIndex(), 'type' => $request->getType(), 'id' => '', 'term_statistics' => true]; $termVectorsQuery['body']['doc'] = [MappingInterface::DEFAULT_SPELLING_FIELD => $request->getQueryText()]; return $this->client->termvectors($termVectorsQuery); }