ElasticsearchPlugin
This plugin allows your product search to be powered by Elasticsearch - a powerful Open Source search engine. This is a drop-in replacement for the DefaultSearchPlugin which exposes many powerful configuration options enabling your storefront to support a wide range of use-cases such as indexing of custom properties, fine control over search index configuration, and to leverage advanced Elasticsearch features like spacial search.
Installation
**Requires Elasticsearch v7.0 < required Elasticsearch version < 7.10 ** Elasticsearch version 7.10.2 will throw error due to incompatibility with elasticsearch-js client. Check here for more info.
yarn add @elastic/elasticsearch @vendure/elasticsearch-plugin
or
npm install @elastic/elasticsearch @vendure/elasticsearch-plugin
Make sure to remove the DefaultSearchPlugin if it is still in the VendureConfig plugins array.
Then add the ElasticsearchPlugin, calling the .init() method with ElasticsearchOptions:
Example
Search API Extensions
This plugin extends the default search query of the Shop API, allowing richer querying of your product data.
The SearchResponse type is extended with information about price ranges in the result set:
This SearchResponsePriceData type allows you to query data about the range of prices in the result set.
Example Request & Response
- Implements: OnApplicationBootstrap
init
(options: ElasticsearchOptions) => Type<ElasticsearchPlugin>