Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 1.13 KB

README.md

File metadata and controls

33 lines (21 loc) · 1.13 KB

REST Layer ElasticSearch Backend

godoc license build

This REST Layer resource storage backend stores data in an ElasticSearch cluster using olivere/elastic.

ElasticSearch v5+ is required.

Usage

import "github.com/rs/rest-layer-es"

Create an elastic client:

client, err := elastic.NewClient()

Create a resource storage handler with a given DB/collection:

s := es.NewHandler(client, "index", "type")

Use this handler with a resource:

index.Bind("foo", foo, s, resource.DefaultConf)

You may want to create as many ElasticSearch handlers with different index and/or type. You can share the same elastic client across all you handlers.