public function createIndex()
    {
        //create analysis
        $analysis = $this->container->get(
            'kunstmaan_search.search.factory.analysis'
        );

        foreach ($this->locales as $locale) {
            // Multilanguage check
            if (preg_match('/[a-z]{2}_?+[a-zA-Z]{2}/', $locale)) {
                $locale = strtolower($locale);
            }

            // Build new index
            $index = $this->searchProvider->createIndex($this->indexName . '_' . $locale);

            if (array_key_exists($locale, $this->analyzerLanguages)) {
                $localeAnalysis = clone $analysis;
                $language = $this->analyzerLanguages[$locale]['analyzer'];

                // Create index with analysis
                $this->setAnalysis($index, $localeAnalysis->setupLanguage($language));
            } else {
                $index->create();
            }

            $this->setMapping($index, $locale);
        }
    }