Elastica\IndexTemplate::create PHP Method

create() public method

Creates a new index template with the given arguments.
public create ( array $args = [] ) : Response
$args array OPTIONAL Arguments to use
return Response
    public function create(array $args = [])
    {
        return $this->request(Request::PUT, $args);
    }

Usage Example

 /**
  * @group functional
  */
 public function testCreateTemplate()
 {
     $template = array('template' => 'te*', 'settings' => array('number_of_shards' => 1));
     $name = 'index_template1';
     $indexTemplate = new IndexTemplate($this->_getClient(), $name);
     $indexTemplate->create($template);
     $this->assertTrue($indexTemplate->exists());
     $indexTemplate->delete();
     $this->assertFalse($indexTemplate->exists());
 }