Documentation
¶
Overview ¶
Package writer implements the `whosonfirst/go-writer/v2` interfaces for writing documents to Elasticsearch.
Index ¶
- func NewOpensearchV2Writer(ctx context.Context, uri string) (wof_writer.Writer, error)
- type DocumentWriter
- type OpensearchV2Writer
- func (wr *OpensearchV2Writer) AppendPrepareFunc(ctx context.Context, fn document.PrepareDocumentFunc) error
- func (wr *OpensearchV2Writer) Close(ctx context.Context) error
- func (wr *OpensearchV2Writer) Flush(ctx context.Context) error
- func (wr *OpensearchV2Writer) SetLogger(ctx context.Context, logger *log.Logger) error
- func (wr *OpensearchV2Writer) Write(ctx context.Context, path string, r io.ReadSeeker) (int64, error)
- func (wr *OpensearchV2Writer) WriterURI(ctx context.Context, uri string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewOpensearchV2Writer ¶
NewOpensearchV2Writer returns a new `OpensearchV2Writer` instance for writing documents to an Opensearch index using the github.com/opensearch-project/opensearch-go/v2 package configured by 'uri' which is expected to take the form of:
opensearch://{HOST}:{PORT}/{INDEX}?{QUERY_PARAMETERS} opensearch2://{HOST}:{PORT}/{INDEX}?{QUERY_PARAMETERS}
Where {QUERY_PARAMETERS} may be one or more of the following: * ?bulk-index={BOOLEAN}. If true then writes will be performed using a "bulk indexer". Default is true. * ?workers={INT}. The number of users to enable for bulk indexing. Default is 10.
Types ¶
type DocumentWriter ¶ added in v0.0.2
type DocumentWriter interface { // AppendPrepareFunc will append 'fn' to the list of `go-whosonfirst-elasticsearch/document.PrepareDocumentFunc` functions // to be applied to each document written. AppendPrepareFunc(context.Context, document.PrepareDocumentFunc) error }
DocumentWriter is an interface to provide methods not offered by the `whosonfirst/go-writer.Writer` interface.
type OpensearchV2Writer ¶
type OpensearchV2Writer struct { wof_writer.Writer // whosonfirst/go-writer.Writer interface DocumentWriter // whosonfirst/go-whosonfirst-opensearch/writer.DocumentWriter interface // contains filtered or unexported fields }
OpensearchV2Writer is a struct that implements the `Writer` interface for writing documents to an Opensearch index using the github.com/opensearch-project/opensearch-go/v2 package.
func (*OpensearchV2Writer) AppendPrepareFunc ¶ added in v0.0.2
func (wr *OpensearchV2Writer) AppendPrepareFunc(ctx context.Context, fn document.PrepareDocumentFunc) error
AppendPrepareFunc will append 'fn' to the list of `go-whosonfirst-elasticsearch/document.PrepareDocumentFunc` functions to be applied to each document written.
func (*OpensearchV2Writer) Close ¶
func (wr *OpensearchV2Writer) Close(ctx context.Context) error
Close waits for all pending writes to complete and closes the underlying writer mechanism.
func (*OpensearchV2Writer) Flush ¶
func (wr *OpensearchV2Writer) Flush(ctx context.Context) error
Flush() does nothing in a `OpensearchV2Writer` context.
func (*OpensearchV2Writer) Write ¶
func (wr *OpensearchV2Writer) Write(ctx context.Context, path string, r io.ReadSeeker) (int64, error)
Write copies the content of 'fh' to the Opensearch index defined in `NewOpensearchV2Writer`.