Skip to content

kotrakrishna/XolaElasticsearchProxyBundle

 
 

Repository files navigation

XolaElasticsearchProxyBundle

A Symfony2 plugin that acts as an authorization proxy for elasticsearch.

Installation

With composer, add:

{
    "require": {
        "xola/elasticsearch-proxy-bundle" : "dev-master"
    }
}

Then enable it in your kernel:

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        //...
        new Xola\ElasticsearchProxyBundle\XolaElasticsearchProxyBundle(),
        //...

Configuration

# app/config/config.yml
xola_elasticsearch_proxy:
    client:
        protocol: http
        host: localhost
        port: 9200
        indexes: ['logs']

The indexes parameter lets you grant access to only the specified elasticsearch indexes.

Routing

Update your routing

# app/config/routing.yml
# Xola elasticsearch proxy
XolaElasticsearchProxyBundle:
    resource: "@XolaElasticsearchProxyBundle/Resources/config/routing.yml"
    prefix:   /

The default path is /elasticsearch and permits all HTTP methods (GET, PUT, POST, etc.).

Override it. Ensure index (to capture elastic search index) and slug (to capture rest of the url) remain in the route pattern.

# app/config/routing.yml
xola_elasticsearch_proxy:
     pattern:  /myproxy/{index}/{slug}
     defaults: { _controller: XolaElasticsearchProxyBundle:ElasticsearchProxy:proxy }
     requirements:
        slug: ".+"

About

An authorization proxy for elasticsearch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%