2017 © Pedro Peláez
 

symfony-bundle elasticsearch-proxy-bundle

A Symfony2 plugin that acts as an authorization proxy for elasticsearch

image

xola/elasticsearch-proxy-bundle

A Symfony2 plugin that acts as an authorization proxy for elasticsearch

  • Wednesday, January 24, 2018
  • by anush
  • Repository
  • 6 Watchers
  • 0 Stars
  • 13,657 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

XolaElasticsearchProxyBundle

A Symfony2 plugin that acts as a proxy for Elasticsearch., (*1)

Installation

With composer, add:, (*2)

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

Then enable it in your kernel:, (*3)

// 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., (*4)

Routing

Update your routing, (*5)

# 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.)., (*6)

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

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

Events

There are a couple of events fired by the bundle controller that can help you. By listening to these events you can add any custom authentication or filtering logic you require., (*8)

  1. elasticsearch_proxy.before_elasticsearch_request - This event is fired before the request is sent to Elasticsearch. The listener will receive ElasticsearchProxyEvent as an argument containing the request, index, slug, and the query object. You may modify this query object and set it back on the event with setQuery. The updated request will then be sent on to Elasticsearch., (*9)

  2. elasticsearch_proxy.after_elasticsearch_response - This event is fired after a response has been received from Elasticsearch. The listener will receive ElasticsearchProxyEvent as argument containing the request, index, slug, query, and response objects. You may modify the response and set it back into the event. The updated response is then sent back to the client., (*10)

The Versions

24/01 2018

dev-master

9999999-dev https://github.com/xola/XolaElasticsearchProxyBundle

A Symfony2 plugin that acts as an authorization proxy for elasticsearch

  Sources   Download

MIT

The Requires

 

by Venkata Krishna Kotra
by Anush Ramani

authorization search elasticsearch symfony proxy

24/01 2018

v0.2

0.2.0.0 https://github.com/xola/XolaElasticsearchProxyBundle

A Symfony2 plugin that acts as an authorization proxy for elasticsearch

  Sources   Download

MIT

The Requires

 

by Venkata Krishna Kotra
by Anush Ramani

authorization search elasticsearch symfony proxy