当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::get方法代码示例

本文整理汇总了PHP中Elasticsearch\Client::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::get方法的具体用法?PHP Client::get怎么用?PHP Client::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Elasticsearch\Client的用法示例。


在下文中一共展示了Client::get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTitle

 public function getTitle(FilePath $path)
 {
     $params = array('index' => $this->index, 'type' => self::MARKDOWN_DOCUMENT_TYPE, 'id' => $path->toAbsoluteUrlString(), '_source_include' => array('title'));
     $result = $this->client->get($params);
     if (null === $result) {
         return null;
     }
     return $result['_source']['title'];
 }
开发者ID:terretta,项目名称:gitki.php,代码行数:9,代码来源:ElasticsearchRepository.php

示例2: testCreateJob

 public function testCreateJob()
 {
     $job = self::$jobFactory->create(uniqid());
     $id = self::$jobMapper->create($job);
     $res = self::$client->get(['index' => self::$index->getIndexNameCurrent(), 'type' => 'jobs', 'id' => $id]);
     $resJob = $res['_source'];
     $job = self::$jobMapper->get($id);
     $this->assertJob($job, $resJob);
     $this->assertEquals($job->getVersion(), $res['_version']);
 }
开发者ID:ErikZigo,项目名称:syrup,代码行数:10,代码来源:JobMapperTest.php

示例3: find

 /**
  * @param string $identity
  * @return Document
  */
 public function find($identity)
 {
     try {
         $data = $this->client->get(['index' => $this->index, 'type' => $this->type, 'id' => $identity]);
         $documentClass = $this->documentClass;
         return $documentClass::deserialize($data['_source']);
     } catch (Missing404Exception $e) {
     }
     return null;
 }
开发者ID:EightArmCode,项目名称:librarian,代码行数:14,代码来源:ElasticSearchStorage.php

示例4: saveDocument

 /**
  * {@inheritdoc}
  */
 public function saveDocument(Searchable $model)
 {
     $document = $this->constructDocument($model);
     if (!$this->indexIsNested($model->getSearchIndex())) {
         $this->client->index($document);
         return;
     }
     list($index, $type) = $this->retrieveNestedIndex($model->getSearchIndex());
     $class = $this->retrieveParentClass($model->getSearchIndex());
     $parent = $model->belongsTo($class, null, null, class_basename($class))->getResults();
     $parentData = $this->client->get(['id' => $parent->getKey(), 'type' => $parent->getSearchType(), 'index' => $parent->getSearchIndex()])['_source'];
     if (!isset($parentData[$type])) {
         $parentData[$type] = [];
     }
     $children = Collection::make($parentData[$type]);
     if ($child = $children->first(function ($child) use($model) {
         return $child[$model->getKeyName()] == $model->getKey();
     })) {
         $newChildren = $children->map(function ($child) use($model) {
             if ($child[$model->getKeyName()] == $model->getKey()) {
                 $child = $model->documentToArray();
                 if (!isset($document[$model->getKeyName()])) {
                     $child[$model->getKeyName()] = $model->getKey();
                 }
             }
             return $child;
         });
     } else {
         $newChildren = $children->push($model->documentToArray());
     }
     $this->client->update(['id' => $parent->getKey(), 'type' => $parent->getSearchType(), 'index' => $parent->getSearchIndex(), 'body' => ['doc' => [$type => $newChildren]]]);
 }
开发者ID:phroggyy,项目名称:discover,代码行数:35,代码来源:ElasticSearchService.php

示例5: find

 /**
  * @param string $identity
  * @return Document
  * @throws DocumentNotFoundException
  */
 public function find(string $identity) : Document
 {
     try {
         $data = $this->client->get($this->createParams($identity));
         return $this->serializer->deserialize($this->serializer->serialize($data['_source']), $this->documentClass);
     } catch (Missing404Exception $e) {
         throw new DocumentNotFoundException($identity);
     }
 }
开发者ID:martyn82,项目名称:apha,代码行数:14,代码来源:ElasticSearchStateStorage.php

示例6: executeByElasticClient

 /**
  * Execute the request by elasticsearch client
  *
  * @param Client $client
  * @return ResponseInterface
  */
 public function executeByElasticClient(Client $client)
 {
     $params = $this->toElasticClient();
     $responseClass = $this->getResponseClassOfRequest();
     /** @var GetResponseInterface $response */
     $response = new $responseClass();
     $result = RawResponse::build($client->get($params));
     if (null !== $this->document) {
         $response->setDocument($this->document);
     }
     $response->build($result);
     return $response;
 }
开发者ID:ra3oul,项目名称:Pelastic,代码行数:19,代码来源:GetRequest.php

示例7: findOne

 /**
  * Retrieves an entity by its id.
  * @param string $id
  * @return ElasticsearchEntity the entity with the given id or null if none found
  */
 public function findOne($id)
 {
     try {
         $result = $this->elasticsearchClient->get(array('id' => $id, 'index' => $this->index, 'type' => $this->getType()));
         if (!$result || !$result['found']) {
             return null;
         }
         $entity = $this->createEntityFromDocument($result);
         return $entity;
     } catch (Missing404Exception $exc) {
         return null;
     }
 }
开发者ID:aboutyou,项目名称:ayoc-persistence-elasticsearch,代码行数:18,代码来源:ElasticsearchCrudRepository.php

示例8: get

 /**
  * @param GetParams $params
  * @return GetResponse
  */
 public function get(GetParams $params)
 {
     return new GetResponse($this->nativeClient->get($params->toArray()));
 }
开发者ID:ulff,项目名称:ElasticsearchPhpClientBundle,代码行数:8,代码来源:ElasticSearchPhpClient.php

示例9: get

 /**
  * Get a document index.
  *
  * @param array $params
  *
  * @return array
  */
 public function get(array $params)
 {
     return $this->client->get($this->prepareParams($params));
 }
开发者ID:krisanalfa,项目名称:ductible,代码行数:11,代码来源:Ductible.php

示例10: documentGet

 /**
  * Perform an insertion into the engine.
  *
  * @param  array $payload
  * @return array
  */
 public function documentGet($payload)
 {
     return $this->client->get($payload);
 }
开发者ID:saulolozano,项目名称:Stretchy,代码行数:10,代码来源:Connection.php


注:本文中的Elasticsearch\Client::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。