Elastica\Type\Mapping::send PHP Method

send() public method

Submits the mapping and sends it to the server.
public send ( array $query = [] ) : Response
$query array Query string parameters to send with mapping
return Elastica\Response Response object
    public function send(array $query = [])
    {
        $path = '_mapping';
        return $this->getType()->request($path, Request::PUT, $this->toArray(), $query);
    }

Usage Example

Example #1
0
 public function testGetIdNoSource()
 {
     // Creates a new index 'xodoa' and a type 'user' inside this index
     $indexName = 'xodoa';
     $typeName = 'user';
     $client = $this->_getClient();
     $index = $client->getIndex($indexName);
     $index->create(array(), true);
     $type = $index->getType($typeName);
     $mapping = new Mapping($type);
     $mapping->disableSource();
     $mapping->send();
     // Adds 1 document to the index
     $docId = 3;
     $doc1 = new Document($docId, array('username' => 'hans'));
     $type->addDocument($doc1);
     // Refreshes index
     $index->refresh();
     $resultSet = $type->search('hans');
     $this->assertEquals(1, $resultSet->count());
     $result = $resultSet->current();
     $this->assertEquals(array(), $result->getSource());
     $this->assertInstanceOf('Elastica\\Result', $result);
     $this->assertEquals($indexName, $result->getIndex());
     $this->assertEquals($typeName, $result->getType());
     $this->assertEquals($docId, $result->getId());
     $this->assertGreaterThan(0, $result->getScore());
     $this->assertInternalType('array', $result->getData());
 }
All Usage Examples Of Elastica\Type\Mapping::send