ElasticSearch\tests\units\Client::testIndexingDocument PHP Method

testIndexingDocument() public method

Test indexing a new document
    public function testIndexingDocument()
    {
        $tag = $this->getTag();
        $doc = array('title' => 'One cool ' . $tag);
        $client = \ElasticSearch\Client::connection();
        $resp = $client->index($doc, $tag, array('refresh' => true));
        $this->assert->array($resp)->boolean($resp['created'])->isTrue(1);
        $fetchedDoc = $client->get($tag);
        $this->assert->array($fetchedDoc)->isEqualTo($doc);
    }