You are here

protected function SearchApiElasticsearchConnector::getItemFromElasticsearch in Elasticsearch Connector 7.5

Same name and namespace in other branches
  1. 7 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::getItemFromElasticsearch()
  2. 7.2 modules/elasticsearch_connector_search_api/service.inc \SearchApiElasticsearchConnector::getItemFromElasticsearch()
1 call to SearchApiElasticsearchConnector::getItemFromElasticsearch()
SearchApiElasticsearchConnector::handleMLTSearch in modules/elasticsearch_connector_search_api/service.inc
Handle the "More like this" functionality if it is required.

File

modules/elasticsearch_connector_search_api/service.inc, line 1210
Provides a Elasticsearch-based service class for the Search API using Elasticsearch Connector module.

Class

SearchApiElasticsearchConnector
Search service class.

Code

protected function getItemFromElasticsearch(SearchApiIndex $index, $id) {
  $params = $this
    ->getIndexParam($index, TRUE);
  $params['id'] = $id;
  try {
    $response = $this->elasticsearchClient
      ->get($params);
    return $response;
  } catch (Exception $e) {
    watchdog('Elasticsearch Search API', check_plain($e
      ->getMessage()), array(), WATCHDOG_ERROR);
  }
}