Exemplo n.º 1
0
 public static function addDocuments(\ElasticSearchClient $client, $num = 3, $tag = 'cool')
 {
     $options = array('refresh' => true);
     while ($num-- > 0) {
         $doc = array('title' => "One cool document {$tag}", 'rank' => rand(1, 10));
         $client->index($doc, $num + 1, $options);
     }
     return $client;
 }
Exemplo n.º 2
0
 public function testMapFields()
 {
     $client = new \ElasticSearchClient();
     $client->init();
     $client->configuration(array('index' => 'test-index', 'type' => 'test-type'));
     $client->index(array('tweet' => 'ElasticSearch is awesome'));
     $response = $client->map(array('tweet' => array('type' => 'string')));
     $this->assert->array($response)->isNotEmpty();
 }