private function initIndexConfig(string $indexName, array $indexConfigData)
    {
        $types = [];

        foreach ($indexConfigData['types'] as $typeName => $typeConfigData) {
            $fields  = $this->getMappingFields($indexName, $typeConfigData);
            $mapping = $this->mappingFactory->create(
                ['idFieldName' => $typeConfigData['idFieldName'], 'fields' => $fields]
            );

            $types[$typeName] = $this->typeFactory->create(
                ['name' => $typeName, 'mapping' => $mapping]
            );
        }

        if (count($types) > 1) {
            throw new \LogicException("Can not add several types in the same index.");
        }

        $defaultSearchType = $indexConfigData['defaultSearchType'];

        return [
            'mapping'           => $mapping,
            'types'             => $types,
            'defaultSearchType' => $defaultSearchType,
            'datasources'       => $typeConfigData['datasources'] ?? [], // @deprecated.
        ];
    }
private function initIndexConfig(string $indexName, array $indexConfigData)
    {
        $types = [];

        foreach ($indexConfigData['types'] as $typeName => $typeConfigData) {
            $fields  = $this->getMappingFields($indexName, $typeConfigData);
            $mapping = $this->mappingFactory->create(
                ['idFieldName' => $typeConfigData['idFieldName'], 'fields' => $fields]
            );

            $types[$typeName] = $this->typeFactory->create(
                ['name' => $typeName, 'mapping' => $mapping]
            );
        }

        if (count($types) > 1) {
            throw new \LogicException("Can not add several types in the same index.");
        }

        $defaultSearchType = $indexConfigData['defaultSearchType'];

        return [
            'mapping'           => $mapping,
            'types'             => $types,
            'defaultSearchType' => $defaultSearchType,
            'datasources'       => $typeConfigData['datasources'] ?? [], // @deprecated.
        ];
    }
private function initIndexConfig ( string $ indexName , array $ indexConfigData ) { $ types = [ ] ; foreach ( $ indexConfigData [ 'types' ] as $ typeName => $ typeConfigData ) { $ fields = $ this -> getMappingFields ( $ indexName , $ typeConfigData ) ; $ mapping = $ this -> mappingFactory -> create ( [ 'idFieldName' => $ typeConfigData [ 'idFieldName' ] , 'fields' => $ fields ] ) ; $ types [ $ typeName ] = $ this -> typeFactory -> create ( [ 'name' => $ typeName , 'mapping' => $ mapping ] ) ; } if ( count ( $ types ) > 1 ) { throw new \ LogicException ( "Can not add several types in the same index." ) ; } $ defaultSearchType = $ indexConfigData [ 'defaultSearchType' ] ; return [ 'mapping' => $ mapping , 'types' => $ types , 'defaultSearchType' => $ defaultSearchType , 'datasources' => $ typeConfigData [ 'datasources' ] ?? [ ] , // @deprecated. ] ; }
Init type, mapping, and fields from a index configuration array.

@param string $indexName       Processed index name.
@param array  $indexConfigData Processed index configuration.

@return array
Init type mapping and fields from a index configuration array .