title: creating custom repository fos elastic search
body: <p>im trying to make a simple custom repository in order to understand how elastic search repository works. the documentation is pretty straight forward but i still dont understand how it works, im getting this error  ´The service definition "fos_elastica.manager" does not exist.´. so far i think my problem is in the controller since i dont understand how to intialize them, also i would like to know if im in the right way in my configuration of the custom repository and the simple query i made.</p>
  
  <p>im getting this error with this configuration whenever i try to make a search, </p>
  
  <pre><code> The service definition "fos_elastica.manager" does not exist.
  </code></pre>
  
  <p>this is my configuration so far:
      //app/config.yml</p>
  
  <blockquote>
  <pre><code>fos_elastica:
      clients:
          default: { host: localhost, port: 9200 }
      indexes:
           sava:
              client: default
              types:
                  blog:
                      mappings:
                          id:
                              type: integer
                          body : ~
                          title : ~
                          tags: ~
                      persistence:
                          identifier: id
                          driver: orm
                          model: sava\BlogBundle\Entity\TblPost
                          finder: ~
                          provider: ~
                          listener: ~
                          repository: sava\BlogBundle\SearchRepository\TblPostRepository
  </code></pre>
  </blockquote>
  
  <p>this is my controller action:</p>
  
  <pre><code>namespace sava\BlogBundle\Controller;
  
  //custom querys
  use FOS\ElasticaBundle\Manager\RepositoryManager;
  use FOS\ElasticaBundle\Repository;
  //
  use Symfony\Component\DependencyInjection\ContainerBuilder;
  
  class TblPostController extends Controller
  {
          public function getPostAction(Request $request)
      {   
           $container = new ContainerBuilder();
           $repositoryManager = $container-&gt;get('fos_elastica.manager');
  
           $repository = $repositoryManager-&gt;getRepository('BlogBundle:TblPost');
  
          $items2 = $repository-&gt;matchExact($categoria,$searchQuery );
  
  
           return $this-&gt;render('savaBlogBundle:TblPost:index.html.twig', array(
                      'results' =&gt; $items2, 'entities' =&gt; $items2
          ));
      }
  </code></pre>
  
  <p>this is my post repository:</p>
  
  <pre><code>&lt;?php
  
  namespace sava\BlogBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  use FOS\ElasticaBundle\Repository;
  
  class TblPostRepository extends FOS\ElasticaBundle\Repository
  {
      public function matchExact($campo, $searchQuery) {
  
  
           //$finder = $this-&gt;get('fos_elastica.finder.sava.blog');
  
          $query = new Query();
          if($searchQuery=='')
          {
              $innerQuery = new Query\MatchAll();
          }
          else{
             $innerQuery = new Query\Match();
          $innerQuery-&gt;setField( $campo  , array('query' =&gt; $searchQuery));
          }
          $query-&gt;setQuery($innerQuery);
          $query-&gt;setSize(1000000);
          $query-&gt;setExplain(true);
  
          return $this-&gt;find($query);
      }  
  }
  </code></pre>
  
  <p>and since im using yml this is my tblpost.orm, i did generate my entities.</p>
  
  <p>whenever i do the get postaction it throws me that it cant find the container, and i dont see an example in how to properly intiaze it, also is this is how you make a custom query?</p>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>so i changed this:</p>
  
  <pre><code>    $container = new ContainerBuilder();
      $repositoryManager = $container-&gt;get('fos_elastica.manager');
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>    $elastica = $this-&gt;container-&gt;get('fos_elastica.manager');// single entry point, no fancy services    
      $SearchRepository = $elastica-&gt;getRepository('savaBlogBundle:TblPostRepository');// single type
  </code></pre>
  
  <p>and im getting this error:</p>
  
  <pre><code> No search finder configured for sava\BlogBundle\Entity\TblPostRepository
  </code></pre>