How to query without the link of the entity?

148 views Asked by At

I have datas in the index article and it doesn't have data in the mysql database. I just want pure elastic search. I try this setup

indexes:
articles:
  client: ~
  types:
    articles:         
      persistence:
        driver: orm
        model: App\Entity\Articles
        provider: ~
        finder: ~
        listener: 
          enabled: false
          insert: false
          update: false
          delete: false
          flush:  false
        elastica_to_model_transformer: 
          hydrate: false
          ignore_missing: true
      properties:
        name: ~
        slug: ~
        content: ~
        tags: ~

when the time i search the value in the elasticsearch using this code

$boolQuery = new \Elastica\Query\BoolQuery();
$fieldQuery = new \Elastica\Query\MatchQuery();
$fieldQuery->setFieldQuery('name', 'batman4');
$boolQuery->addShould($fieldQuery);

$data = $this->finder->find($boolQuery);

I always get this error

Cannot find corresponding Doctrine objects (0) for all Elastica results (1). Missing IDs: 6. IDs: 6

This is because the data is not in the database. I dont want my data link into mysql database. I just want to search data in elastic without linking to the database. Is this possible in FOSElasticaBundle? Maybe I miss something in my setup. It

1

There are 1 answers

0
Nisam On

That error will fic by re-populating the index

php bin/console fos:elastica:populate --index=articles