Giter VIP home page Giter VIP logo

es-legacy-completion-plugin's Introduction

Elasticsearch Legacy Completion Plugin

This is a "hack" to allow usage of the legacy Elasticsearch 1.x/2.x completion suggester in Elasticsearch 5.x. This legacy plugin supports deduplication and is not document based.

This fixes the following Elasticsearch issue by a workaround: elastic/elasticsearch#22912

Installation and Usage

To restore the old behaviour of the old completion suggester for new indexes created with Elasticsearch 5.x use the following process:

To compile the plugin you need to install Apache Maven and a JDK 8 in your environment.

The plugin compiles with Elasticsearch 5.3.0, but should also work with earlier or later versions. Just edit the POM file by changing the plugin version number to match the Elasticsearch version, then compile and create the package:

git clone https://github.com/uschindler/es-legacy-completion-plugin
cd es-legacy-completion-plugin
mvn clean install

After that you can install es-legacy-completion-plugin-5.X.Y.zip from the target/ directory using Elasticsearch elasticsearch-plugin install command.

After installation you can change your ES 2.x mapping to use the new field type legacy_completion instead of completion (which unfortunately triggers new behaviour). When you then query the index using the usual suggestion endpoint, it will return results in the same way as Elasticsearch 2.x did.

How it works

Elasticsearch 5.x still has the old suggester code inside to support Elasticsearch 2.x indexes, but for new indexes it uses the new suggester. The completion suggester endpoint just checks the Lucene Codec that was used to create the suggestion field and then uses the old or new one.

This plugin just adds a new field type that internally enforces the use of the old Lucene Codec. This way the suggester endpoint automatically falls back to old behaviour. It does this by some hacks in the field mapper and (unfortunately), lots of code duplication, but this was kept minimal.

Caution: This is likely to break with Elasticsearch 6!

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.