@baymose/gatsby-source-elasticsearch

Gatsby Elasticsearch source plugin

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
47May 10, 2021Jun 13, 2018Minified + gzip package size for @baymose/gatsby-source-elasticsearch in KB

Readme

gatsby-source-elasticsearch

Gatsby source plugin for Elasticsearch.

This plugin uses the Elastisearch Scroll API to obtain any number of documents.

Installation

yarn add gatsby-source-elasticsearch

Options

Option Description Type
connection Connection details string, object
index The index to query against string
typeName The type name to generate in Gatsby string
query The query to run string, object

Config Examples

Basic

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-elasticsearch',
      options: {
        connection: 'http://localhost:9200',
        index: 'test-*',
        typeName: 'testDocs',
        query: 'type:test'
      },
    },
  ],
};

Advanced Connection Option

If you pass the connection option as an object, you can use Elasticsearch client configuration options.

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-elasticsearch',
      options: {
        connection: {
          host: 'http://localhost:9200',
          log: 'info',
        },
        // ...
      },
    },
  ],
};

Advanced Query Option

If you pass the query option as an object, you can build a normal Elasticsearch search query. Otherwise, when it is passed in as a string it uses Elasticsearch query strings

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-elasticsearch',
      options: {
        query: {
          bool: {
            filter: [
              { term: { test: 'this' } },
            ],
          },
        },
        // ...
      },
    },
  ],
};

NOTE: This plugin does not support aggregations.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.