public function testAddWordxFile() { $indexMapping = array('file' => array('type' => 'attachment'), 'text' => array('type' => 'string', 'store' => 'no')); $indexParams = array('index' => array('number_of_shards' => 1, 'number_of_replicas' => 0)); $client = new Elastica_Client(); $index = new Elastica_Index($client, 'content'); $type = new Elastica_Type($index, 'content'); $index->create($indexParams, true); $type->setMapping($indexMapping); $doc1 = new Elastica_Document(1); $doc1->addFile('file', BASE_PATH . '/data/test.docx'); $doc1->add('text', 'basel world'); $type->addDocument($doc1); $doc2 = new Elastica_Document(2); $doc2->add('text', 'running in basel'); $type->addDocument($doc2); $index->optimize(); $resultSet = $type->search('xodoa'); $this->assertEquals(1, $resultSet->count()); $resultSet = $type->search('basel'); $this->assertEquals(2, $resultSet->count()); $resultSet = $type->search('ruflin'); $this->assertEquals(0, $resultSet->count()); }