src/Search/Elastica/IndexManager.php
final public function createType(Index $index, SchemaQName $qname): Type
    {
        $type = new Type($index, $this->getTypeName($qname));
        $mapping = $this->getNodeMapper($qname)->getMapping($qname);
        $mapping->setType($type);

        try {
            $mapping->send();
        } catch (\Throwable $e) {
            throw new SearchOperationFailed(
                sprintf(
                    '%s while putting mapping for type [%s/%s] into ElasticSearch for qname [%s].',
                    ClassUtils::getShortName($e),
                    $index->getName(),
                    $type->getName(),
                    $qname
                ),
                Code::INTERNAL,
                $e
            );
        }

        return $type;
    }
final public function createType(Index $index, SchemaQName $qname): Type
    {
        $type = new Type($index, $this->getTypeName($qname));
        $mapping = $this->getNodeMapper($qname)->getMapping($qname);
        $mapping->setType($type);

        try {
            $mapping->send();
        } catch (\Throwable $e) {
            throw new SearchOperationFailed(
                sprintf(
                    '%s while putting mapping for type [%s/%s] into ElasticSearch for qname [%s].',
                    ClassUtils::getShortName($e),
                    $index->getName(),
                    $type->getName(),
                    $qname
                ),
                Code::INTERNAL,
                $e
            );
        }

        return $type;
    }
final public function createType ( Index $ index , SchemaQName $ qname ) : Type { $ type = new Type ( $ index , $ this -> getTypeName ( $ qname ) ) ; $ mapping = $ this -> getNodeMapper ( $ qname ) -> getMapping ( $ qname ) ; $ mapping -> setType ( $ type ) ; try { $ mapping -> send ( ) ; } catch ( \ Throwable $ e ) { throw new SearchOperationFailed ( sprintf ( '%s while putting mapping for type [%s/%s] into ElasticSearch for qname [%s].' , ClassUtils :: getShortName ( $ e ) , $ index -> getName ( ) , $ type -> getName ( ) , $ qname ) , Code :: INTERNAL , $ e ) ; } return $ type ; }
Creates or updates the Type in ElasticSearch.  This expects the
Index to already exist and have any analyzers it needs.

@param Index       $index The Elastica Index to create the Type in.
@param SchemaQName $qname QName used to derive the type name.

@return Type
Creates or updates the Type in ElasticSearch . This expects the Index to already exist and have any analyzers it needs .