<?php
//// src/Controller/LuckyController.php
//namespace App\Controller;
//
//use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
//use Symfony\Component\HttpFoundation\Response;
//use FOS\ElasticaBundle\Index\IndexManager;
//use FOS\ElasticaBundle\Transformer\ElasticaToModelTransformerCollection;
//use Symfony\Component\Routing\Annotation\Route;
//
//
///**
// * Class EsController
// * @package App\Controller
// */
//class EsController extends AbstractController
//{
//    private $elasticaIndexManager;
//    private $elasticaToModelTransformerCollectionSearch;
//
//    public function __construct(IndexManager $elasticaIndexManager, ElasticaToModelTransformerCollection $elasticaToModelTransformerCollectionSearch)
//    {
//        $this->elasticaToModelTransformerCollectionSearch = $elasticaToModelTransformerCollectionSearch;
//        $this->elasticaIndexManager = $elasticaIndexManager;
//    }
//
//    /**
//     * @Route("/es_test")
//     * @return Response
//     */
//    public function es_test(): Response
//    {
//        $search = $this->elasticaIndexManager->getIndex('search')->createSearch();
//        $search->addType('organization');
//        $options['limit'] = 10;
//
//        $queryPart = new \Elastica\Query\BoolQuery();
//        $filtered = new \Elastica\Query\Filtered($queryPart);
//
//
//        $query = \Elastica\Query::create($filtered);
//        $resultSet = $search->search($query->getQuery(), $options);
//
//        $response = $this->elasticaToModelTransformerCollectionSearch->transform($resultSet->getResults());
//
//        dump($response);
//        die;
//    }
//}