public function addDocuments($documents, $indexName = '', $indexType = '')
    {
        if ("" === $indexName && isset($documents[0])) {
            $indexName = $documents[0]->getIndexName();
        } else {
            $indexName = $this->indexNamePrefix . $indexName;
        }

        $this->mapProviders(function (SearchProviderInterface $provider) use ($documents, $indexName, $indexType) {

            $documents = array_map(function (DocumentReference $document) use ($provider) {
                return $provider->createDocument(
                    $document->getDocument(),
                    $document->getUid(),
                    $document->getIndexName(),
                    $document->getIndexType()
                );
            }, $documents);

            $provider->addDocuments($documents, $indexName, $indexType);
        });
    }