Giter Club home page Giter Club logo

elasticsearch_helper_views-1's Introduction

Elasticsearch Helper Views

elasticsearch_helper_views is a module that provides a way to display Elasticsearch results using Drupal Views.

The module contains a Views query plugin Elasticsearch which acts as a bridge between Views display and Elasticsearch. The module defines an ElasticsearchQueryBuilder plugin type and an extendable base implementation which allows building Query DSL definition accepted by Elasticsearch client.

Given the arbitrary nature of Elasticsearch document properties, it's impossible to create a definitive list of field and filter plugins that cover all the data stored in Elasticsearch. For that reason for each data listing you might want to create your own views field and filter plugins that correspond to specific fields in the index. The same applies to Query DSL builder plugin which you will have to create on your own.

The following views field plugins are provided out of the box:

  • Rendered entity plugin which displays rendered Drupal entities in pre-selected view mode per entity type; if Elasticsearch documents contain identification ID to other Drupal entities (e.g., author ID), Rendered entity plugin can be used to display entities of different types (together with provided views relationship plugin);
  • Source field plugin which displays raw values from the Elasticsearch document _source array.

Usage

  1. Install Elasticsearch search engine (how-to).
  2. Install Elasticsearch Helper module, configure it and create indices using ElasticsearchIndex type plugins in a custom module.
  3. Create an ElasticsearchQueryBuilder type plugin in a custom module.
  4. If you want to create exposed filter in your view, you will have to create custom views filter plugins and define them in a hook_views_data_alter() hook for elasticsearch_result data type.
  5. Create a view and select Elasticsearch result as a data type.
  6. In a view configuration form click on the Query settings link and select the query building plugin that will generate Query DSL for this particular view.
  7. Save the view.

Composer

Add the following snippet to composer.json file and run composer require maijs/elasticsearch_helper_views to have the module added to your project.

{
    "repositories": [
        {
            "name": "maijs/elasticsearch_helper_views",
            "type": "vcs",
            "url": "https://github.com/maijs/elasticsearch_helper_views.git"
        }
    ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.