LinChan
LinChan

Reputation: 424

elasticbundle search an index

Good Morning,

I would like some help for FOSElastcaBundle. I have a installed elasticsearch with kibana and logstash. I have an index named openvpn and there is the _type rsyslog-openvpn. I would like to get some entry, for the element where the fiels common_name is equal to PLPM0046.

I installed FOSElasticaBundle but I cannot seems to make it work.

Here is my configuration so far: config.yml

fos_elastica:
    clients:
        default: { host: ip.to.server.elastic, port: 9200 }
    indexes:
        openvpn:
            client: default
            types:
                rsyslog-openvpn:
                    mappings:
                        common_name: ~
                        logsource: ~

action

$finder = $this->container->get('fos_elastica.index.openvpn.rsyslog-openvpn');
$results = $finder->find('PLPM0046');

I did as it is presented in the documentation, but I get this errors:

You have requested a non-existent service "fos_elastica.index.openvpn.rsyslog-openvpn".

I anyone knosw how this bundle work, thanks

Upvotes: 1

Views: 346

Answers (1)

john Smith
john Smith

Reputation: 17906

as far as i can read my working code, you can get the finder like:

$finder = $this->container->get('fos_elastica.finder.openvpn.rsyslog-openvpn');

additionally add finder: ~ to your index

    indexes:
        openvpn:
            client: default
            finder: ~
            types:
                rsyslog-openvpn:
                    mappings:
                        ...
                    persistence:
                        finder: ~

Upvotes: 1

Related Questions