Esempio n. 1
0
 public function testCustomQueryParams()
 {
     $params = array();
     $params['hosts'] = array($_SERVER['ES_TEST_HOST']);
     $client = new Elasticsearch\Client($params);
     $getParams = array('index' => 'test', 'type' => 'test', 'id' => 1, 'parent' => 'abc', 'custom' => array('customToken' => 'abc', 'otherToken' => 123));
     $exists = $client->exists($getParams);
 }
 /**
  * @inheritdoc
  */
 public function exists(array $params = [])
 {
     return $this->client->exists($params);
 }
 /**
  * check if an item exists in a given index
  *
  * @param string $index index name
  * @param string $type item type
  * @param string $id item id
  *
  * @return array
  */
 public function seeItemExistsInElasticsearch($index, $type, $id)
 {
     return $this->elasticSearch->exists(['index' => $index, 'type' => $type, 'id' => $id]);
 }
 /**
  * Returns whether an entity with the given id exists.
  * @param string $id
  * @return boolean true if an entity with the given id exists, false otherwise
  */
 public function exists($id)
 {
     return $this->elasticsearchClient->exists(array('id' => $id, 'index' => $this->index, 'type' => $this->getType()));
 }
Esempio n. 5
0
 /**
  * Execute a exists statement on index.
  *
  * @param array $params
  *
  * @return array|bool
  */
 public function existsStatement(array $params)
 {
     return $this->elastic->exists($this->setStatementIndex($params));
 }
 public function testExists()
 {
     $this->markTestSkipped('Unsupported yet');
     $this->assertTrue($this->client->exists(['index' => 'my_index', 'type' => 'my_type', 'id' => 'my_id']));
 }
Esempio n. 7
0
 /**
  * @expectedException \Elasticsearch\Common\Exceptions\Curl\CouldNotConnectToHost
  */
 public function testZeroRetries()
 {
     $params = array('retries' => 0, 'hosts' => array('localhost:8000'));
     $client = new Elasticsearch\Client($params);
     $client->exists(array("index" => 'test', 'type' => 'test', 'id' => 'test'));
 }
 public function testHTTPS()
 {
     // Hosts param must be an array.
     $params = array('hosts' => array('https://localhost'));
     $client = new Elasticsearch\Client($params);
     try {
         $client->exists(array('index' => 't', 'type' => 't', 'id' => 1));
     } catch (\Exception $e) {
     }
     $last = $client->transport->getLastConnection()->getLastRequestInfo();
     $this->assertEquals('https://localhost:9200/t/t/1?', $last['request']['uri']);
 }