summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/test/benchmark/ClientTest.php
blob: e7a040f7b3a63f01c550d07c9ccab9ac676e7aa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

use Elastica\Client;
use Elastica\Document;

class ClientTest extends \PHPUnit_Framework_TestCase
{

    public function testServersArray()
    {
        $client = new Client();
        $index = $client->getIndex('test');
        $index->create(array(), true);
        $type = $index->getType('test');

        $start = microtime(true);

        for ($i = 1; $i <= 10000; $i++) {
            $doc = new Document($i, array('test' => 1));
            $type->addDocument($doc);
        }

        // Refresh index
        $index->refresh();

        $end = microtime(true);

        //echo $end - $start;

    }
}